From e031728b04b0c935071598c8fafaff8f2a5599d3 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Fri, 10 Feb 2017 11:46:27 +0100 Subject: [PATCH] bin/setup-circleci-secrets: possibly use generic credentials If the $SECRET_SCRIPT environment variable is defined in CircleCI, this can override the GCE credentials. I now use "base64" instead of "openssl base64" in order to support long lines in base64 text. It's useful when the text comes from a long environment variable like $SECRET_SCRIPT defined in CircleCI. Also, the $PROJECT environment variable can now override the GCE project name. Before, it needed to be named scope-integration-tests. This was initially merged in https://github.com/weaveworks/scope/pull/2223 Then, reverted in https://github.com/weaveworks/scope/pull/2229 Since then, it has the following fixes: 1. fix shell "unbound variable" Since this shell script uses "set -u", we must not use unset variables directly. Symptoms: > https://circleci.com/gh/weaveworks/scope/6384 > bin/setup-circleci-secrets: line 10: SECRET_SCRIPT: unbound variable Instead, we should use the parameter expansion "+" to test if the variable is set. See: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 2. return value of read I use the builtin "read" and this returns a non-zero value when reading until EOF. I use "|| true" to accept that. --- bin/setup-circleci-secrets | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/setup-circleci-secrets b/bin/setup-circleci-secrets index e6b83318a..f5de31d2c 100755 --- a/bin/setup-circleci-secrets +++ b/bin/setup-circleci-secrets @@ -5,9 +5,9 @@ set -eu # openssl enc -in do-setup-circleci-secrets.orig -out setup-circleci-secrets.orig -e -aes256 -pass stdin # openssl base64 < setup-circleci-secrets.orig -openssl base64 -d <