summaryrefslogtreecommitdiff
path: root/contrib/upldrel
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-29 06:56:43 -0700
committerGitHub <noreply@github.com>2019-08-29 06:56:43 -0700
commitab5f52c0d2ce617f875ef69c9ae67381841a6514 (patch)
treeccc70cbe33c74a1f55187d3ff0bc05f27a6ffa92 /contrib/upldrel
parent1eb6b271bb1b197c214b9cf560c362a6aeb402da (diff)
parent370b1a887cbf6db8ac893c39118cf8c6c2fd663c (diff)
downloadpodman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.tar.gz
podman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.tar.bz2
podman-ab5f52c0d2ce617f875ef69c9ae67381841a6514.zip
Merge pull request #3710 from cevich/release_redo
Release redo
Diffstat (limited to 'contrib/upldrel')
-rw-r--r--contrib/upldrel/Dockerfile9
-rw-r--r--contrib/upldrel/README.md9
-rwxr-xr-xcontrib/upldrel/entrypoint.sh62
3 files changed, 80 insertions, 0 deletions
diff --git a/contrib/upldrel/Dockerfile b/contrib/upldrel/Dockerfile
new file mode 100644
index 000000000..54a58c521
--- /dev/null
+++ b/contrib/upldrel/Dockerfile
@@ -0,0 +1,9 @@
+FROM quay.io/libpod/imgts:latest
+
+RUN yum -y update && \
+ yum -y install unzip && \
+ rpm -V unzip && \
+ yum clean all
+
+COPY /contrib/upldrel/entrypoint.sh /usr/local/bin/entrypoint.sh
+RUN chmod 755 /usr/local/bin/entrypoint.sh
diff --git a/contrib/upldrel/README.md b/contrib/upldrel/README.md
new file mode 100644
index 000000000..41f5ffef0
--- /dev/null
+++ b/contrib/upldrel/README.md
@@ -0,0 +1,9 @@
+![PODMAN logo](../../logo/podman-logo-source.svg)
+
+A container image for canonical-naming and uploading of
+libpod and remote-client archives. Only intended to ever
+be used by CI/CD, and depends heavily on an embedded
+`release.txt` file produced by `make`.
+
+Build script: [../cirrus/build_release.sh](../cirrus/build_release.sh)
+Upload script: [../cirrus/upload_release_archive.sh](../cirrus/upload_release_archive.sh)
diff --git a/contrib/upldrel/entrypoint.sh b/contrib/upldrel/entrypoint.sh
new file mode 100755
index 000000000..985b828a0
--- /dev/null
+++ b/contrib/upldrel/entrypoint.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+set -e
+
+source /usr/local/bin/lib_entrypoint.sh
+
+req_env_var GCPJSON_FILEPATH GCPNAME GCPPROJECT REL_ARC_FILEPATH PR_OR_BRANCH BUCKET
+
+[[ -r "$REL_ARC_FILEPATH" ]] || \
+ die 2 ERROR Cannot read release archive file: "$REL_ARC_FILEPATH"
+
+[[ -r "$GCPJSON_FILEPATH" ]] || \
+ die 3 ERROR Cannot read GCP credentials file: "$GCPJSON_FILEPATH"
+
+cd $TMPDIR
+echo "Attempting to extract release.txt from tar or zip $REL_ARC_FILEPATH"
+unset SFX
+if tar xzf "$REL_ARC_FILEPATH" "./release.txt"
+then
+ echo "It's a tarball"
+ SFX="tar.gz"
+elif unzip "$REL_ARC_FILEPATH" release.txt
+then
+ echo "It's a zip"
+ SFX="zip"
+else
+ die 5 ERROR Could not extract release.txt from $REL_ARC_FILEPATH
+fi
+
+echo "Parsing release.txt contents"
+RELEASETXT=$(<release.txt)
+cd -
+[[ -n "$RELEASETXT" ]] || \
+ die 3 ERROR Could not obtain metadata from release.txt in $REL_ARC_FILEPATH
+
+RELEASE_INFO=$(echo "$RELEASETXT" | grep -m 1 'X-RELEASE-INFO:' | sed -r -e 's/X-RELEASE-INFO:\s*(.+)/\1/')
+if [[ "$?" -ne "0" ]] || [[ -z "$RELEASE_INFO" ]]
+then
+ die 4 ERROR Metadata is empty or invalid: '$RELEASETXT'
+fi
+
+# e.g. libpod v1.3.1-166-g60df124e fedora 29 amd64
+# or libpod v1.3.1-166-g60df124e amd64
+FIELDS="RELEASE_BASENAME RELEASE_VERSION RELEASE_DIST RELEASE_DIST_VER RELEASE_ARCH"
+read $FIELDS <<< $RELEASE_INFO
+for f in $FIELDS
+do
+ [[ -n "${!f}" ]] || \
+ die 5 ERROR Expecting $f to be non-empty in metadata: '$RELEASE_INFO'
+done
+
+gcloud_init "$GCPJSON_FILEPATH"
+
+# Drop version number to enable "latest" representation
+# (version available w/in zip-file comment)
+RELEASE_ARCHIVE_NAME="${RELEASE_BASENAME}-${PR_OR_BRANCH}-${RELEASE_DIST}-${RELEASE_DIST_VER}-${RELEASE_ARCH}.${SFX}"
+
+echo "Uploading archive as $RELEASE_ARCHIVE_NAME"
+gsutil cp "$REL_ARC_FILEPATH" "gs://$BUCKET/$RELEASE_ARCHIVE_NAME"
+
+echo "Release now available at:"
+echo " https://storage.cloud.google.com/$BUCKET/$RELEASE_ARCHIVE_NAME"