diff options
author | baude <bbaude@redhat.com> | 2020-01-17 09:41:40 -0600 |
---|---|---|
committer | Chris Evich <cevich@redhat.com> | 2020-01-17 15:41:33 -0500 |
commit | 9be6f30a42a8737f7e853dc3333b627242a962ab (patch) | |
tree | 81de580baddb004e7cb18f1111f65577f13cdef8 /contrib/cirrus/upload_release_archive.sh | |
parent | ab7e1a4c400f4bdb47ab49a2a0c8ef9508c68e02 (diff) | |
download | podman-9be6f30a42a8737f7e853dc3333b627242a962ab.tar.gz podman-9be6f30a42a8737f7e853dc3333b627242a962ab.tar.bz2 podman-9be6f30a42a8737f7e853dc3333b627242a962ab.zip |
post-process swagger yaml for publish
Signed-off-by: baude <bbaude@redhat.com>
Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'contrib/cirrus/upload_release_archive.sh')
-rwxr-xr-x | contrib/cirrus/upload_release_archive.sh | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/contrib/cirrus/upload_release_archive.sh b/contrib/cirrus/upload_release_archive.sh index eb7742375..2716c402c 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" ]] @@ -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 |