Leonard Gram пре 7 година
родитељ
комит
c3e23d7574

+ 1 - 1
.circleci/config.yml

@@ -426,7 +426,7 @@ jobs:
           command: './scripts/build/update_repo/update-deb.sh "oss" "$GPG_KEY_PASSWORD"'
       - run:
           name: Update RPM repository
-          command: 'ls'
+          command: './scripts/build/update_repo/update-rpm.sh "oss" "$GPG_KEY_PASSWORD"'
 
 workflows:
   version: 2

+ 0 - 0
scripts/build/update_repo/sign-repo.sh → scripts/build/update_repo/sign-deb-repo.sh


+ 7 - 0
scripts/build/update_repo/sign-rpm-repo.sh

@@ -0,0 +1,7 @@
+#!/usr/bin/env expect
+
+set password [lindex $argv 0]
+spawn gpg --detach-sign --armor /rpm-repo/repodata/repomd.xml
+expect "Enter passphrase: "
+send -- "$password\r"
+expect eof

+ 1 - 1
scripts/build/update_repo/update-deb.sh

@@ -29,7 +29,7 @@ aptly repo add grafana ./dist
 echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
 echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
 
-./scripts/build/update_repo/sign-repo.sh "$GPG_PASS"
+./scripts/build/update_repo/sign-deb-repo.sh "$GPG_PASS"
 
 # Update the repo and db on gcp
 gsutil -m rsync -r -d /deb-repo/db gs://grafana-aptly-db/repo-db

+ 43 - 1
scripts/build/update_repo/update-rpm.sh

@@ -1 +1,43 @@
-#!/usr/bin/env bash
+#!/usr/bin/env bash
+
+RELEASE_TYPE="${1:-}"
+GPG_PASS="${2:-}"
+
+if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" ]; then
+    echo "Both RELEASE_TYPE (arg 1) and GPG_PASS (arg 2) has to be set"
+    exit 1
+fi
+
+set -e
+
+# Setup environment
+mkdir -p /rpm-repo
+
+# Download the database
+gsutil -m rsync -r "gs://grafana-repo/$RELEASE_TYPE/rpm" /rpm-repo
+
+# Add the new release to the repo
+cp ./dist/*.rpm /rpm-repo
+cd /rpm-repo
+createrepo .
+
+# Setup signing and sign the repo
+
+echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
+echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
+
+./scripts/build/update_repo/sign-rpm-repo.sh "$GPG_PASS"
+
+# Update the repo and db on gcp
+gsutil -m rsync -r -d /rpm-repo "gs://grafana-repo/$RELEASE_TYPE/rpm"
+
+# usage:
+# [grafana]
+# name=grafana
+# baseurl=https://grafana-repo.storage.googleapis.com/oss/rpm
+# repo_gpgcheck=1
+# enabled=1
+# gpgcheck=1
+# gpgkey=https://grafana-repo.storage.googleapis.com/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
+# sslverify=1
+# sslcacert=/etc/pki/tls/certs/ca-bundle.crt# later: