-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract scripts from pull, push and update-descriptions (#120)
* refactor: extract scripts from pull, push and update-descriptions * ci: remove RC009
- Loading branch information
1 parent
2e1e4e4
commit 031f7bf
Showing
7 changed files
with
63 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ workflows: | |
tags: | ||
only: /.*/ | ||
- orb-tools/review: | ||
exclude: RC009 | ||
filters: | ||
tags: | ||
only: /.*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "$PARAM_IMAGES" | sed -n 1'p' | tr ',' '\n' | while read -r image; do | ||
echo "Pulling ${image}"; | ||
|
||
if [ "$PARAM_IGNORE_DOCKER_PULL_ERROR" -eq 1 ]; then | ||
docker pull "${image}" || true; | ||
else | ||
docker pull "${image}"; | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
IFS="," read -ra DOCKER_TAGS <<< "$PARAM_TAG" | ||
|
||
for tag in "${DOCKER_TAGS[@]}"; do | ||
docker push "$PARAM_REGISTRY"/"$PARAM_IMAGE":${tag} | ||
done | ||
|
||
if [ -n "$PARAM_DIGEST_PATH" ]; then | ||
mkdir -p "$(dirname "$PARAM_DIGEST_PATH")" | ||
IFS="," read -ra DOCKER_TAGS <<< "$PARAM_TAG" | ||
docker image inspect --format="{{index .RepoDigests 0}}" "$PARAM_REGISTRY"/"$PARAM_IMAGE":"${DOCKER_TAGS[0]}" > "$PARAM_DIGEST_PATH" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$PARAM_REGISTRY" != "docker.io" ]; then | ||
echo "Registry is not set to Docker Hub. Exiting" | ||
exit 1 | ||
fi | ||
|
||
USERNAME=${!PARAM_DOCKER_USERNAME} | ||
PASSWORD=${!PARAM_DOCKER_PASSWORD} | ||
|
||
DESCRIPTION="$PARAM_PATH/$PARAM_README" | ||
PAYLOAD="username=$USERNAME&password=$PASSWORD" | ||
JWT=$(curl -s -d "$PAYLOAD" https://hub.docker.com/v2/users/login/ | jq -r .token) | ||
HEADER="Authorization: JWT $JWT" | ||
URL="https://hub.docker.com/v2/repositories/$PARAM_IMAGE/" | ||
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X PATCH -H "$HEADER" --data-urlencode full_description@$DESCRIPTION $URL) | ||
|
||
if [ $STATUS -ne 200 ]; then | ||
echo "Could not update image description" | ||
echo "Error code: $STATUS" | ||
exit 1 | ||
fi |