Skip to content

Commit

Permalink
Add release candidate tag to AMI and add build mode and release candi…
Browse files Browse the repository at this point in the history
…date to AMI name

Bug: b/293918417
Change-Id: I478ff961219a9f9dff1dcef91c3217791ae06202
GitOrigin-RevId: e1d7ee0785f1fa041628e463a13e2f8f2aa81cb9
  • Loading branch information
peiwenhu authored and copybara-github committed Jan 9, 2025
1 parent ccadf13 commit 66bd3d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion production/packaging/aws/data_server/ami/image.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# To test this file, add the relevant files and from the root of the repo run:
# $ packer build -var 'regions=["us-east-1"]' -var=commit_version=$(git rev-parse HEAD) -var=build_mode=prod -var=distribution_dir=/tmp/dist -var=workspace=/tmp/ws production/packaging/aws/data_server/ami/image.pkr.hcl

variable "regions" {
type = list(string)
validation {
Expand All @@ -28,6 +31,12 @@ variable "commit_version" {

variable "build_mode" {
type = string
default = ""
}

variable "release_candidate" {
type = string
default = ""
}

variable "ami_users_env" {
Expand Down Expand Up @@ -70,7 +79,7 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
# build blocks. A build block runs provisioners and post-processors on a
# source.
source "amazon-ebs" "dataserver" {
ami_name = "data-server-${local.timestamp}"
ami_name = "data-server-${var.build_mode}-${var.release_candidate}-${local.timestamp}"
ami_users = var.ami_users_env != "" ? split(",", var.ami_users_env) : null

instance_type = "m5.xlarge"
Expand All @@ -88,6 +97,7 @@ source "amazon-ebs" "dataserver" {
tags = {
commit_version = var.commit_version
build_mode = var.build_mode
release_candidate = var.release_candidate
}
ssh_username = "ec2-user"
}
Expand Down

0 comments on commit 66bd3d2

Please sign in to comment.