2018-12-14 09:10:16 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
RELEASE_TYPE="${1:-}"
|
|
|
|
GPG_PASS="${2:-}"
|
|
|
|
|
|
|
|
if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then
|
2018-12-17 04:09:35 -06:00
|
|
|
echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set"
|
2018-12-14 09:10:16 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Setup environment
|
|
|
|
cp scripts/build/update_repo/aptly.conf /etc/aptly.conf
|
2019-01-04 09:35:17 -06:00
|
|
|
mkdir -p /deb-repo/db \
|
|
|
|
/deb-repo/repo \
|
|
|
|
/deb-repo/tmp
|
2018-12-14 09:10:16 -06:00
|
|
|
|
|
|
|
# Download the database
|
2019-01-04 03:18:44 -06:00
|
|
|
gsutil -m rsync -r "gs://grafana-aptly-db/$RELEASE_TYPE" /deb-repo/db
|
2018-12-14 09:10:16 -06:00
|
|
|
|
|
|
|
# Add the new release to the repo
|
2018-12-18 08:30:51 -06:00
|
|
|
aptly publish drop squeeze filesystem:repo:grafana || true
|
|
|
|
cp ./dist/*.deb /deb-repo/tmp
|
|
|
|
rm /deb-repo/tmp/grafana_latest*.deb || true
|
2018-12-14 09:10:16 -06:00
|
|
|
aptly repo add grafana ./dist
|
|
|
|
|
|
|
|
# Setup signing and sign the repo
|
|
|
|
|
|
|
|
echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
|
|
|
|
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
|
|
|
|
|
2018-12-17 10:19:55 -06:00
|
|
|
./scripts/build/update_repo/sign-deb-repo.sh "$GPG_PASS"
|
2018-12-14 09:10:16 -06:00
|
|
|
|
|
|
|
# Update the repo and db on gcp
|
2019-01-04 03:18:44 -06:00
|
|
|
gsutil -m rsync -r -d /deb-repo/db "gs://grafana-aptly-db/$RELEASE_TYPE"
|
2018-12-14 09:10:16 -06:00
|
|
|
gsutil -m rsync -r -d /deb-repo/repo/grafana "gs://grafana-repo/$RELEASE_TYPE/deb"
|
|
|
|
|
|
|
|
# usage:
|
2018-12-20 04:11:20 -06:00
|
|
|
# curl https://packages.grafana.com/gpg.key | apt-key add -
|
2019-01-04 03:18:44 -06:00
|
|
|
# deb https://packages.grafana.com/oss/deb stable main
|