github.com/thanos-io/thanos@v0.32.5/scripts/busybox-updater.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # This script is called via .github/workflows/container-version.yaml
     4  # No need to manually run this (unless you want to force an update NOW)
     5  
     6  # Get the tags from the registry, so we can get the base manifest_digest ID
     7  echo "Doing CURL request 1 of 2: getting tags."
     8  CURL_TAGS=$(curl --fail --silent --show-error -H "Content-type: application/json" -H "Accept: application/json" https://quay.io/api/v1/repository/prometheus/busybox/tag/ 2>&1)
     9  if [ $? -ne 0 ]; then
    10    echo "Error: ""$CURL_TAGS"
    11    exit 1
    12  fi
    13  
    14  MANIFEST_DIGEST=$(echo "${CURL_TAGS}" | jq -r '.tags[]' | jq -r -n 'first(inputs | select (.name=="latest")) | .manifest_digest ')
    15  
    16  # With this manifest_digest, we can now fetch the actual manifest, which contains the digest per platform
    17  echo "Doing CURL request 2/2: getting manifest."
    18  RESULT_CURL=$(curl --fail --silent --show-error -H "Content-type: application/json" -H "Accept: application/json" https://quay.io/api/v1/repository/prometheus/busybox/manifest/${MANIFEST_DIGEST} 2>&1)
    19  if [ $? -ne 0 ]; then
    20    echo "Error: ""$RESULT_CURL"
    21    exit 1
    22  fi
    23  
    24  # Output this as file
    25  echo "Creating result and writing to .busybox-versions."
    26  RESULT=$(echo "${RESULT_CURL}" | jq -r '.manifest_data | fromjson | .manifests[] | .platform.architecture +"="+ .digest' | sed 's/sha256://g')
    27  echo "# Auto generated by busybox-updater.sh. DO NOT EDIT" >./.busybox-versions
    28  echo "${RESULT}" >>./.busybox-versions