| 1 | #!/usr/bin/env bash |
| 2 | # Build the ROCm ci_base image, optionally from a freshly rebuilt ROCm base. |
| 3 | |
| 4 | set -euo pipefail |
| 5 | |
| 6 | metadata_get() { |
| 7 | local key="$1" |
| 8 | if command -v buildkite-agent >/dev/null 2>&1; then |
| 9 | buildkite-agent meta-data get "${key}" 2>/dev/null || true |
| 10 | fi |
| 11 | } |
| 12 | |
| 13 | main() { |
| 14 | local base_refreshed="" |
| 15 | local selected_base="" |
| 16 | |
| 17 | # The content identity below describes this checkout. Do not let legacy |
| 18 | # external pipeline settings switch the build to a remote source tree. |
| 19 | export REMOTE_VLLM=0 |
| 20 | unset VLLM_BRANCH |
| 21 | |
| 22 | base_refreshed="$(metadata_get rocm-base-refresh)" |
| 23 | selected_base="$(metadata_get rocm-base-image)" |
| 24 | if [[ -n "${selected_base}" ]]; then |
| 25 | if [[ ! "${selected_base}" =~ @sha256:[0-9a-f]{64}$ ]]; then |
| 26 | echo "Selected ROCm base handoff is not digest-pinned: ${selected_base}" >&2 |
| 27 | return 1 |
| 28 | fi |
| 29 | export BASE_IMAGE="${selected_base}" |
| 30 | echo "Using selected ROCm base image for ci_base: ${BASE_IMAGE}" |
| 31 | elif [[ "${BUILDKITE:-false}" == "true" ]]; then |
| 32 | echo "Required ROCm base handoff metadata is missing" >&2 |
| 33 | return 1 |
| 34 | fi |
| 35 | |
| 36 | if [[ "${base_refreshed}" == "1" ]]; then |
| 37 | export CI_BASE_PUSH_STABLE_TAG |
| 38 | |
| 39 | CI_BASE_PUSH_STABLE_TAG="$(metadata_get rocm-base-push-stable-tag)" |
| 40 | CI_BASE_PUSH_STABLE_TAG="${CI_BASE_PUSH_STABLE_TAG:-0}" |
| 41 | |
| 42 | echo "Push stable ci_base tag: ${CI_BASE_PUSH_STABLE_TAG}" |
| 43 | fi |
| 44 | |
| 45 | bash .buildkite/scripts/ci-bake-rocm.sh ci-base-rocm-ci-with-deps |
| 46 | } |
| 47 | |
| 48 | main "$@" |