summaryrefslogtreecommitdiff
path: root/contrib/cirrus
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cirrus')
-rwxr-xr-xcontrib/cirrus/build_swagger.sh17
-rwxr-xr-xcontrib/cirrus/upload_release_archive.sh44
2 files changed, 44 insertions, 17 deletions
diff --git a/contrib/cirrus/build_swagger.sh b/contrib/cirrus/build_swagger.sh
new file mode 100755
index 000000000..0471f0c10
--- /dev/null
+++ b/contrib/cirrus/build_swagger.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+source $(dirname $0)/lib.sh
+
+# Building this is a PITA, just grab binary for use in automation
+# Ref: https://goswagger.io/install.html#static-binary
+download_url=$(curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | \
+ jq -r '.assets[] | select(.name | contains("'"$(uname | tr '[:upper:]' '[:lower:]')"'_amd64")) | .browser_download_url')
+curl -o /usr/local/bin/swagger -L'#' "$download_url"
+chmod +x /usr/local/bin/swagger
+
+cd $GOSRC
+make swagger
+echo "Preserving build details for later use."
+mv -v release.txt actual_release.txt # Another 'make' during testing could overwrite it
diff --git a/contrib/cirrus/upload_release_archive.sh b/contrib/cirrus/upload_release_archive.sh
index eb7742375..a94a5cc82 100755
--- a/contrib/cirrus/upload_release_archive.sh
+++ b/contrib/cirrus/upload_release_archive.sh
@@ -9,6 +9,8 @@ req_env_var CI UPLDREL_IMAGE CIRRUS_BUILD_ID GOSRC RELEASE_GCPJSON RELEASE_GCPNA
[[ "$CI" == "true" ]] || \
die 56 "$0 must be run under Cirrus-CI to function"
+SWAGGER_FILEPATH="pkg/api/swagger.yaml"
+
# We store "releases" for each PR, mostly to validate the process is functional
unset PR_OR_BRANCH BUCKET
if [[ -n "$CIRRUS_PR" ]]
@@ -17,8 +19,8 @@ then
BUCKET="libpod-pr-releases"
elif [[ -n "$CIRRUS_BRANCH" ]]
then
- # Only release non-development tagged commit ranges
- if is_release
+ # Only release binaries for tagged commit ranges, unless working on docs
+ if is_release || [[ $CIRRUS_TASK_NAME =~ "docs" ]]
then
PR_OR_BRANCH="$CIRRUS_BRANCH"
BUCKET="libpod-$CIRRUS_BRANCH-releases"
@@ -62,7 +64,7 @@ echo "$RELEASE_GCPJSON" > "$TMPF"
unset RELEASE_GCPJSON
cd $GOSRC
-for filename in $(ls -1 *.tar.gz *.zip *.msi)
+for filename in $(ls -1 *.tar.gz *.zip *.msi $SWAGGER_FILEPATH)
do
unset EXT
EXT=$(echo "$filename" | sed -r -e 's/.+\.(.+$)/\1/g')
@@ -76,24 +78,32 @@ do
EXT="tar.gz"
fi
- [[ "$OS_RELEASE_ID" == "ubuntu" ]] || \
- chcon -t container_file_t "$filename"
- # Form the generic "latest" file for this branch or pr
- TO_PREFIX="${RELEASE_BASENAME}-latest-${PR_OR_BRANCH}-${RELEASE_DIST}"
- # Form the fully-versioned filename for historical sake
- ALSO_PREFIX="${RELEASE_BASENAME}-${RELEASE_VERSION}-${PR_OR_BRANCH}-${RELEASE_DIST}"
- TO_SUFFIX="${RELEASE_ARCH}.${EXT}"
- if [[ "$RELEASE_DIST" == "windows" ]] || [[ "$RELEASE_DIST" == "darwin" ]]
+ if [[ $filename == $SWAGGER_FILEPATH ]]
then
- TO_FILENAME="${TO_PREFIX}-${TO_SUFFIX}"
- ALSO_FILENAME="${ALSO_PREFIX}-${TO_SUFFIX}"
+ # Support other tools referencing branch and/or version-specific refs.
+ TO_FILENAME="swagger-${RELEASE_VERSION}-${PR_OR_BRANCH}.yaml"
+ # For doc. ref. this must always be a static filename, e.g. swagger-latest-master.yaml
+ ALSO_FILENAME="swagger-latest-${PR_OR_BRANCH}.yaml"
else
- TO_FILENAME="${TO_PREFIX}-${RELEASE_DIST_VER}-${TO_SUFFIX}"
- ALSO_FILENAME="${ALSO_PREFIX}-${TO_SUFFIX}"
+ # Form the generic "latest" file for this branch or pr
+ TO_PREFIX="${RELEASE_BASENAME}-latest-${PR_OR_BRANCH}-${RELEASE_DIST}"
+ # Form the fully-versioned filename for historical sake
+ ALSO_PREFIX="${RELEASE_BASENAME}-${RELEASE_VERSION}-${PR_OR_BRANCH}-${RELEASE_DIST}"
+ TO_SUFFIX="${RELEASE_ARCH}.${EXT}"
+ if [[ "$RELEASE_DIST" == "windows" ]] || [[ "$RELEASE_DIST" == "darwin" ]]
+ then
+ TO_FILENAME="${TO_PREFIX}-${TO_SUFFIX}"
+ ALSO_FILENAME="${ALSO_PREFIX}-${TO_SUFFIX}"
+ else
+ TO_FILENAME="${TO_PREFIX}-${RELEASE_DIST_VER}-${TO_SUFFIX}"
+ ALSO_FILENAME="${ALSO_PREFIX}-${TO_SUFFIX}"
+ fi
fi
+ [[ "$OS_RELEASE_ID" == "ubuntu" ]] || \
+ chcon -t container_file_t "$filename"
+
echo "Running podman ... $UPLDREL_IMAGE for $filename -> $TO_FILENAME"
- echo "Warning: upload failures are completely ignored, avoiding any needless holdup of PRs."
podman run -i --rm \
-e "GCPNAME=$RELEASE_GCPNAME" \
-e "GCPPROJECT=$RELEASE_GCPROJECT" \
@@ -105,5 +115,5 @@ do
-e "BUCKET=$BUCKET" \
-v "$TMPF:$TMPF:ro" \
-v "$(realpath $GOSRC/$filename):/tmp/$filename:ro" \
- $UPLDREL_IMAGE || true
+ $UPLDREL_IMAGE
done