Skip to content

Commit

Permalink
Pass the revision down from ssm
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev committed Feb 15, 2023
1 parent 95f2cb5 commit 4df5d42
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

- name: reboot
reboot:
when: packer_build_name is undefined
when: packer_build_name is undefined
11 changes: 10 additions & 1 deletion packer/docs-rs-builder/builder.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ packer {
}
}

data "amazon-parameterstore" "revision" {
name = "/docs-rs/builder/sha"
}

locals {
revision = data.amazon-parameterstore.revision.value
}

source "amazon-ebs" "ubuntu" {
ami_name = "docs-rs-builder-${var.revision}"
ami_name = "docs-rs-builder-${local.revision}"
instance_type = "t2.large"
region = "us-east-1"
source_ami_filter {
Expand Down Expand Up @@ -41,5 +49,6 @@ build {
playbook_file = "./play/playbook.yml"
# The default is the user running packer
user = "ubuntu"
extra_arguments = [ "--extra-vars", "vars_repository_sha=${local.revision}"]
}
}
4 changes: 0 additions & 4 deletions packer/docs-rs-builder/variables.pkr.hcl

This file was deleted.

2 changes: 1 addition & 1 deletion packer/packer
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("env")
parser.add_argument("playbook")
parser.add_argument('--var', action='append', help='Ansible variables as $key=$value')
parser.add_argument('--var', action='append', help='Ansible variables as $key=$value', default=[])
args = parser.parse_args()

workspace = create_workspace(args.env, args.playbook)
Expand Down

0 comments on commit 4df5d42

Please sign in to comment.