Commit b9c4eb70 by Leonard Gram

build: publishes beta releases to separate repos.

parent 8f5886e6
...@@ -423,10 +423,10 @@ jobs: ...@@ -423,10 +423,10 @@ jobs:
comand: './scripts/build/load-signing-key.sh' comand: './scripts/build/load-signing-key.sh'
- run: - run:
name: Update Debian repository name: Update Debian repository
command: './scripts/build/update_repo/update-deb.sh "oss" "$GPG_KEY_PASSWORD"' command: './scripts/build/update_repo/update-deb.sh "oss" "$GPG_KEY_PASSWORD" "$CIRCLE_TAG"'
- run: - run:
name: Update RPM repository name: Update RPM repository
command: './scripts/build/update_repo/update-rpm.sh "oss" "$GPG_KEY_PASSWORD"' command: './scripts/build/update_repo/update-rpm.sh "oss" "$GPG_KEY_PASSWORD" "$CIRCLE_TAG"'
workflows: workflows:
version: 2 version: 2
......
#!/usr/bin/env expect #!/usr/bin/env expect
set password [lindex $argv 0] set password [lindex $argv 0]
spawn aptly publish repo grafana filesystem:repo:grafana spawn gpg --detach-sign --armor /tmp/sign-this
expect "Enter passphrase: " expect "Enter passphrase: "
send -- "$password\r" send -- "$password\r"
expect eof expect eof
...@@ -2,12 +2,23 @@ ...@@ -2,12 +2,23 @@
RELEASE_TYPE="${1:-}" RELEASE_TYPE="${1:-}"
GPG_PASS="${2:-}" GPG_PASS="${2:-}"
RELEASE_TAG="${3:-}"
REPO="grafana"
if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then
echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set" echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set"
exit 1 exit 1
fi 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="beta"
fi
set -e set -e
# Setup environment # Setup environment
...@@ -20,22 +31,26 @@ mkdir -p /deb-repo/db \ ...@@ -20,22 +31,26 @@ mkdir -p /deb-repo/db \
gsutil -m rsync -r "gs://grafana-aptly-db/$RELEASE_TYPE" /deb-repo/db gsutil -m rsync -r "gs://grafana-aptly-db/$RELEASE_TYPE" /deb-repo/db
# Add the new release to the repo # Add the new release to the repo
aptly publish drop squeeze filesystem:repo:grafana || true aptly publish drop grafana filesystem:repo:grafana || true
aptly publish drop beta filesystem:repo:grafana || true
cp ./dist/*.deb /deb-repo/tmp cp ./dist/*.deb /deb-repo/tmp
rm /deb-repo/tmp/grafana_latest*.deb || true rm /deb-repo/tmp/grafana_latest*.deb || true
aptly repo add grafana ./dist aptly repo add "$REPO" ./dist
# Setup signing and sign the repo # Setup signing and sign the repo
echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
./scripts/build/update_repo/sign-deb-repo.sh "$GPG_PASS" ./scripts/build/update_repo/unlock-gpg-key.sh "$GPG_PASS"
aptly publish repo grafana filesystem:repo:grafana
aptly publish repo beta filesystem:repo:grafana
# Update the repo and db on gcp # Update the repo and db on gcp
gsutil -m rsync -r -d /deb-repo/db "gs://grafana-aptly-db/$RELEASE_TYPE" gsutil -m rsync -r -d /deb-repo/db "gs://grafana-aptly-db/$RELEASE_TYPE"
gsutil -m rsync -r -d /deb-repo/repo/grafana "gs://grafana-repo/$RELEASE_TYPE/deb" gsutil -m rsync -r -d /deb-repo/repo/grafana "gs://grafana-repo/$RELEASE_TYPE/deb"
# usage: # usage:
# curl https://packages.grafana.com/gpg.key | apt-key add - #
# deb https://packages.grafana.com/oss/deb stable main # deb https://packages.grafana.com/oss/deb stable main
...@@ -3,18 +3,31 @@ ...@@ -3,18 +3,31 @@
RELEASE_TYPE="${1:-}" RELEASE_TYPE="${1:-}"
GPG_PASS="${2:-}" GPG_PASS="${2:-}"
RELEASE_TAG="${3:-}"
REPO="rpm"
if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then
echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set" echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set"
exit 1 exit 1
fi 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
set -e set -e
# Setup environment # Setup environment
BUCKET="gs://grafana-repo/$RELEASE_TYPE/$REPO"
mkdir -p /rpm-repo mkdir -p /rpm-repo
# Download the database # Download the database
gsutil -m rsync -r "gs://grafana-repo/$RELEASE_TYPE/rpm" /rpm-repo gsutil -m rsync -r "$BUCKET" /rpm-repo
# Add the new release to the repo # Add the new release to the repo
cp ./dist/*.rpm /rpm-repo cp ./dist/*.rpm /rpm-repo
...@@ -32,7 +45,7 @@ pkill gpg-agent || true ...@@ -32,7 +45,7 @@ pkill gpg-agent || true
./scripts/build/update_repo/sign-rpm-repo.sh "$GPG_PASS" ./scripts/build/update_repo/sign-rpm-repo.sh "$GPG_PASS"
# Update the repo and db on gcp # Update the repo and db on gcp
gsutil -m rsync -r -d /rpm-repo "gs://grafana-repo/$RELEASE_TYPE/rpm" gsutil -m rsync -r -d /rpm-repo "$BUCKET"
# usage: # usage:
# [grafana] # [grafana]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment