diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index bbad4904235..6d1543e917f 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -34,4 +34,4 @@ jobs: run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} - name: Publish - run: make IMAGE_TAG=$VERSION publish \ No newline at end of file + run: make VERSION=$VERSION publish \ No newline at end of file diff --git a/CREATE-NEW-SCALER.md b/CREATE-NEW-SCALER.md index df5fd329373..d15b4c77c77 100644 --- a/CREATE-NEW-SCALER.md +++ b/CREATE-NEW-SCALER.md @@ -12,7 +12,7 @@ In order to develop a scaler, a developer should do the following: 6. Run `make build` from the root of KEDA and your scaler is ready. If you want to deploy locally -1. Run `export IMAGE_TAG=local` +1. Run `export VERSION=local` 2. Open the terminal and go to the root of the source code 3. Run `make build` 5. If you haven't done it yet clone the charts repository: `git clone git@github.com:kedacore/charts.git` diff --git a/Makefile b/Makefile index 4e5f4d8150a..0e4ba887b04 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ ################################################## # Variables # ################################################## -IMAGE_TAG ?= master +VERSION ?= master IMAGE_REGISTRY ?= docker.io IMAGE_REPO ?= kedacore -IMAGE_CONTROLLER = $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda:$(IMAGE_TAG) -IMAGE_ADAPTER = $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-metrics-adapter:$(IMAGE_TAG) +IMAGE_CONTROLLER = $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda:$(VERSION) +IMAGE_ADAPTER = $(IMAGE_REGISTRY)/$(IMAGE_REPO)/keda-metrics-adapter:$(VERSION) ARCH ?=amd64 CGO ?=0 @@ -49,6 +49,20 @@ publish: build docker push $(IMAGE_ADAPTER) docker push $(IMAGE_CONTROLLER) +################################################## +# Release # +################################################## +K8S_DEPLOY_FILES = $(shell find ./deploy -name '*.yaml') + +.PHONY: release +release: + @sed -i 's@Version =.*@Version = "$(VERSION)"@g' ./version/version.go; + @for file in $(K8S_DEPLOY_FILES); do \ + sed -i 's@app.kubernetes.io/version:.*@app.kubernetes.io/version: "$(VERSION)"@g' $$file; \ + sed -i 's@image: docker.io/kedacore/keda:.*@image: docker.io/kedacore/keda:$(VERSION)@g' $$file; \ + sed -i 's@image: docker.io/kedacore/keda-metrics-adapter:.*@image: docker.io/kedacore/keda-metrics-adapter:$(VERSION)@g' $$file; \ + done + ################################################## # Build # ################################################## @@ -66,12 +80,12 @@ build: checkenv build-adapter build-controller .PHONY: build-controller build-controller: generate-api pkg/scalers/liiklus/LiiklusService.pb.go $(GO_BUILD_VARS) operator-sdk build $(IMAGE_CONTROLLER) \ - --go-build-args "-ldflags -X=main.GitCommit=$(GIT_COMMIT) -ldflags -X=github.com/kedacore/keda/version.Version=$(IMAGE_TAG) -o build/_output/bin/keda" + --go-build-args "-ldflags -X=main.GitCommit=$(GIT_COMMIT) -ldflags -X=github.com/kedacore/keda/version.Version=$(VERSION) -o build/_output/bin/keda" .PHONY: build-adapter build-adapter: generate-api pkg/scalers/liiklus/LiiklusService.pb.go $(GO_BUILD_VARS) go build \ - -ldflags "-X=main.GitCommit=$(GIT_COMMIT) -X=github.com/kedacore/keda/version.Version=$(IMAGE_TAG)" \ + -ldflags "-X=main.GitCommit=$(GIT_COMMIT) -X=github.com/kedacore/keda/version.Version=$(VERSION)" \ -o build/_output/bin/keda-adapter \ cmd/adapter/main.go docker build -f build/Dockerfile.adapter -t $(IMAGE_ADAPTER) . diff --git a/README.md b/README.md index da6d8e1f6e1..35123a3d15e 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ If you want to change KEDA's behaviour, or if you have created a new scaler (mor to deploy it as part of KEDA. Do the following: 1. Make your change in the code. -2. In terminal, create an environment variable `IMAGE_TAG` and assign it a value for your preference, this tag will +2. In terminal, create an environment variable `VERSION` and assign it a value for your preference, this tag will be used when creating the operator image that will run KEDA. ***Note***: make sure it doesn't clash with the official tags of KEDA containers in DockerHub. 3. Still in terminal, run `make build` at the root of the source code. This will also build the docker image for @@ -149,7 +149,7 @@ to deploy it as part of KEDA. Do the following: 5. Still in terminal, navigate to the `charts/keda` folder (downloaded in step 4), and run the following command (don't forget to replace the placeholder text in the command): ```bash - helm install . --set image.keda=kedacore/keda:$IMAGE_TAG,image.metricsAdapter=kedacore/keda-metrics-adapter:$IMAGE_TAG,image.pullPolicy=IfNotPresent + helm install . --set image.keda=kedacore/keda:$VERSION,image.metricsAdapter=kedacore/keda-metrics-adapter:$VERSION,image.pullPolicy=IfNotPresent ``` This will use the images built at step 3. Notice the need to override the image pullPolicy to `IfNotPresent` in order to use the locally built images and not try to pull the images from remote repo on Docker Hub (and complain diff --git a/RELEASE-PROCESS.MD b/RELEASE-PROCESS.MD index eb563ba8f37..f231747ee9c 100644 --- a/RELEASE-PROCESS.MD +++ b/RELEASE-PROCESS.MD @@ -10,26 +10,12 @@ The next version will thus be 1.2.0 **1) Update KEDA version in code and YAMLs** -Update version string in: -https://github.com/kedacore/keda/blob/master/version/version.go - -Update sections related to images in these yamls: -https://github.com/kedacore/keda/blob/master/deploy/12-operator.yaml -https://github.com/kedacore/keda/blob/master/deploy/22-metrics-deployment.yaml - -Update sections related to the version label in these yamls: -https://github.com/kedacore/keda/blob/master/deploy/00-namespace.yaml -https://github.com/kedacore/keda/blob/master/deploy/01-service_account.yaml -https://github.com/kedacore/keda/blob/master/deploy/10-cluster_role.yaml -https://github.com/kedacore/keda/blob/master/deploy/11-role_binding.yaml -https://github.com/kedacore/keda/blob/master/deploy/12-operator.yaml -https://github.com/kedacore/keda/blob/master/deploy/20-metrics-cluster_role.yaml -https://github.com/kedacore/keda/blob/master/deploy/21-metrics-role_binding.yaml -https://github.com/kedacore/keda/blob/master/deploy/22-metrics-deployment.yaml -https://github.com/kedacore/keda/blob/master/deploy/23-metrics-service.yaml -https://github.com/kedacore/keda/blob/master/deploy/24-metrics-api_service.yaml - -Commit these changes. +* Run the following command to update the version, setting the `VERSION` value to the next version, eg 1.2.0: + ```bash + VERSION=1.2.0 make release + ``` + > Note: This will update the version labels and images in the yaml files located in the `deploy` folder as well as the version in `version.go`. +* Commit these changes. **2) Deploy the new KEDA images to Docker Hub**