|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +cd "$(dirname "${BASH_SOURCE[0]}")/.." |
| 6 | + |
| 7 | +full_version="$(tr -d '[:space:]' < VERSION)" |
| 8 | +if [[ ! "${full_version}" =~ ^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$ ]]; then |
| 9 | + echo "VERSION must use YY.MM.PP format; found '${full_version}'" >&2 |
| 10 | + exit 1 |
| 11 | +fi |
| 12 | +short_version="${full_version%.*}" |
| 13 | + |
| 14 | +expected_tags="$(mktemp)" |
| 15 | +trap 'rm -f "${expected_tags}"' EXIT |
| 16 | + |
| 17 | +# Recreate the visible part of every Linux image name from matrix.yml. Hidden |
| 18 | +# features affect image contents but, by design, do not appear in image tags. |
| 19 | +yq --yaml-fix-merge-anchor-to-spec -eMo json matrix.yml \ |
| 20 | + | jq -r --arg version "${short_version}" ' |
| 21 | + .include[] |
| 22 | + | select(.os != "windows") |
| 23 | + | (.os | gsub(":"; "")) as $os |
| 24 | + | .images[] |
| 25 | + | (.features |
| 26 | + | map( |
| 27 | + select(.hide != true) |
| 28 | + | (.name | split("/")[-1] | split(":")[0]) |
| 29 | + + (.version // "" | tostring) |
| 30 | + + (.suffix // "" | tostring) |
| 31 | + ) |
| 32 | + | (. + [$os]) |
| 33 | + | join("-") |
| 34 | + ) as $name |
| 35 | + # The release publishes both the OS-qualified tag and an OS-free alias. |
| 36 | + | [ |
| 37 | + $version + "-cpp-" + $name, |
| 38 | + $version + "-cpp-" + ($name | sub("-" + $os + "$"; "")) |
| 39 | + ] |
| 40 | + | .[] |
| 41 | + ' \ |
| 42 | + | sort -u > "${expected_tags}" |
| 43 | + |
| 44 | +status=0 |
| 45 | +while IFS=$'\t' read -r file base; do |
| 46 | + [[ "${base}" == rapidsai/devcontainers:* ]] || continue |
| 47 | + tag="${base#rapidsai/devcontainers:}" |
| 48 | + if ! grep -Fqx -- "${tag}" "${expected_tags}"; then |
| 49 | + echo "${file}: BASE '${base}' is not produced by matrix.yml" >&2 |
| 50 | + status=1 |
| 51 | + fi |
| 52 | +done < <( |
| 53 | + find .devcontainer -name devcontainer.json -exec \ |
| 54 | + jq -r '[input_filename, (.build.args.BASE // "")] | @tsv' {} + |
| 55 | +) |
| 56 | + |
| 57 | +exit "${status}" |
0 commit comments