-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support making release for OCI image reference
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash -eu | ||
|
||
githubUser="" | ||
githubRepo="" | ||
imageRefBase="" | ||
|
||
# Usage function to display help | ||
usage() { | ||
echo "Usage: $0 --user <username> --repo <repository> --image-ref-base <image_ref_base>" | ||
echo | ||
echo "Options:" | ||
echo " --user GitHub username (required)" | ||
echo " --repo GitHub repository name (required)" | ||
echo " --image-ref-base Base image reference (required, without the :tag suffix)" | ||
echo | ||
exit 1 | ||
} | ||
|
||
# Parse named CLI arguments using getopt | ||
OPTS=$(getopt -o '' --long user:,repo:,image-ref-base: -- "$@") | ||
eval set -- "$OPTS" | ||
|
||
# Extract options and their arguments into variables | ||
while true; do | ||
case "$1" in | ||
--user) | ||
githubUser="$2"; shift 2;; | ||
--repo) | ||
githubRepo="$2"; shift 2;; | ||
--image-ref-base) | ||
imageRefBase="$2"; shift 2;; | ||
--) | ||
shift; break;; | ||
*) | ||
usage;; | ||
esac | ||
done | ||
|
||
# Check if any required arguments are missing | ||
if [ -z "$githubUser" ] || [ -z "$githubRepo" ] || [ -z "$imageRefBase" ]; then | ||
echo "Error: Missing required arguments." | ||
usage | ||
fi | ||
|
||
# it's not nice that we've to guess here *what the primary image ref will be*, but we've to do this | ||
# until Turbo Bob makes "what will be the primary imageRef" visible to build steps. | ||
# (see https://github.com/function61/turbobob/issues/63) | ||
# | ||
# => ghcr.io/joonas-fi/joonas.fi:sha-105ea4e | ||
imageRef="${imageRefBase}:sha-${REV_ID:0:7}" | ||
|
||
deployer releases oci-image-release-mk "$imageRef" "$githubUser" "$githubRepo" "$FRIENDLY_REV_ID" "$REV_ID" |