#!/usr/bin/env bash # fetch-package-digests.sh # # This script fetches the digests for the given tag of all default packages from the # warehouse GAR Repo in the given project set -eu # Cloud packages. These will be deployed to cloud clusters and are always referenced via Shipments as "latest" latest_packages=( "foreman" "banner-infra-cluster" "cluster-infra" "basic-store" "couchdb-masters" "couchdb-bannerinfra" ) # Store packages. These Pallets will be fetched at a specific version, either for bootstrapping or installing # Edge in a store. This list will be multiplied by the set of 3 currently supported versions: N, N-1, N-2 versioned_packages=( "store" "lumper-controller" "external-secrets-operator" "fluxcd-operators" "nodeagent" "spegel" "k8s-admission-controller" "descheduler" "distributed-storage" "multi-interface" "virtual-machines" "couchdb-repl-secret" "data-sync" "metrics" "bsl-shims" "edge-iam" "edge-priority-classes" ) function usage { log "usage:" log " fetch-package-digests.sh version" log "example:" log " fetch-package-digests.sh 0.16.12" exit "$1" } function log { >&2 echo "$1" } src_project="${SRC_PROJECT:-ret-edge-pltf-infra}" if [ -z "${1-}" ]; then log "missing required argument(s): version" usage 1 fi # Parse version argument and compute N-1, N-2 tag="$1" major=$(echo "$tag" | cut -s -d. -f1) if [ -z "${major}" ]; then log "failed to parse version: $tag" usage 2 fi minor=$(echo "$tag" | cut -s -d. -f2) if [ -z "${minor}" ]; then log "failed to parse version: $tag" usage 2 fi current="${major}.${minor}" minus1="${major}.$(( minor-1 ))" minus2="${major}.$(( minor-2 ))" log "Fetching package digests for $current, $minus1, and $minus2..." # Supported Edge versions. Includes N, N-1, and N-2. Eg if N is 0.15, Edge can be installed in stores at # versions 0.15, 0.14, or 0.13 versions=( "$current" "$minus1" "$minus2" ) package_list="" for pkg in "${versioned_packages[@]}"; do for version in "${versions[@]}"; do package_list="${package_list:+$package_list,}$pkg:$version" done done for pkg in "${latest_packages[@]}"; do package_list=${package_list:+$package_list,}$pkg done bazel run //cmd/f8n/warehouse/packagelock --color=yes -- build -location=us-east1 -repository=warehouse -project="$src_project" -pkglist="$package_list" -baseversion "$tag"