Skip to content

Commit

Permalink
Adds better comments and create branch per PR
Browse files Browse the repository at this point in the history
Signed-off-by: Rij, W. van (Wiard) <wiard@outlook.com>
  • Loading branch information
wiardvanrij committed Dec 17, 2021
1 parent b77625c commit 6fc72e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/container-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
signoff: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Updates busybox SHA'
title: '[busybox] Updates busybox SHAs'
branch: update-sha-action
delete-branch: true
title: '*: Updates Prometheus BusyBox image SHAs'
body: >
This PR is auto-generated by
[create-pull-request](https://github.com/peter-evans/create-pull-request).
Expand Down
6 changes: 3 additions & 3 deletions scripts/busybox-updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# No need to manually run this (unless you want to force an update NOW)

# Get the tags from the registry, so we can get the base manifest_digest ID
echo "Doing first CURL request"
echo "Doing CURL request 1 of 2: getting tags."
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)
if [ $? -ne 0 ]; then
echo "Error: ""$CURL_TAGS"
Expand All @@ -14,15 +14,15 @@ fi
MANIFEST_DIGEST=$(echo "${CURL_TAGS}" | jq -r '.tags[]' | jq -r -n 'first(inputs | select (.name=="latest")) | .manifest_digest ')

# With this manifest_digest, we can now fetch the actual manifest, which contains the digest per platform
echo "Doing second CURL request"
echo "Doing CURL request 2/2: getting manifest."
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)
if [ $? -ne 0 ]; then
echo "Error: ""$RESULT_CURL"
exit 1
fi

# Output this as file
echo "Creating result"
echo "Creating result and writing to .busybox-versions."
RESULT=$(echo "${RESULT_CURL}" | jq -r '.manifest_data | fromjson | .manifests[] | .platform.architecture +"="+ .digest' | sed 's/sha256://g')
echo "# Auto generated by busybox-updater.sh. DO NOT EDIT" >./.busybox-versions
echo "${RESULT}" >>./.busybox-versions

0 comments on commit 6fc72e3

Please sign in to comment.