agones.dev/agones@v1.54.0/build/includes/release.mk (about) 1 # Copyright 2019 Google LLC All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # ____ _ 16 # | _ \ ___| | ___ __ _ ___ ___ 17 # | |_) / _ \ |/ _ \/ _` / __|/ _ \ 18 # | _ < __/ | __/ (_| \__ \ __/ 19 # |_| \_\___|_|\___|\__,_|___/\___| 20 # 21 22 # 23 # targets for an Agones release 24 # 25 26 # agones image release registry 27 release_registry = us-docker.pkg.dev/agones-images/release 28 29 # outputs the markdown for the example images section of the release template 30 release-example-image-markdown: example-image-markdown.allocation-endpoint 31 release-example-image-markdown: example-image-markdown.autoscaler-webhook 32 release-example-image-markdown: example-image-markdown.cpp-simple 33 release-example-image-markdown: example-image-markdown.crd-client 34 release-example-image-markdown: example-image-markdown.nodejs-simple 35 release-example-image-markdown: example-image-markdown.rust-simple 36 release-example-image-markdown: example-image-markdown.simple-game-server 37 release-example-image-markdown: example-image-markdown.supertuxkart 38 release-example-image-markdown: example-image-markdown.unity-simple 39 release-example-image-markdown: example-image-markdown.xonotic 40 41 example-image-markdown.%: 42 @cd $(agones_path)/examples/$* && \ 43 tag=$$(make -silent echo-image-tag) && \ 44 echo "- [$$tag](https://$$tag)" 45 46 47 # Deploys the site by taking in the base version and deploying the previous minor or patch version 48 release-deploy-site: $(ensure-build-image) 49 release-deploy-site: DOCKER_RUN_ARGS += -e GOFLAGS="-mod=mod" --entrypoint=/usr/local/go/bin/go 50 release-deploy-site: 51 version_to_process=$(if $(VERSION),$(VERSION),$(base_version)) && \ 52 version=$$($(DOCKER_RUN) run $(mount_path)/build/scripts/previousversion/main.go -version $$version_to_process) && \ 53 echo "Deploying Site Version: $$version" && \ 54 $(MAKE) ENV=HUGO_ENV=snapshot site-deploy SERVICE=$$version 55 56 # Creates, switches, and pushes a new minor version release branch based off of the main branch. 57 # The should be run before pre_cloudbuild.yaml. This means base_version has not yet been updated. 58 create-minor-release-branch: RELEASE_VERSION ?= $(base_version) 59 create-minor-release-branch: 60 @echo "Starting creating release branch for minor version: $(RELEASE_VERSION)" 61 62 # switch to the right project 63 $(DOCKER_RUN) gcloud config configurations activate agones-images 64 65 git remote update -p 66 git fetch --all --tags 67 git checkout -b release-$(RELEASE_VERSION) upstream/main 68 git push -u upstream release-$(RELEASE_VERSION) 69 70 # Creates, switches, and pushes a new patch version release branch based off of the release branch. 71 # The should be run before pre_cloudbuild.yaml. Require user to the specify both the patch version, 72 # and the version to base the release-branch off of. 73 create-patch-release-branch: PREVIOUS_VERSION ?= 74 create-patch-release-branch: PATCH_VERSION ?= 75 create-patch-release-branch: 76 $(if $(PREVIOUS_VERSION),,$(error PREVIOUS_VERSION is not set. Please provide the version to branch from.)) 77 $(if $(PATCH_VERSION),,$(error PATCH_VERSION is not set. Please provide the new patch version number.)) 78 79 @echo "Creating new patch release branch release-$(PATCH_VERSION) from tag v$(PREVIOUS_VERSION)" 80 81 # switch to the right project 82 $(DOCKER_RUN) gcloud config configurations activate agones-images 83 84 git remote update -p 85 git fetch upstream --tags 86 git checkout -b release-$(PATCH_VERSION) v$(PREVIOUS_VERSION) 87 git push -u upstream release-$(PATCH_VERSION) 88 89 # push the current chart to google cloud storage and update the index 90 # or push the current charts to the helm registry `CHARTS_REGISTRY` 91 push-chart: $(ensure-build-image) build-chart 92 ifneq ($(CHARTS_REGISTRY),) 93 docker run --rm $(common_mounts) -w $(workdir_path) $(build_tag) bash -c \ 94 "helm push ./install/helm/bin/*.* $(CHARTS_REGISTRY)" 95 else 96 docker run $(DOCKER_RUN_ARGS) --rm $(common_mounts) -w $(workdir_path) $(build_tag) bash -c \ 97 "gsutil copy gs://$(GCP_BUCKET_CHARTS)/index.yaml ./install/helm/bin/index.yaml || /bin/true && \ 98 helm repo index --merge ./install/helm/bin/index.yaml ./install/helm/bin && \ 99 cat ./install/helm/bin/index.yaml && ls ./install/helm/bin/ && \ 100 cp ./install/helm/bin/index.yaml ./install/helm/bin/index-$(VERSION).yaml && \ 101 gsutil copy ./install/helm/bin/*.* gs://$(GCP_BUCKET_CHARTS)/" 102 endif 103 104 # Ensure the example images exists for a release and deploy the previous version's website. 105 pre-build-release: VERSION ?= 106 pre-build-release: 107 $(if $(VERSION),,$(error VERSION is not set. Please provide the current release version.)) 108 docker run --rm $(common_mounts) -w $(workdir_path)/build/release $(build_tag) \ 109 gcloud builds submit . --substitutions _BRANCH_NAME=release-$(VERSION),_VERSION=$(VERSION) --config=./pre_cloudbuild.yaml $(ARGS) 110 111 # Build and push the images in the release repository, stores artifacts, 112 # Pushes the current chart version to the helm repository hosted on gcs. 113 post-build-release: VERSION ?= 114 post-build-release: 115 $(if $(VERSION),,$(error VERSION is not set. Please provide the current release version.)) 116 docker run --rm $(common_mounts) -w $(workdir_path)/build/release $(build_tag) \ 117 gcloud builds submit . --substitutions _VERSION=$(VERSION),_BRANCH_NAME=release-$(VERSION) --config=./post_cloudbuild.yaml $(ARGS) 118 119 # Tags images from the previous release as deprecated. 120 # The tr -d '-' command is used to remove the dashes from the output of the script 121 # (e.g., 1-52-1 becomes 1.52.1), which is the format needed for the Docker image tag. 122 tag-deprecated-images: VERSION ?= 123 tag-deprecated-images: $(ensure-build-image) 124 tag-deprecated-images: DOCKER_RUN_ARGS += -e GOFLAGS="-mod=mod" --entrypoint=/usr/local/go/bin/go 125 tag-deprecated-images: 126 $(if $(VERSION),,$(error VERSION is not set. Please provide the current release version.)) 127 previous_version=$$($(DOCKER_RUN) run $(mount_path)/build/scripts/previousversion/main.go -version $(VERSION)| tr '-' '.') && \ 128 images="agones-controller agones-extensions agones-sdk agones-allocator agones-ping agones-processor" && \ 129 for image in $$images; do \ 130 echo "Tagging ${release_registry}/$$image:$$previous_version as deprecated..."; \ 131 gcloud artifacts docker tags add ${release_registry}/$$image:$$previous_version ${release_registry}/$$image:deprecated-public-image-$$previous_version; \ 132 done