Skip to content

Commit d1ad1d5

Browse files
committed
feat: split Docker builds from GoReleaser into native CI jobs
Move validator Docker image builds out of GoReleaser dockers_v2 into dedicated per-arch CI jobs using native runners (ubuntu-latest for amd64, ubuntu-arm64 for arm64). This eliminates QEMU emulation and the experimental dockers_v2 feature. GoReleaser now creates a draft release. A new publish job gates on both GoReleaser and Docker manifest completion before making the release public, ensuring all artifacts are available atomically. Revert point: ed2079e
1 parent ed2079e commit d1ad1d5

File tree

4 files changed

+150
-64
lines changed

4 files changed

+150
-64
lines changed

.github/actions/go-build-release/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ runs:
3636
install_syft: 'true'
3737
install_goreleaser: 'true'
3838

39-
- name: Setup Docker Buildx
40-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
41-
4239
- name: Authenticate to registry
4340
uses: ./.github/actions/ghcr-login
4441
with:

.github/workflows/on-tag.yaml

Lines changed: 139 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ concurrency:
2626
group: ${{ github.workflow }}-${{ github.ref }}
2727
cancel-in-progress: false
2828

29+
env:
30+
VALIDATOR_IMAGE: ghcr.io/nvidia/eidos-validator
31+
2932
jobs:
3033

3134
# =============================================================================
@@ -99,13 +102,13 @@ jobs:
99102
go_version: ${{ steps.versions.outputs.go }}
100103

101104
# =============================================================================
102-
# Build Job (runs after all tests pass)
105+
# Build Job: GoReleaser (binaries, ko images, draft GitHub release)
103106
# =============================================================================
104107

105108
build:
106-
name: Build and Release
109+
name: Build and Release (Draft)
107110
runs-on: ubuntu-latest
108-
needs: [unit, integration, e2e] # Wait for all tests to pass
111+
needs: [unit, integration, e2e]
109112
timeout-minutes: 30
110113
outputs:
111114
release_outcome: ${{ steps.release.outputs.release_outcome }}
@@ -135,14 +138,144 @@ jobs:
135138
uses: ./.github/actions/go-build-release
136139

137140
# =============================================================================
138-
# Attestation Job (runs after build succeeds)
141+
# Docker Jobs: Native per-arch validator builds (parallel with GoReleaser)
142+
# =============================================================================
143+
144+
docker-amd64:
145+
name: Docker Validator (amd64)
146+
runs-on: ubuntu-latest
147+
needs: [unit, integration, e2e]
148+
timeout-minutes: 15
149+
permissions:
150+
contents: read
151+
packages: write
152+
steps:
153+
- name: Checkout Code
154+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
155+
156+
- name: Setup Docker Buildx
157+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
158+
159+
- name: Authenticate to registry
160+
uses: ./.github/actions/ghcr-login
161+
162+
- name: Build and push
163+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
164+
with:
165+
context: .
166+
file: Dockerfile.validator
167+
platforms: linux/amd64
168+
push: true
169+
tags: ${{ env.VALIDATOR_IMAGE }}:${{ github.ref_name }}-amd64
170+
labels: |
171+
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
172+
org.opencontainers.image.title=eidos-validator
173+
org.opencontainers.image.revision=${{ github.sha }}
174+
org.opencontainers.image.version=${{ github.ref_name }}
175+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
176+
177+
docker-arm64:
178+
name: Docker Validator (arm64)
179+
runs-on: ubuntu-arm64
180+
needs: [unit, integration, e2e]
181+
timeout-minutes: 15
182+
permissions:
183+
contents: read
184+
packages: write
185+
steps:
186+
- name: Checkout Code
187+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
188+
189+
- name: Setup Docker Buildx
190+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
191+
192+
- name: Authenticate to registry
193+
uses: ./.github/actions/ghcr-login
194+
195+
- name: Build and push
196+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
197+
with:
198+
context: .
199+
file: Dockerfile.validator
200+
platforms: linux/arm64
201+
push: true
202+
tags: ${{ env.VALIDATOR_IMAGE }}:${{ github.ref_name }}-arm64
203+
labels: |
204+
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
205+
org.opencontainers.image.title=eidos-validator
206+
org.opencontainers.image.revision=${{ github.sha }}
207+
org.opencontainers.image.version=${{ github.ref_name }}
208+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
209+
210+
# =============================================================================
211+
# Docker Manifest: Combine per-arch images into multi-arch manifests
212+
# =============================================================================
213+
214+
docker-manifest:
215+
name: Docker Manifest
216+
runs-on: ubuntu-latest
217+
needs: [docker-amd64, docker-arm64]
218+
timeout-minutes: 5
219+
permissions:
220+
contents: read
221+
packages: write
222+
steps:
223+
- name: Authenticate to registry
224+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
225+
with:
226+
registry: ghcr.io
227+
username: ${{ github.actor }}
228+
password: ${{ github.token }}
229+
230+
- name: Create and push manifests
231+
env:
232+
TAG: ${{ github.ref_name }}
233+
run: |
234+
set -euo pipefail
235+
236+
# Extract major and minor versions (e.g., v0.5.7 -> v0, v0.5)
237+
MAJOR="v$(echo "$TAG" | sed 's/^v//' | cut -d. -f1)"
238+
MAJOR_MINOR="v$(echo "$TAG" | sed 's/^v//' | cut -d. -f1-2)"
239+
240+
# Create and push manifest for each tag
241+
for MANIFEST_TAG in "$TAG" "$MAJOR" "$MAJOR_MINOR" "latest"; do
242+
docker manifest create "$VALIDATOR_IMAGE:$MANIFEST_TAG" \
243+
"$VALIDATOR_IMAGE:$TAG-amd64" \
244+
"$VALIDATOR_IMAGE:$TAG-arm64"
245+
docker manifest push "$VALIDATOR_IMAGE:$MANIFEST_TAG"
246+
echo "Pushed manifest: $VALIDATOR_IMAGE:$MANIFEST_TAG"
247+
done
248+
249+
# =============================================================================
250+
# Publish: Flip draft release to public after all artifacts are ready
251+
# =============================================================================
252+
253+
publish:
254+
name: Publish Release
255+
runs-on: ubuntu-latest
256+
needs: [build, docker-manifest]
257+
if: needs.build.outputs.release_outcome == 'success'
258+
timeout-minutes: 5
259+
permissions:
260+
contents: write
261+
steps:
262+
- name: Publish GitHub release
263+
env:
264+
GH_TOKEN: ${{ github.token }}
265+
run: |
266+
set -euo pipefail
267+
gh release edit "${{ github.ref_name }}" \
268+
--repo "${{ github.repository }}" \
269+
--draft=false
270+
271+
# =============================================================================
272+
# Attestation Job (runs after release is published)
139273
# =============================================================================
140274

141275
attest:
142276
name: Attest Images
143277
runs-on: ubuntu-latest
144-
needs: [build]
145-
if: needs.build.outputs.release_outcome == 'success'
278+
needs: [publish]
146279
timeout-minutes: 10
147280
permissions:
148281
contents: read

.goreleaser.yaml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ release:
8989
owner: NVIDIA
9090
name: eidos
9191
prerelease: auto
92+
draft: true
9293

9394
kos:
9495
- id: eidos
@@ -119,31 +120,6 @@ kos:
119120
preserve_import_paths: false
120121
bare: true
121122

122-
dockers_v2:
123-
- id: eidos-validator
124-
dockerfile: Dockerfile.validator
125-
images:
126-
- ghcr.io/nvidia/eidos-validator
127-
tags:
128-
- latest
129-
- "{{.Tag}}"
130-
- "v{{.Major}}"
131-
- "v{{.Major}}.{{.Minor}}"
132-
platforms:
133-
- linux/amd64
134-
- linux/arm64
135-
labels:
136-
org.opencontainers.image.created: "{{.Date}}"
137-
org.opencontainers.image.title: "{{.ProjectName}}-validator"
138-
org.opencontainers.image.revision: "{{.FullCommit}}"
139-
org.opencontainers.image.version: "{{.Version}}"
140-
org.opencontainers.image.source: "{{.GitURL}}"
141-
extra_files:
142-
- go.mod
143-
- go.sum
144-
- pkg
145-
- cmd
146-
147123
archives:
148124
- id: eidos
149125
ids:

Dockerfile.validator

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Build stage: runs on the host platform, cross-compiles via GOOS/GOARCH
16-
# This avoids slow QEMU emulation for the non-native architecture.
17-
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS builder
18-
19-
ARG TARGETOS TARGETARCH
20-
21-
WORKDIR /workspace
22-
23-
# Copy go mod files first for better caching
24-
COPY go.mod go.sum ./
25-
RUN go mod download
26-
27-
# Copy source code
28-
COPY . .
29-
30-
# Cross-compile test binaries for the target platform
31-
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go test -c -o /tmp/readiness.test ./pkg/validator/checks/readiness && \
32-
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go test -c -o /tmp/deployment.test ./pkg/validator/checks/deployment && \
33-
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go test -c -o /tmp/performance.test ./pkg/validator/checks/performance && \
34-
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go test -c -o /tmp/conformance.test ./pkg/validator/checks/conformance || true
35-
36-
# Runtime stage: full Go toolchain needed because agent/job.go runs "go test" at runtime
15+
# Validator image includes Go toolchain for running validation tests in-cluster.
16+
# Built natively per-arch via CI (no cross-compilation or QEMU needed).
3717
FROM golang:1.25-bookworm
3818

3919
RUN apt-get update && apt-get install -y \
@@ -43,15 +23,15 @@ RUN apt-get update && apt-get install -y \
4323

4424
WORKDIR /workspace
4525

46-
# Copy source for runtime "go test" execution
47-
COPY --from=builder /workspace/go.mod /workspace/go.sum ./
48-
COPY --from=builder /workspace/pkg/ pkg/
49-
COPY --from=builder /workspace/cmd/ cmd/
26+
COPY go.mod go.sum ./
27+
RUN go mod download
5028

51-
# Copy pre-compiled test binaries
52-
COPY --from=builder /tmp/*.test /usr/local/bin/
29+
COPY . .
5330

54-
# Pre-warm module cache for runtime
55-
RUN go mod download
31+
# Pre-compile test binaries for faster Job startup
32+
RUN go test -c -o /usr/local/bin/readiness.test ./pkg/validator/checks/readiness && \
33+
go test -c -o /usr/local/bin/deployment.test ./pkg/validator/checks/deployment && \
34+
go test -c -o /usr/local/bin/performance.test ./pkg/validator/checks/performance && \
35+
go test -c -o /usr/local/bin/conformance.test ./pkg/validator/checks/conformance || true
5636

5737
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)