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

Add the ability to provision arbitrary files to the packer templates #1941

Open
toast-gear opened this issue Apr 14, 2022 · 4 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed stale:exempt

Comments

@toast-gear
Copy link
Contributor

toast-gear commented Apr 14, 2022

We reference the packer templates directly in this repository so we don't need to maintain our own and keep them in sync with changes that happen here. At the moment you can bolt on additional shell commands via https://github.com/philips-labs/terraform-aws-github-runner/blob/develop/images/ubuntu-focal/github_agent.ubuntu.pkr.hcl#L145 which is great. I would like the ability to also optionally provision files in the same arbitrary style without breaking the template if the end user doesn't have any to provision.

I have more or less 0 Packer knowledge so I'm hoping the community can advise or do the pull request.

@npalm npalm added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Apr 18, 2022
@ScottGuymer
Copy link
Member

The packer files here are for the most part intended as simple examples of how you might build your own AMI for the runners and not something intended to be re-usable (although its great you do). This is because there are going to be lots of different environment/network/company specific customisations for images created and trying to have a packer template to support that would be too complex to maintain and test well.

That being said it does seem possible and fairly straigtforward.

Add a new variable

variable "files_to_upload" {
  description = "Additional files to be uploaded"
  type        = list(string)
  default     = []
}

Add a new provisioner.

  provisioner "file" {
    sources = var.sources
    destination = "/tmp/"
  }

The destination folder must already exist so would be a little trickier to make that fully custom.

Maybe you could give a try at making a PR with this?

More info on the file provisioner here https://www.packer.io/docs/provisioners/file

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2022

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jun 8, 2022
@toast-gear
Copy link
Contributor Author

toast-gear commented Jun 8, 2022

This is a real enhancement, @npalm @ScottGuymer do you have issue labels which exempt issues from stale at all?

@github-actions github-actions bot removed the Stale label Jun 9, 2022
@toast-gear
Copy link
Contributor Author

toast-gear commented Jul 4, 2022

@npalm could you exempt this from stale? I've changed companies so no longer work with this solution however I do think it's a legitimate enhancement that someone would find useful so it would be good to keep it raised for someone to do down the road (perhaps I'll get around to doing it just so it's done when I get some time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed stale:exempt
Projects
None yet
Development

No branches or pull requests

3 participants