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 https://github.com/scylladb/scylla-pkg/issues/4077

(cherry picked from commit d1c40d3)
  • Loading branch information
yaronkaikov authored and actions-user committed Dec 26, 2024
1 parent 21dde81 commit 59c0e47
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
50 changes: 50 additions & 0 deletions packer/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ DRY_RUN=false
DEBUG=false
BUILD_MODE='release'
TARGET=
<<<<<<< HEAD
APT_KEYS_DIR='/etc/apt/keyrings'
APT_KEY='d0a112e067426ab2'
||||||| parent of d1c40d3 ((cloud images): add `environment` tag)
=======
ENV_TAG="debug"
>>>>>>> d1c40d3 ((cloud images): add `environment` tag)
print_usage() {
echo "$0 --localdeb --repo [URL] --target [distribution]"
Expand All @@ -31,7 +36,12 @@ print_usage() {
echo " [--ami-regions] Set regions to copy the AMI when done building it (including permissions and tags)"
echo " [--ami-users] A list of account IDs that have access to launch the AMI"
echo " [--build-tag] Jenkins Build tag"
<<<<<<< HEAD
echo " --download-no-server Download all deb needed excluding scylla from repo-for-install"
||||||| parent of d1c40d3 ((cloud images): add `environment` tag)
=======
echo " [--env-tag] Environment tag for our images. default: debug. Valid options: daily(master)|candidate(releases)|production(releases)|private(custom images for customers)"
>>>>>>> d1c40d3 ((cloud images): add `environment` tag)
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 @@ -90,6 +100,45 @@ while [ $# -gt 0 ]; do
echo "--build-tag parameter: BUILD_TAG |$BUILD_TAG|"
shift 2
;;
<<<<<<< HEAD
||||||| parent of d1c40d3 ((cloud images): add `environment` tag)
"--version")
VERSION=$2
echo "--version: VERSION |$VERSION|"
shift 2
;;
"--scylla-release")
SCYLLA_RELEASE=$2
echo "--scylla-release: SCYLLA_RELEASE |$SCYLLA_RELEASE|"
shift 2
;;
"--scylla-machine-image-release")
SCYLLA_MACHINE_IMAGE_RELEASE=$2
echo "--scylla-machine-image-release: SCYLLA_MACHINE_IMAGE_RELEASE |$SCYLLA_MACHINE_IMAGE_RELEASE|"
shift 2
;;
=======
"--env-tag")
ENV_TAG=$2
echo "--env-tag parameter: ENV_TAG |$ENV_TAG|"
shift 2
;;
"--version")
VERSION=$2
echo "--version: VERSION |$VERSION|"
shift 2
;;
"--scylla-release")
SCYLLA_RELEASE=$2
echo "--scylla-release: SCYLLA_RELEASE |$SCYLLA_RELEASE|"
shift 2
;;
"--scylla-machine-image-release")
SCYLLA_MACHINE_IMAGE_RELEASE=$2
echo "--scylla-machine-image-release: SCYLLA_MACHINE_IMAGE_RELEASE |$SCYLLA_MACHINE_IMAGE_RELEASE|"
shift 2
;;
>>>>>>> d1c40d3 ((cloud images): add `environment` tag)
"--branch")
BRANCH=$2
echo "--branch parameter: BRANCH |$BRANCH|"
Expand Down Expand Up @@ -357,6 +406,7 @@ set -x
-var scylla_build_id="$BUILD_ID" \
-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 @@ -87,6 +87,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 @@ -132,6 +133,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 @@ -168,6 +170,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 59c0e47

Please sign in to comment.