@@ -29,14 +29,16 @@ jobs:
2929 /opt/minimega/bin/miniccc
3030 /opt/minimega/bin/minirouter
3131
32- # Job: Build the bennu image using the phenix image builder
33- build-bennu :
32+ # Job: Build images using the phenix image builder
33+ build-images :
34+ strategy :
35+ matrix :
36+ build : [bookworm, kali, jammy, noble, bennu, docker-hello-world, ntp]
3437 needs : get-miniccc
3538 runs-on : ubuntu-latest
3639 container :
37- image : ghcr.io/sandialabs/sceptre-phenix/phenix:31ce034
40+ image : ghcr.io/sandialabs/sceptre-phenix/phenix:main
3841 options : --privileged # needed for kernel device-mapper permissions
39-
4042 steps :
4143 # Install oras CLI for pushing images to OCI registries
4244 - name : oras install
@@ -48,140 +50,71 @@ jobs:
4850 uses : actions/download-artifact@v4.1.8
4951 with :
5052 name : miniexes
51-
52- # Add the miniccc binary to the overlay for image build
53- # The systemd service is already included in base scripts
53+ # Add the miniccc binary to the filesystem for image build. This is used
54+ # at the end of the image builds via `phenix image inject-miniexe ...`
5455 - name : add miniccc
5556 run : |
56- mkdir -p ./overlays/miniccc/opt/minimega/bin
57- cp ./miniccc ./overlays/miniccc/opt/minimega/bin
58- chmod +x ./overlays/miniccc/opt/minimega/bin/miniccc
59-
60- # Build the bennu image using phenix
61- - name : bennu image build
62- run : |
63- phenix version
64- mkdir ./out
65- phenix image create -O ./overlays/bennu,./overlays/brash,./overlays/miniccc -T ./scripts/aptly,./scripts/bennu --format qcow2 --release jammy -c bennu --size 10G
66- phenix image build bennu -o ./out -x
67-
68- # Optionally upload bennu.qc2 as artifact (currently commented out)
69- # - name: upload qc2
70- # uses: actions/upload-artifact@v4
71- # with:
72- # name: bennu.qc2
73- # path: ./out/bennu.qc2
74-
57+ mkdir /phenix/
58+ cp ./miniccc /phenix/
59+ chmod +x /phenix/miniccc
60+ # Build the image using phenix
61+ - name : ${{ matrix.build }} image build
62+ run : make ${{ matrix.build }}
7563 # Publish the built image to GitHub Container Registry using oras
7664 - name : publish package with oras
7765 # Only push package if on the default branch (e.g., main)
7866 if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
7967 shell : bash
8068 run : |
81- cd ./out
8269 oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
83- oras push "ghcr.io/${{ github.repository }}/bennu.qc2:${GITHUB_SHA:0:7}" bennu .qc2
70+ oras push "ghcr.io/${{ github.repository }}/bennu.qc2:${GITHUB_SHA:0:7}" ${{ matrix.build }} .qc2
8471
85- # Job: Build the ubuntu image using the phenix image builder
86- build-ubuntu :
87- needs : get-miniccc
88- runs-on : ubuntu-latest
89- container :
90- image : ghcr.io/sandialabs/sceptre-phenix/phenix:31ce034
91- options : --privileged # needed for kernel device-mapper permissions
92-
93- steps :
94- # Install oras CLI
95- - name : oras install
96- uses : oras-project/setup-oras@v1
97- # Checkout repository code
98- - uses : actions/checkout@v4
99- # Download miniexes artifact
100- - name : get miniexes
101- uses : actions/download-artifact@v4.1.8
102- with :
103- name : miniexes
104-
105- # Add the miniccc binary to the overlay for image build
106- - name : add miniccc
107- run : |
108- mkdir -p ./overlays/miniccc/opt/minimega/bin
109- cp ./miniccc ./overlays/miniccc/opt/minimega/bin
110- chmod +x ./overlays/miniccc/opt/minimega/bin/miniccc
111-
112- # Build the ubuntu image using phenix
113- - name : ubuntu image build
114- run : |
115- phenix version
116- mkdir ./out
117- phenix image create -O ./overlays/miniccc -T ./scripts/ubuntu,./scripts/ubuntu-user --format qcow2 --release noble -c ubuntu --size 10G
118- phenix image build ubuntu -o ./out -x
119-
120- # Optionally upload ubuntu.qc2 as artifact (currently commented out)
121- # - name: upload qc2
122- # uses: actions/upload-artifact@v4
123- # with:
124- # name: ubuntu.qc2
125- # path: ./out/ubuntu.qc2
126-
127- # Publish the built image to GitHub Container Registry using oras
128- - name : publish package with oras
129- # Only push package if on the default branch (e.g., main)
130- if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
131- shell : bash
132- run : |
133- cd ./out
134- oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
135- oras push "ghcr.io/${{ github.repository }}/ubuntu.qc2:${GITHUB_SHA:0:7}" ubuntu.qc2
136-
137- # Job: Tag and release images after successful builds
138- release :
72+ # Job: Tag images after successful builds
73+ tag-images :
74+ strategy :
75+ matrix :
76+ build : [bookworm, kali, jammy, noble, bennu, docker-hello-world, ntp]
13977 # Only run on main branch for scheduled or manual workflow_dispatch events
14078 if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
141- needs :
142- - build-bennu
143- - build-ubuntu
79+ needs : build-images
14480 runs-on : ubuntu-latest
81+ outputs :
82+ date : ${{ steps.date.outputs.value }}
14583 steps :
14684 # Get current date for tagging
14785 - name : Get current date
14886 id : date
14987 run : echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
150- # Download built images from artifacts (if uploaded)
151- # Not needed with oras push, but kept for reference
152- # - name: get images from artifacts
153- # uses: actions/download-artifact@v4.1.8
154- # with:
155- # pattern: "*.qc2"
156- # path: ./images
157- # merge-multiple: true
158-
15988 # Install oras CLI
16089 - name : oras install
16190 uses : oras-project/setup-oras@v1
162-
16391 # Tag images in the registry with 'latest' and date-based tags
16492 - name : tag images with date and latest
16593 run : |
16694 oras version
16795 oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
168- oras tag ghcr.io/${{ github.repository }}/bennu.qc2:${GITHUB_SHA:0:7} latest ${{ steps.date.outputs.date }}
169- oras tag ghcr.io/${{ github.repository }}/ubuntu.qc2:${GITHUB_SHA:0:7} latest ${{ steps.date.outputs.date }}
96+ oras tag ghcr.io/${{ github.repository }}/${{ matrix.build }}.qc2:${GITHUB_SHA:0:7} latest ${{ steps.date.outputs.date }}
17097
98+ # Job: Create release successful build
99+ release :
100+ # Only run on main branch for scheduled or manual workflow_dispatch events
101+ if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
102+ needs : tag-images
103+ runs-on : ubuntu-latest
104+ steps :
171105 # Create a GitHub release with notes and usage instructions
172106 - name : create release
173107 uses : ncipollo/release-action@v1.15.0
174108 with :
175- name : release-${{ steps.date .outputs.date }}
109+ name : release-${{ needs.tag-images .outputs.date }}
176110 body : |
177111 Images can be downloaded from the registry using the oras client: https://oras.land/docs/installation
178112 e.g.:
179- ```
113+ ```bash
180114 oras pull ghcr.io/${{ github.repository }}/bennu.qc2:latest
181115 ```
182116 You can view the available image builds from the [Package List](https://github.com/orgs/${{ github.repository_owner }}/packages?repo_name=${{ github.event.repository.name }})
183-
184- tag : release-${{ steps.date.outputs.date }}
117+ tag : release-${{ needs.tag-images.outputs.date }}
185118 commit : main
186119 generateReleaseNotes : true
187120 makeLatest : true
0 commit comments