main
sh 77 lines 2.4 KB
Raw
1 #!/usr/bin/env bash
2 # Build the ROCm CI test image or wheel artifact.
3 #
4 # When base selection changes, build the full image so downstream ROCm tests
5 # validate the selected base -> ci_base -> CI image chain.
6
7 set -euo pipefail
8
9 metadata_get() {
10 local key="$1"
11 if command -v buildkite-agent >/dev/null 2>&1; then
12 buildkite-agent meta-data get "${key}" 2>/dev/null || true
13 fi
14 }
15
16 load_digest_handoff() {
17 local metadata_key="$1"
18 local env_name="$2"
19 local description="$3"
20 local image_ref=""
21
22 image_ref="$(metadata_get "${metadata_key}")"
23 if [[ -z "${image_ref}" ]]; then
24 return 1
25 fi
26 if [[ ! "${image_ref}" =~ @sha256:[0-9a-f]{64}$ ]]; then
27 echo "${description} is not digest-pinned: ${image_ref}" >&2
28 return 1
29 fi
30
31 printf -v "${env_name}" '%s' "${image_ref}"
32 export "${env_name?}"
33 echo "Using ${description}: ${image_ref}"
34 }
35
36 main() {
37 local base_refreshed=0
38
39 # This job always builds the checked-out commit. Some externally generated
40 # pipeline templates still inject remote-fetch settings; do not let those
41 # settings make the source identity commit-specific or bypass local edits.
42 export REMOTE_VLLM=0
43 unset VLLM_BRANCH
44
45 if ! load_digest_handoff \
46 rocm-ci-base-image CI_BASE_IMAGE "ROCm ci_base handoff"; then
47 if [[ "${BUILDKITE:-false}" == "true" ]]; then
48 echo "Required ROCm ci_base handoff metadata is missing or invalid" >&2
49 return 1
50 fi
51 echo "No ROCm ci_base handoff metadata found; using the local default"
52 fi
53
54 if ! load_digest_handoff \
55 rocm-base-image BASE_IMAGE "ROCm base handoff"; then
56 if [[ "${BUILDKITE:-false}" == "true" ]]; then
57 echo "Required ROCm base handoff metadata is missing or invalid" >&2
58 return 1
59 fi
60 echo "No ROCm base handoff metadata found; using the local default"
61 fi
62
63 if [[ "$(metadata_get rocm-base-refresh)" == "1" ]]; then
64 echo "The selected ROCm base differs from the current stable base"
65 base_refreshed=1
66 fi
67
68 if [[ "${ROCM_CI_ARTIFACT_ONLY:-0}" == "1" && "${base_refreshed}" != "1" ]]; then
69 echo "ROCM_CI_ARTIFACT_ONLY=1; building ROCm wheel artifact only"
70 IMAGE_TAG="" bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-artifacts
71 return
72 fi
73
74 bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-wheel
75 }
76
77 main "$@"