1313# limitations under the License.
1414
1515name : ' AICR Build'
16- description : ' Builds the aicr validator image (via Dockerfile) and CLI binary , and loads the image into kind.'
16+ description : ' Builds the aicr CLI and optional snapshot/validator images , and loads requested images into kind.'
1717
1818inputs :
19+ build_cli :
20+ description : ' Build and stage the standalone aicr CLI binary at the repository root'
21+ required : false
22+ default : ' true'
23+ build_snapshot_agent :
24+ description : ' Build the CUDA-based snapshot agent image and load it into kind'
25+ required : false
26+ default : ' true'
1927 build_validators :
2028 description : ' Deprecated: use validator_phases instead. Ignored when validator_phases is set.'
2129 required : false
@@ -28,86 +36,34 @@ inputs:
2836runs :
2937 using : ' composite'
3038 steps :
31-
32- - name : Install ko
39+ - name : Build standalone aicr CLI binary
40+ if : inputs.build_cli == 'true'
3341 shell : bash
34- run : |
35- KO_VERSION=$(yq eval '.build_tools.ko' .settings.yaml)
36- GOFLAGS= go install "github.com/google/ko@${KO_VERSION} "
42+ env :
43+ GOFLAGS : -mod=vendor
44+ run : bash "${{ github.action_path }}/build-cli.sh "
3745
38- - name : Build snapshot agent image and load into kind
46+ - name : Build snapshot agent CLI binary
47+ if : inputs.build_cli != 'true' && inputs.build_snapshot_agent == 'true'
3948 shell : bash
4049 env :
4150 GOFLAGS : -mod=vendor
42- run : |
43- # Build snapshot agent image with CUDA base (provides nvidia-smi for GPU detection).
44- # Uses cuda:base (~250MB) instead of cuda:runtime (~1.8GB) — only nvidia-smi is needed.
45- # GPU test workflows use --image=ko.local:smoke-test for aicr snapshot.
46- CGO_ENABLED=0 go build -trimpath -o dist/aicr ./cmd/aicr
47- docker build -t ko.local:smoke-test -f - . <<'DOCKERFILE'
48- FROM nvcr.io/nvidia/cuda:13.1.0-base-ubuntu24.04
49- COPY dist/aicr /usr/local/bin/aicr
50- ENTRYPOINT ["/usr/local/bin/aicr"]
51- DOCKERFILE
51+ run : bash "${{ github.action_path }}/build-cli.sh"
5252
53- # Load onto all nodes. The snapshot agent requests nvidia.com/gpu but
54- # does not set a node selector, so it can land on any GPU-capable node
55- # including the control-plane (e.g., T4 smoke test).
56- #
57- # Timeout is intentionally generous (900s per attempt). H100 self-hosted
58- # runners transfer images over a shared Docker-in-Docker bridge; large
59- # CUDA base images (~250MB compressed) combined with I/O contention from
60- # parallel GPU operator pods regularly exceed the previous 600s limit.
61- timeout 900 kind load docker-image ko.local:smoke-test --name "${KIND_CLUSTER_NAME}" || {
62- echo "::warning::kind load attempt 1 failed for ko.local:smoke-test, retrying..."
63- timeout 900 kind load docker-image ko.local:smoke-test --name "${KIND_CLUSTER_NAME}"
64- }
53+ - name : Build snapshot agent image and load into kind
54+ if : inputs.build_snapshot_agent == 'true'
55+ shell : bash
56+ run : bash "${{ github.action_path }}/build-snapshot-agent.sh"
6557
6658 - name : Build validator images and load into kind
6759 if : " !(inputs.validator_phases == 'none' || (inputs.validator_phases == '' && inputs.build_validators == 'false'))"
6860 shell : bash
6961 env :
7062 GOFLAGS : -mod=vendor
71- run : |
72- # Determine which validator phases to build.
73- # validator_phases takes precedence; build_validators is a deprecated fallback.
74- if [[ -n "${{ inputs.validator_phases }}" ]]; then
75- if [[ "${{ inputs.validator_phases }}" == "none" ]]; then
76- echo "Skipping validator builds (validator_phases=none)"
77- exit 0
78- fi
79- PHASES="${{ inputs.validator_phases }}"
80- else
81- # Default: build all phases (backwards compatible)
82- PHASES="deployment,performance,conformance"
83- fi
84-
85- # Compile only the requested validator binaries.
86- mkdir -p dist/validator
87- for phase in ${PHASES//,/ }; do
88- echo "Building validator binary: ${phase}"
89- CGO_ENABLED=0 go build -trimpath -o "dist/validator/${phase}" "./validators/${phase}"
90- done
91-
92- for phase in ${PHASES//,/ }; do
93- mkdir -p "validators/${phase}/testdata"
94- docker build -t "ko.local/aicr-validators/${phase}:latest" -f - . <<DOCKERFILE
95- FROM gcr.io/distroless/static-debian12:nonroot
96- COPY dist/validator/${phase} /${phase}
97- COPY validators/${phase}/testdata /app/testdata
98- WORKDIR /app
99- USER nonroot
100- ENTRYPOINT ["/${phase}"]
101- DOCKERFILE
102- # Validator images are small (~30MB distroless), but share the same
103- # Docker-in-Docker bridge as the smoke-test load above. 600s per
104- # attempt accommodates I/O queuing behind concurrent image pulls.
105- timeout 600 kind load docker-image "ko.local/aicr-validators/${phase}:latest" --name "${KIND_CLUSTER_NAME}" || {
106- echo "::warning::kind load attempt 1 failed for ko.local/aicr-validators/${phase}:latest, retrying..."
107- timeout 600 kind load docker-image "ko.local/aicr-validators/${phase}:latest" --name "${KIND_CLUSTER_NAME}"
108- }
109- done
63+ VALIDATOR_PHASES : ${{ inputs.validator_phases }}
64+ run : bash "${{ github.action_path }}/build-validator-images.sh"
11065
11166 - name : Stage aicr binary at repo root
67+ if : inputs.build_cli == 'true'
11268 shell : bash
113- run : cp dist/aicr ./aicr
69+ run : bash "${{ github.action_path }}/stage-cli.sh"
0 commit comments