Skip to content

Commit 48ec2de

Browse files
committed
Automate building the Katello stable box and uploading it to Vagrant Cloud
1 parent fe57763 commit 48ec2de

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

packer/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ You can install packer using [the steps in their documentation](https://develope
1010

1111
From this directory, use `packer build` followed by the json packer template to create an image
1212

13-
For example: `packer build centos9-katello-devel-stable.json`
13+
To also upload a new box, you will need the client ID and client secret for the stablebox-creator service principal. You can find that in the Access control section of the katello-devel project in the Hashicorp Cloud.
1414

15-
You can create a box image using the above command and then add that box to Vagrant:
15+
To build a new box, run: `HCP_CLIENT_ID=id HCP_CLIENT_SECRET=secret packer build -var "version=2025.0606.1303" centos9-katello-devel-stable.json`
16+
17+
Increment the version using the current date: `date +%Y.%m%d.%H%M`
18+
19+
The above command will create a box and then you can add that box to Vagrant locally to test:
1620

1721
```sh
1822
vagrant box add --name centos9-katello-devel-stable centos9-katello-devel-stable.box

packer/centos9-katello-devel-stable.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"format": "qcow2",
1717
"headless": true,
1818
"http_directory": "http",
19-
"iso_checksum": "sha256:62318426d27ba4e255b509b033e78186ad0fb8b9007650fca73d226ceb2eda6f",
19+
"iso_checksum": "file:https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso.SHA256SUM",
2020
"iso_url": "https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso",
2121
"name": "{{ user `packer_hostname` }}.example.com",
2222
"qemuargs": [
@@ -41,11 +41,19 @@
4141
}
4242
],
4343
"post-processors": [
44-
{
45-
"keep_input_artifact": false,
46-
"output": "{{user `packer_hostname`}}.box",
47-
"type": "vagrant"
48-
}
44+
[
45+
{
46+
"keep_input_artifact": false,
47+
"output": "{{user `packer_hostname`}}.box",
48+
"type": "vagrant"
49+
},
50+
{
51+
"type": "vagrant-registry",
52+
"box_tag": "katello/katello-devel",
53+
"version": "{{user `version`}}",
54+
"architecture": "amd64"
55+
}
56+
]
4957
],
5058
"provisioners": [
5159
{

0 commit comments

Comments
 (0)