Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 1 | # EdgeX CI Packer |
| 2 | |
| 3 | [Packer][1] is a tool for automatically creating VM and container images, |
| 4 | configuring them and post-processing them into standard output formats. |
| 5 | |
| 6 | We build the CI images via Packer. |
| 7 | |
| 8 | ## Building |
| 9 | |
| 10 | You'll need to [install Packer][2], of course. |
| 11 | |
| 12 | The Packer configuration is divided into build-specific variables, |
| 13 | output-specific templates and a set of shared provisioning scripts. To do a |
| 14 | specific build, combine the template for the desired output artifact type with |
| 15 | a variable file. To build a new baseline instance the following would be done: |
| 16 | |
| 17 | ``` |
| 18 | packer build -var-file=vars/cloud-env.json -var-file=vars/centos.json templates/baseline.json |
| 19 | ``` |
| 20 | |
| 21 | **NOTE:** vars/cloud-env.json is a gitignored file as it contains private |
| 22 | information. There is a vars/cloud-env.json.example file that may be used as a |
| 23 | base for creating the one needed. |
| 24 | |
| 25 | From a high level, the build process is: |
| 26 | |
| 27 | * Boot a specified base image in any defined clouds. |
| 28 | * Run a set of shell scripts, listed in the template's shell provisioner |
| 29 | section, to do any configuration required by the builder. |
| 30 | * Execute a shutdown of the running instance in the clouds. |
| 31 | * Execute the cloud specific method for creating a new image from the shutdown |
| 32 | instance |
| 33 | * Perform the cloud specific method for deleting the shutdown instance |
| 34 | |
| 35 | [1]: https://www.packer.io/ |
| 36 | [2]: https://www.packer.io/intro/getting-started/setup.html |