Skip to content

Commit

Permalink
(cloud images): add environment tag
Browse files Browse the repository at this point in the history
Adding a logic for the `environment` tag for better image search

default value is set for `debug`

- master tag value will be `daily`
- releases, the tag value will be `candidate` (and we modify it to `production` once we promote)
- debug jobs (everything running under `machine-image` gating, `byo` or `releng-testing`) the value will be debug

There is one special case for private builds that will be handled in a separate PR

This is a prep for scylladb/scylla-pkg#4077
  • Loading branch information
yaronkaikov committed Dec 25, 2024
1 parent 08721db commit d1c40d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packer/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DRY_RUN=false
DEBUG=false
BUILD_MODE='release'
TARGET=
ENV_TAG="debug"

print_usage() {
echo "$0 --repo [URL] --target [distribution]"
Expand All @@ -26,6 +27,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: debug. Valid options: daily(master)|candidate(releases)|production(releases)|private(custom images for customers)"
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"
Expand Down Expand Up @@ -72,6 +74,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|"
Expand Down Expand Up @@ -264,6 +271,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" \
Expand Down
3 changes: 3 additions & 0 deletions packer/scylla.json
Original file line number Diff line number Diff line change
Expand Up @@ -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`}}",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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`}}",
Expand Down

0 comments on commit d1c40d3

Please sign in to comment.