Generate packer manifests and store them as artifacts
What does this MR do?
Generate a manifest file regarding the built AMIs, which can be used for any sort of release documentation (like in gitlab-org/distribution/team-tasks#460 (comment 1184546857)).
In the next iteration, we make use of these manifests, compile the AMI IDs from it, and put it in the releases page.
Testing
Pre-requisites
- An AWS account in Sandbox Cloud
- An access key pair from that AWS account.
Steps
-
Clone the repo and change to
store-aws-ami-ids
branch. -
Start a docker container with the image with packer in it
$ docker run -v $(pwd):/omnibus-gitlab registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/debian_packer:3.15.0 bash
-
Export AWS credentials
$ export AWS_AMI_ACCESS_KEY_ID=<AWS access key> $ export AWS_AMI_SECRET_ACCESS_KEY=<AWS secret key>
-
Apply the following patch so that you don't end up with images in all the regions
diff --git a/support/packer/ee.pkr.hcl b/support/packer/ee.pkr.hcl index 1b33179a8..cb6d15273 100644 --- a/support/packer/ee.pkr.hcl +++ b/support/packer/ee.pkr.hcl @@ -39,27 +39,7 @@ variable "version" { # so no copying is done. variable "ami_regions" { type = list(string) - default = [ - "af-south-1", - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-north-1", - "eu-south-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "me-south-1", - "sa-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - ] + default = [] } # ami_prefix is used to preface the the AMI description and name with something @@ -72,7 +52,7 @@ variable "ami_regions" { # <version> ...". variable "ami_prefix" { type = string - default = "" + default = "Test " } data "amazon-ami" "base_ami" {
-
Build the AMI
$ bash support/packer/packer_ami.sh 99.99 ee "https://packages.gitlab.com/gitlab/gitlab-ee/packages/ubuntu/focal/gitlab-ee_15.6.0-ee.0_arm64.deb/download.deb"
-
Check
support/packer/manifests/ee-manifest.json
file$ cat support/packer/manifests/ee-manifest.json
-
Go to AWS console and deregister the AMI. It costs money, people. Let's clean it up.
😁
Related issues
gitlab-org/distribution/team-tasks#460
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion
Required
-
Merge Request Title, and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks -
trigger-package
has a green pipeline running against latest commit
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added -
Integration tests added to GitLab QA -
Equivalent MR/issue for the GitLab Chart opened
Edited by Balasankar 'Balu' C