From 95291e76428a6c8c50d876e51d4cc02f9a4ef6e1 Mon Sep 17 00:00:00 2001 From: Yaron Kaikov Date: Tue, 24 Dec 2024 10:11:39 +0200 Subject: [PATCH] (cloud images): add `environment` default tag For master `daily` and for releases `candidate` This is a prep for https://github.com/scylladb/scylla-pkg/issues/4077 --- packer/build_image.sh | 11 +++++++++++ packer/scylla.json | 3 +++ 2 files changed, 14 insertions(+) diff --git a/packer/build_image.sh b/packer/build_image.sh index d5df4a5b..c4187089 100755 --- a/packer/build_image.sh +++ b/packer/build_image.sh @@ -14,6 +14,10 @@ DRY_RUN=false DEBUG=false BUILD_MODE='release' TARGET= +ENV_TAG="candidate" +if [[ $(cat build/SCYLLA-VERSION-FILE) == *"dev" ]]; then + ENV_TAG="daily" +fi print_usage() { echo "$0 --repo [URL] --target [distribution]" @@ -26,6 +30,7 @@ print_usage() { echo " [--branch] Set the release branch for GCE label. Default: master" echo " [--ami-regions] Set regions to copy the AMI when done building it (including permissions and tags)" echo " [--build-tag] Jenkins Build tag" + echo " [--env-tag] Environment tag for our images. default: daily for master and candidate for releases. Valid options: debug and production" echo " [--build-mode] Choose which build mode to use for Scylla installation. Default: release. Valid options: release|debug" echo " [--debug] Build debug image with special prefix for image name. Default: false." echo " [--log-file] Path for log. Default build/ami.log on current dir. Default: build/packer.log" @@ -72,6 +77,11 @@ while [ $# -gt 0 ]; do echo "--build-tag parameter: BUILD_TAG |$BUILD_TAG|" shift 2 ;; + "--env-tag") + ENV_TAG=$2 + echo "--env-tag parameter: ENV_TAG |$ENV_TAG|" + shift 2 + ;; "--version") VERSION=$2 echo "--version: VERSION |$VERSION|" @@ -264,6 +274,7 @@ set -x -var creation_timestamp="$CREATION_TIMESTAMP" \ -var scylla_build_sha_id="$SCYLLA_BUILD_SHA_ID" \ -var build_tag="$BUILD_TAG" \ + -var environment="$ENV_TAG" \ -var operating_system="$OPERATING_SYSTEM" \ -var branch="$BRANCH" \ -var ami_regions="$AMI_REGIONS" \ diff --git a/packer/scylla.json b/packer/scylla.json index 48fcdcae..acd18326 100644 --- a/packer/scylla.json +++ b/packer/scylla.json @@ -85,6 +85,7 @@ "scylla_build_sha_id": "{{user `scylla_build_sha_id`| clean_resource_name}}", "arch": "{{user `arch`| clean_resource_name}}", "build_tag": "{{user `build_tag`| clean_resource_name}}", + "environment": "{{user `environment`| clean_resource_name}}", "build_mode": "{{user `build_mode`| clean_resource_name}}" }, "ami_regions": "{{user `ami_regions`}}", @@ -127,6 +128,7 @@ "scylla_build_sha_id": "{{user `scylla_build_sha_id`| clean_resource_name}}", "arch": "{{user `arch`| clean_resource_name}}", "build_tag": "{{user `build_tag`| clean_resource_name}}", + "environment": "{{user `environment`| clean_resource_name}}", "build_mode": "{{user `build_mode`| clean_resource_name}}" }, "labels": { @@ -161,6 +163,7 @@ "scylla_build_sha_id": "{{user `scylla_build_sha_id`| clean_resource_name}}", "arch": "{{user `arch`| clean_resource_name}}", "build_tag": "{{user `build_tag`| clean_resource_name}}", + "environment": "{{user `environment`| clean_resource_name}}", "build_mode": "{{user `build_mode`| clean_resource_name}}" }, "vm_size": "{{user `vm_size`}}",