From 3acec5301888f88b98a03b5f712c96da83cd3fe7 Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Sun, 11 Nov 2018 16:04:10 +1100 Subject: [PATCH] Add gh-assets-clone.sh script. --- .gitignore | 1 + .travis.yml | 1 + gh-assets-clone.sh | 19 +++++++++++++++++++ postgres_metrics_added_and_removed | 7 ++++--- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gh-assets-clone.sh diff --git a/.gitignore b/.gitignore index 8a061907..22bf9135 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /release /*.prom /.metrics.*.*.prom +/.metrics.*.*.prom.unique diff --git a/.travis.yml b/.travis.yml index 23837d36..4d31f3d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ before_install: && sudo chmod +x /usr/local/bin/docker-compose - sudo apt-get update && sudo apt-get install postgresql-client-common script: +- ./gh-assets-clone.sh - go run mage.go -v all - "$HOME/gopath/bin/goveralls -coverprofile=cover.out -service=travis-ci" - go run mage.go docker diff --git a/gh-assets-clone.sh b/gh-assets-clone.sh new file mode 100644 index 00000000..009ea24d --- /dev/null +++ b/gh-assets-clone.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Script to setup the assets clone of the repository using GIT_ASSETS_BRANCH and +# GIT_API_KEY. + +[ -z "$GIT_ASSETS_BRANCH" ] || exit 1 +[ -z "$GIT_API_KEY" ] || exit 1 + +setup_git() { + git config --global user.email "travis@travis-ci.org" || exit 1 + git config --global user.name "Travis CI" || exit 1 +} + +# Constants +ASSETS_DIR=".assets-branch" + +# Clone the assets branch with the correct credentials +git clone --single-branch -b "$GIT_ASSETS_BRANCH" \ + "https://${GIT_API_KEY}@github.com/${TRAVIS_REPO_SLUG}.git" "$ASSETS_DIR" || exit 1 + diff --git a/postgres_metrics_added_and_removed b/postgres_metrics_added_and_removed index a7eb0002..334f9b6a 100755 --- a/postgres_metrics_added_and_removed +++ b/postgres_metrics_added_and_removed @@ -2,10 +2,11 @@ # Script to determine added and removed metrics. # Not currently used in CI but useful for inspecting complicated changes. +# valid types: single or replicated type="$1" -version="$2" +pg_version="$2" old_version="$3" new_version="$4" -comm -23 "$old_version" "$new_version" > ".metrics.${type}.${version}.removed" -comm -13 "$old_version" "$new_version" > ".metrics.${type}.${version}.added" +comm -23 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.removed" +comm -13 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.added"