2018-12-17 10:19:55 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
RELEASE_TYPE="${1:-}"
|
|
|
|
GPG_PASS="${2:-}"
|
2019-01-08 09:20:26 -06:00
|
|
|
RELEASE_TAG="${3:-}"
|
2019-01-16 04:11:00 -06:00
|
|
|
DIST_PATH="${4:-}"
|
2019-01-17 03:17:59 -06:00
|
|
|
GCP_REPO_BUCKET="${5:-grafana-repo}"
|
2019-01-16 04:11:00 -06:00
|
|
|
|
2019-01-08 09:20:26 -06:00
|
|
|
REPO="rpm"
|
|
|
|
|
2019-07-23 05:12:33 -05:00
|
|
|
if [ -z "$RELEASE_TYPE" ] || [ -z "$GPG_PASS" ] || [ -z "$DIST_PATH" ]; then
|
2019-01-16 04:11:00 -06:00
|
|
|
echo "Both RELEASE_TYPE (arg 1), GPG_PASS (arg 2) and DIST_PATH (arg 4) has to be set"
|
2018-12-17 10:19:55 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-08 09:20:26 -06:00
|
|
|
if [[ "$RELEASE_TYPE" != "oss" && "$RELEASE_TYPE" != "enterprise" ]]; then
|
|
|
|
echo "RELEASE_TYPE (arg 1) must be either oss or enterprise."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if echo "$RELEASE_TAG" | grep -q "beta"; then
|
|
|
|
REPO="rpm-beta"
|
|
|
|
fi
|
|
|
|
|
2018-12-17 10:19:55 -06:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Setup environment
|
2019-01-17 03:17:59 -06:00
|
|
|
BUCKET="gs://$GCP_REPO_BUCKET/$RELEASE_TYPE/$REPO"
|
2019-01-17 06:40:40 -06:00
|
|
|
|
2018-12-17 10:19:55 -06:00
|
|
|
mkdir -p /rpm-repo
|
|
|
|
|
|
|
|
# Download the database
|
2019-01-08 09:20:26 -06:00
|
|
|
gsutil -m rsync -r "$BUCKET" /rpm-repo
|
2018-12-17 10:19:55 -06:00
|
|
|
|
|
|
|
# Add the new release to the repo
|
2019-08-02 06:22:50 -05:00
|
|
|
cp "$DIST_PATH"/*.rpm /rpm-repo # adds to many files for enterprise
|
2018-12-18 08:30:51 -06:00
|
|
|
rm /rpm-repo/grafana-latest-1*.rpm || true
|
2019-01-17 03:17:59 -06:00
|
|
|
createrepo /rpm-repo
|
2018-12-17 10:19:55 -06:00
|
|
|
|
|
|
|
# Setup signing and sign the repo
|
|
|
|
|
|
|
|
echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
|
|
|
|
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
|
|
|
|
|
2018-12-20 04:11:20 -06:00
|
|
|
rm /rpm-repo/repodata/repomd.xml.asc || true
|
2018-12-17 10:19:55 -06:00
|
|
|
./scripts/build/update_repo/sign-rpm-repo.sh "$GPG_PASS"
|
|
|
|
|
|
|
|
# usage:
|
|
|
|
# [grafana]
|
|
|
|
# name=grafana
|
2019-01-08 09:34:59 -06:00
|
|
|
# baseurl=https://packages.grafana.com/oss/rpm
|
2018-12-17 10:19:55 -06:00
|
|
|
# repo_gpgcheck=1
|
|
|
|
# enabled=1
|
|
|
|
# gpgcheck=1
|
2019-01-08 09:34:59 -06:00
|
|
|
# gpgkey=https://packages.grafana.com/gpg.key
|
2018-12-17 10:19:55 -06:00
|
|
|
# sslverify=1
|
2019-01-16 04:11:00 -06:00
|
|
|
# sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|