The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Build AWS AMI with packer in a pipeline

Brian Abston
February 5, 2018

We have been using Hashicorp Enterprise to run our packer builds. They are stopping that service and I am looking to see if this can be done with the bitbucket pipelines. I have all the packer files and scripts currently in bitbucket but do not have any pipelines that run the packer build. Can someone point me in the right direction or show me a example of running packer build for AWS AMIs?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Dean Kayton
March 27, 2018

We use packer build from within a pipeline all the time, the only exception is when building docker images.

This is because `packer build` actually executes `docker run` in order to provision. `docker run` is prohibited from within a pipeline.

Messy, but it is possible to get a pipeline to kick off an ecs task, which in turn runs the packer docker build (use terraform, and I am unsure if the Fargate type will be possible here because you would need to mount the docker socket).

Another messy workaround... you could run a packer build within a packer build. The outer`packer build` spins up an EC2 instance from an AMI with docker and packer preinstalled, the inner`packer build` runs the docker builder and docker tag/push post-processors. Is there an option for skipping the creation of the AMI? If not, you would need to make the outer `packer build` provisioning script fail.

Messy I know, but it would result in the docker image artifacts you are after from within a bitbucket pipeline. As I said earlier, all other packer artifacts can easily be achieved from within pipelines.

I can send some configurations if that would be helpful.

TAGS
AUG Leaders

Atlassian Community Events