Skip to content

Commit 96b0e63

Browse files
committed
ci: add 3.x validate container build and cleanup
Add build-3x and publish-3x jobs to build validate containers from the 3.x branch, including leap alongside almalinux and openeuler. Images are tagged with 3.x instead of latest. Add ohpc-validate-leap cleanup step to the cleanup workflow. Generated with Claude Code (https://claude.ai/code) Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent 27c5e08 commit 96b0e63

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/build-ohpc-validate-container.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,97 @@ jobs:
9999
run: |
100100
echo "Container built and pushed successfully!"
101101
echo "Image: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:latest"
102+
103+
build-3x:
104+
runs-on: ${{ matrix.runs-on }}
105+
permissions:
106+
contents: read
107+
packages: write
108+
strategy:
109+
matrix:
110+
distro: [ almalinux, openeuler, leap ]
111+
arch: [ x86_64, aarch64 ]
112+
include:
113+
- arch: x86_64
114+
runs-on: ubuntu-24.04
115+
- arch: aarch64
116+
runs-on: ubuntu-24.04-arm
117+
outputs:
118+
almalinux-digest-x86_64: ${{ steps.export.outputs.almalinux-digest-x86_64 }}
119+
almalinux-digest-aarch64: ${{ steps.export.outputs.almalinux-digest-aarch64 }}
120+
openeuler-digest-x86_64: ${{ steps.export.outputs.openeuler-digest-x86_64 }}
121+
openeuler-digest-aarch64: ${{ steps.export.outputs.openeuler-digest-aarch64 }}
122+
leap-digest-x86_64: ${{ steps.export.outputs.leap-digest-x86_64 }}
123+
leap-digest-aarch64: ${{ steps.export.outputs.leap-digest-aarch64 }}
124+
steps:
125+
- name: Checkout repository
126+
uses: actions/checkout@v6
127+
with:
128+
ref: 3.x
129+
130+
- name: Set up Docker Buildx
131+
uses: docker/setup-buildx-action@v4
132+
133+
- name: Log in to Container Registry
134+
uses: docker/login-action@v4
135+
with:
136+
registry: ${{ env.REGISTRY }}
137+
username: ${{ github.actor }}
138+
password: ${{ secrets.GITHUB_TOKEN }}
139+
140+
- name: Extract metadata
141+
id: meta
142+
uses: docker/metadata-action@v6
143+
with:
144+
images: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}
145+
tags: |
146+
type=raw,value=3.x
147+
148+
- name: Build and push by digest
149+
id: build
150+
uses: docker/build-push-action@v7
151+
with:
152+
context: .
153+
file: ./tests/ci/Containerfile.ohpc-validate-${{ matrix.distro }}
154+
platforms: linux/${{ matrix.arch }}
155+
labels: ${{ steps.meta.outputs.labels }}
156+
provenance: false
157+
sbom: false
158+
outputs: type=image,name=${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }},push-by-digest=true,name-canonical=true,push=true
159+
160+
- name: Export digest
161+
id: export
162+
run: |
163+
echo "${{ matrix.distro }}-digest-${{ matrix.arch }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
164+
165+
publish-3x:
166+
runs-on: ubuntu-24.04
167+
needs: build-3x
168+
permissions:
169+
contents: read
170+
packages: write
171+
strategy:
172+
matrix:
173+
distro: [ almalinux, openeuler, leap ]
174+
steps:
175+
- name: Set up Docker Buildx
176+
uses: docker/setup-buildx-action@v4
177+
178+
- name: Log in to Container Registry
179+
uses: docker/login-action@v4
180+
with:
181+
registry: ${{ env.REGISTRY }}
182+
username: ${{ github.actor }}
183+
password: ${{ secrets.GITHUB_TOKEN }}
184+
185+
- name: Create and push manifest
186+
run: |
187+
docker buildx imagetools create \
188+
--tag ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:3.x \
189+
${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}@${{ needs.build-3x.outputs[format('{0}-digest-x86_64', matrix.distro)] }} \
190+
${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}@${{ needs.build-3x.outputs[format('{0}-digest-aarch64', matrix.distro)] }}
191+
192+
- name: Output image details
193+
run: |
194+
echo "Container built and pushed successfully!"
195+
echo "Image: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:3.x"

.github/workflows/cleanup-packages.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ jobs:
7777
delete-only-untagged-versions: true
7878
token: ${{ secrets.GITHUB_TOKEN }}
7979

80+
- name: Delete untagged ohpc-validate-leap images
81+
id: cleanup-validate-leap
82+
continue-on-error: true
83+
uses: actions/delete-package-versions@v5
84+
with:
85+
package-name: ohpc-validate-leap
86+
package-type: container
87+
min-versions-to-keep: 3
88+
delete-only-untagged-versions: true
89+
token: ${{ secrets.GITHUB_TOKEN }}
90+
8091
- name: Report cleanup results
8192
run: |
8293
echo "Cleanup Results:"
@@ -85,6 +96,7 @@ jobs:
8596
echo "Analysis container cleanup: ${{ steps.cleanup-analysis.outcome }}"
8697
echo "Validate AlmaLinux container cleanup: ${{ steps.cleanup-validate-almalinux.outcome }}"
8798
echo "Validate openEuler container cleanup: ${{ steps.cleanup-validate-openeuler.outcome }}"
99+
echo "Validate Leap container cleanup: ${{ steps.cleanup-validate-leap.outcome }}"
88100
89101
if [[ "${{ steps.cleanup-main.outcome }}" == "failure" ]]; then
90102
echo "Warning: Main container cleanup failed - package may not exist yet"
@@ -106,4 +118,8 @@ jobs:
106118
echo "Warning: Validate openEuler container cleanup failed - package may not exist yet"
107119
fi
108120
121+
if [[ "${{ steps.cleanup-validate-leap.outcome }}" == "failure" ]]; then
122+
echo "Warning: Validate Leap container cleanup failed - package may not exist yet"
123+
fi
124+
109125
echo "Cleanup workflow completed"

0 commit comments

Comments
 (0)