Skip to content

Commit

Permalink
FileSync Updates [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 7, 2024
1 parent c3ebcdb commit 3807948
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions update-digests.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/bash

export DOCKER_CLI_EXPERIMENTAL=enabled
version_json=$(cat ./VERSION.json)
upstream_image=$(jq -r '.upstream_image' <<< "${version_json}")
upstream_tag=$(jq -r '.upstream_tag' <<< "${version_json}")
if [[ ${upstream_image} == null || ${upstream_tag} == null ]]; then
jq '.upstream_image = "'"ghcr.io/hotio/base"'" | .upstream_tag = "'"alpine"'"' <<< "${version_json}" > VERSION.json
exit 0
fi
set -e
json=$(cat VERSION.json)
upstream_image=$(jq -re '.upstream_image' <<< "${json}")
upstream_tag=$(jq -re '.upstream_tag' <<< "${json}")
manifest=$(skopeo inspect --raw "docker://${upstream_image}:${upstream_tag}")
[[ -z ${manifest} ]] && exit 1
upstream_digest_amd64=$(echo "${manifest}" | jq -r '.manifests[] | select (.platform.architecture == "amd64" and .platform.os == "linux").digest')
upstream_digest_arm64=$(echo "${manifest}" | jq -r '.manifests[] | select (.platform.architecture == "arm64" and .platform.os == "linux").digest')
jq '.upstream_digest_amd64 = "'"${upstream_digest_amd64}"'" | .upstream_digest_arm64 = "'"${upstream_digest_arm64}"'"' <<< "${version_json}" > VERSION.json
upstream_digest_amd64=$(jq -re '.manifests[] | select (.platform.architecture == "amd64" and .platform.os == "linux").digest' <<< "${manifest}")
upstream_digest_arm64=$(jq -re '.manifests[] | select (.platform.architecture == "arm64" and .platform.os == "linux").digest' <<< "${manifest}")
jq --sort-keys \
--arg upstream_digest_amd64 "${upstream_digest_amd64}" \
--arg upstream_digest_arm64 "${upstream_digest_arm64}" \
'.upstream_digest_amd64 = $upstream_digest_amd64 | .upstream_digest_arm64 = $upstream_digest_arm64' <<< "${json}" | tee VERSION.json

0 comments on commit 3807948

Please sign in to comment.