From cb2a3bad2f7109155e6f61e50d7156a73a5a81db Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Tue, 26 May 2020 18:03:11 +0200 Subject: [PATCH] installScript: use channel server to fetch latest stable k3s version --- Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index ac8629ed..18e343ba 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,12 @@ ifeq ($(GIT_TAG),) GIT_TAG := $(shell git describe --always) endif -# get latest k3s version: grep the tag JSON field, extract the tag and replace + with - (difference between git and dockerhub tags) -ifneq (${GITHUB_API_TOKEN},) -K3S_TAG := $(shell curl --silent -H "Authorization: token: ${GITHUB_API_TOKEN}" "https://api.github.com/repos/rancher/k3s/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -E 's/\+/\-/') -else -K3S_TAG := $(shell curl --silent "https://api.github.com/repos/rancher/k3s/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -E 's/\+/\-/') -endif +# get latest k3s version: grep the tag and replace + with - (difference between git and dockerhub tags) +K3S_TAG := $(shell curl --silent "https://update.k3s.io/v1-release/channels/stable" | egrep -o '/v[^ ]+"' | sed -E 's/\/|\"//g' | sed -E 's/\+/\-/') + ifeq ($(K3S_TAG),) $(warning K3S_TAG undefined: couldn't get latest k3s image tag!) -$(warning Output of curl: $(shell curl --silent "https://api.github.com/repos/rancher/k3s/releases/latest")) +$(warning Output of curl: $(shell curl --silent "curl --silent "https://update.k3s.io/v1-release/channels/stable"")) $(error exiting) endif