diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-08-29 06:56:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29 06:56:43 -0700 |
commit | ab5f52c0d2ce617f875ef69c9ae67381841a6514 (patch) | |
tree | ccc70cbe33c74a1f55187d3ff0bc05f27a6ffa92 /contrib/cirrus/upload_release_archive.sh | |
parent | 1eb6b271bb1b197c214b9cf560c362a6aeb402da (diff) | |
parent | 370b1a887cbf6db8ac893c39118cf8c6c2fd663c (diff) | |
download | podman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.tar.gz podman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.tar.bz2 podman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.zip |
Merge pull request #3710 from cevich/release_redo
Release redo
Diffstat (limited to 'contrib/cirrus/upload_release_archive.sh')
-rwxr-xr-x | contrib/cirrus/upload_release_archive.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/contrib/cirrus/upload_release_archive.sh b/contrib/cirrus/upload_release_archive.sh new file mode 100755 index 000000000..942255821 --- /dev/null +++ b/contrib/cirrus/upload_release_archive.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -eo pipefail + +source $(dirname $0)/lib.sh + +req_env_var CI UPLDREL_IMAGE CIRRUS_BUILD_ID GOSRC RELEASE_GCPJSON RELEASE_GCPNAME RELEASE_GCPROJECT + +[[ "$CI" == "true" ]] || \ + die 56 "$0 must be run under Cirrus-CI to function" + +unset PR_OR_BRANCH BUCKET +if [[ -n "$CIRRUS_PR" ]] +then + PR_OR_BRANCH="pr$CIRRUS_PR" + BUCKET="libpod-pr-releases" +elif [[ -n "$CIRRUS_BRANCH" ]] +then + PR_OR_BRANCH="$CIRRUS_BRANCH" + BUCKET="libpod-$CIRRUS_BRANCH-releases" +else + die 1 "Expecting either \$CIRRUS_PR or \$CIRRUS_BRANCH to be non-empty." +fi + +# Functional local podman required for uploading a release +cd $GOSRC +[[ -n "$(type -P podman)" ]] || \ + make install || \ + die 57 "$0 requires working podman binary on path to function" + +TMPF=$(mktemp -p '' $(basename $0)_XXXX.json) +trap "rm -f $TMPF" EXIT +set +x +echo "$RELEASE_GCPJSON" > "$TMPF" +unset RELEASE_GCPJSON + +cd $GOSRC +for filename in $(ls -1 *.tar.gz *.zip) +do + echo "Running podman ... $UPLDREL_IMAGE $filename" + podman run -i --rm \ + -e "GCPNAME=$RELEASE_GCPNAME" \ + -e "GCPPROJECT=$RELEASE_GCPROJECT" \ + -e "GCPJSON_FILEPATH=$TMPF" \ + -e "REL_ARC_FILEPATH=/tmp/$filename" \ + -e "PR_OR_BRANCH=$PR_OR_BRANCH" \ + -e "BUCKET=$BUCKET" \ + --security-opt label=disable \ + -v "$TMPF:$TMPF:ro" \ + -v "$GOSRC/$filename:/tmp/$filename:ro" \ + $UPLDREL_IMAGE +done |