Skip to content
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

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Jan 14, 2025

No description provided.

@benjyw benjyw added the category:internal CI, fixes for not-yet-released features, etc. label Jan 14, 2025
@benjyw benjyw requested a review from tdyas January 14, 2025 03:32
provisioner "shell" {
inline = [
"sudo apt-get install -y software-properties-common",
"sudo add-apt-repository -y ppa:deadsnakes/ppa",
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

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 \\",
Copy link
Contributor

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.

@benjyw benjyw merged commit ef428fb into pantsbuild:main Jan 15, 2025
24 checks passed
@benjyw benjyw deleted the packer_for_runson branch January 15, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants