grafana/scripts/build/update_repo/update-rpm.sh

58 lines
1.3 KiB
Bash
Raw Normal View History

2018-12-17 10:19:55 -06:00
#!/usr/bin/env bash
RELEASE_TYPE="${1:-}"
GPG_PASS="${2:-}"
RELEASE_TAG="${3:-}"
DIST_PATH="${4:-}"
2019-01-17 03:17:59 -06:00
GCP_REPO_BUCKET="${5:-grafana-repo}"
REPO="rpm"
if [ -z "$RELEASE_TYPE" ] || [ -z "$GPG_PASS" ] || [ -z "$DIST_PATH" ]; then
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
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
gsutil -m rsync -r "$BUCKET" /rpm-repo
2018-12-17 10:19:55 -06:00
# Add the new release to the repo
cp "$DIST_PATH"/*.rpm /rpm-repo # adds to many files for enterprise
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
# sslcacert=/etc/pki/tls/certs/ca-bundle.crt