-
-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packer config for building the RunsOn AMI. #21832
Conversation
provisioner "shell" { | ||
inline = [ | ||
"sudo apt-get install -y software-properties-common", | ||
"sudo add-apt-repository -y ppa:deadsnakes/ppa", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What software is installed from this repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pythons
virtualization-type = "hvm" | ||
} | ||
most_recent = true | ||
owners = ["135269210855"] # RunsOn's AWS account ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does RunsOn have particular docs laying out this value (and any other requirements) for building AMIs? If so, would be good to link to it somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this from first principles (and got the value from the base AMIs we've been using in the manual build), but it turns out RunsOn do have some docs for using Packer to build compatible AMIs, so I've added a link.
# Packer creates a temporary keypair on the temporary instance it uses | ||
# to create the AMI, so we don't need to configure that. | ||
ssh_username = "ubuntu" | ||
user_data = "#!/bin/bash\nsystemctl start ssh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use the HCL heredoc syntax here. See https://developer.hashicorp.com/packer/docs/templates/hcl_templates/expressions#string-literals.
Specifically, the "indented heredoc" which behaves like textwrap.dedent
: <<~EOF
"sudo add-apt-repository -y ppa:deadsnakes/ppa", | ||
"sudo apt-get update", | ||
"sudo apt-get install -y \\", | ||
"python3.7 python3.7-dev python3.7-venv \\", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indented heredoc syntax might also be useful here as well.
No description provided.