...

Text file src/edge-infra.dev/hack/release/fetch-package-digests.sh

Documentation: edge-infra.dev/hack/release

     1#!/usr/bin/env bash
     2
     3# fetch-package-digests.sh
     4#
     5# This script fetches the digests for the given tag of all default packages from the
     6# warehouse GAR Repo in the given project
     7
     8set -eu
     9
    10# Cloud packages. These will be deployed to cloud clusters and are always referenced via Shipments as "latest"
    11latest_packages=(
    12    "foreman"
    13    "banner-infra-cluster"
    14    "cluster-infra"
    15    "basic-store"
    16    "couchdb-masters"
    17    "couchdb-bannerinfra"
    18)
    19
    20# Store packages. These Pallets will be fetched at a specific version, either for bootstrapping or installing
    21# Edge in a store. This list will be multiplied by the set of 3 currently supported versions: N, N-1, N-2
    22versioned_packages=(
    23    "store"
    24    "lumper-controller"
    25    "external-secrets-operator"
    26    "fluxcd-operators"
    27    "nodeagent"
    28    "spegel"
    29    "k8s-admission-controller"
    30    "descheduler"
    31    "distributed-storage"
    32    "multi-interface"
    33    "virtual-machines"
    34    "couchdb-repl-secret"
    35    "data-sync"
    36    "metrics"
    37    "bsl-shims"
    38    "edge-iam"
    39    "edge-priority-classes"
    40)
    41
    42function usage {
    43    log "usage:"
    44    log "  fetch-package-digests.sh version"
    45    log "example:"
    46    log "  fetch-package-digests.sh 0.16.12"
    47    exit "$1"
    48}
    49
    50function log {
    51    >&2 echo "$1"
    52}
    53
    54src_project="${SRC_PROJECT:-ret-edge-pltf-infra}"
    55
    56if [ -z "${1-}" ]; then
    57    log "missing required argument(s): version"
    58    usage 1
    59fi
    60
    61# Parse version argument and compute N-1, N-2
    62tag="$1"
    63
    64major=$(echo "$tag" | cut -s -d. -f1)
    65if [ -z "${major}" ]; then
    66    log "failed to parse version: $tag"
    67    usage 2
    68fi
    69minor=$(echo "$tag" | cut -s -d. -f2)
    70if [ -z "${minor}" ]; then
    71    log "failed to parse version: $tag"
    72    usage 2
    73fi
    74
    75current="${major}.${minor}"
    76minus1="${major}.$(( minor-1 ))"
    77minus2="${major}.$(( minor-2 ))"
    78
    79log "Fetching package digests for $current, $minus1, and $minus2..."
    80
    81# Supported Edge versions. Includes N, N-1, and N-2. Eg if N is 0.15, Edge can be installed in stores at
    82# versions 0.15, 0.14, or 0.13
    83versions=(
    84    "$current"
    85    "$minus1"
    86    "$minus2"
    87)
    88
    89package_list=""
    90
    91for pkg in "${versioned_packages[@]}"; do
    92    for version in "${versions[@]}"; do
    93        package_list="${package_list:+$package_list,}$pkg:$version"
    94    done
    95done
    96
    97for pkg in "${latest_packages[@]}"; do
    98    package_list=${package_list:+$package_list,}$pkg
    99done
   100
   101bazel run //cmd/f8n/warehouse/packagelock --color=yes -- build -location=us-east1 -repository=warehouse -project="$src_project" -pkglist="$package_list" -baseversion "$tag"

View as plain text