-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathupdate-upstream.sh
More file actions
13 lines (12 loc) · 805 Bytes
/
update-upstream.sh
File metadata and controls
13 lines (12 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
set -exuo pipefail
json=$(cat meta.json)
upstream_image=$(jq -re '.upstream_image' <<< "${json}")
upstream_tag=$(jq -re '.upstream_tag' <<< "${json}")
manifest=$(skopeo inspect --raw "docker://${upstream_image}:${upstream_tag}")
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 meta.json