main
sh 36 lines 1.16 KB
Raw
1 #!/bin/bash
2 # SPDX-License-Identifier: Apache-2.0
3 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
4 #
5 # Append the Docker image tag(s) an image-build step pushed to a Buildkite
6 # annotation, so the built image tags show up on the build page instead of
7 # being buried in the job logs.
8 #
9 # Usage: annotate-image-build.sh <image_tag> [<image_tag> ...]
10 set -euo pipefail
11
12 # buildkite-agent only exists on Buildkite agents; no-op elsewhere so the
13 # image build scripts stay runnable locally.
14 if ! command -v buildkite-agent >/dev/null 2>&1; then
15 echo "buildkite-agent not found; skipping image tag annotation"
16 exit 0
17 fi
18
19 label="${BUILDKITE_LABEL:-Image build}"
20 content=""
21 for image in "$@"; do
22 [[ -n "$image" ]] || continue
23 content+="- **${label}**: \`${image}\`"$'\n'
24 done
25
26 if [[ -z "$content" ]]; then
27 echo "No image tags provided; nothing to annotate"
28 exit 0
29 fi
30
31 # Best-effort: a flaky annotation must never fail an otherwise successful
32 # (and expensive) image build.
33 if ! printf '%s' "$content" | \
34 buildkite-agent annotate --append --style 'info' --context 'docker-images'; then
35 echo "warning: failed to annotate build with image tags"
36 fi