Skip to content

Commit

Permalink
[#147541559] Allow setting Git username and email address in all publ…
Browse files Browse the repository at this point in the history
…ic tasks

Signed-off-by: Chunyi Lyu <clyu@pivotal.io>
  • Loading branch information
staylor14 authored and ChunyiLyu committed Jul 5, 2017
1 parent 04298ab commit 4606c30
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 9 deletions.
6 changes: 4 additions & 2 deletions bbl-destroy/task
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/bash -xeu

# shellcheck disable=SC1091
source cf-deployment-concourse-tasks/shared-functions

function commit_bbl_state_file {
local root_dir
root_dir="${1}"

pushd "${root_dir}/bbl-state/${BBL_STATE_DIR}"
if [[ -n $(git status --porcelain) ]]; then
git config user.name "CI Bot"
git config user.email "cf-release-integration@pivotal.io"
set_git_config
git add --all bbl-state.json
git commit -m "Remove bbl-state.json"
fi
Expand Down
6 changes: 6 additions & 0 deletions bbl-destroy/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ params:
# - Path to the directory containing the `bbl-state.json` file
# - The path is relative to root of the `bbl-state` input
# - If unspecified, uses the root of the `bbl-state` input

GIT_COMMIT_EMAIL:
GIT_COMMIT_USERNAME:
# - Optional
# - You may choose the git committer username and email address by setting these
# - If you leave them blank, they are set to 'CI Bot' and 'cf-release-integration@pivotal.io', respectively
6 changes: 4 additions & 2 deletions bbl-up/task
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash -xeu

# shellcheck disable=SC1091
source cf-deployment-concourse-tasks/shared-functions

function check_fast_fails() {
set +x
if [ -z "${LB_DOMAIN}" -a "${BBL_IAAS}" == "gcp" ]; then
Expand Down Expand Up @@ -29,8 +32,7 @@ function commit_bbl_state_file {

pushd "${root_dir}/bbl-state/${BBL_STATE_DIR}"
if [[ -n $(git status --porcelain) ]]; then
git config user.name "CI Bot"
git config user.email "cf-release-integration@pivotal.io"
set_git_config
git add bbl-state.json
git commit -m "Update bbl-state.json"
fi
Expand Down
6 changes: 6 additions & 0 deletions bbl-up/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ params:
# - Optional
# - A label to apply to the bbl environment
# - Label will appear in the IaaS metadata/interface

GIT_COMMIT_EMAIL:
GIT_COMMIT_USERNAME:
# - Optional
# - You may choose the git committer username and email address by setting these
# - If you leave them blank, they are set to 'CI Bot' and 'cf-release-integration@pivotal.io', respectively
6 changes: 6 additions & 0 deletions bosh-deploy-with-created-release/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ params:
# - This is helpful for testing changes around variable generation
# - Works well with fresh deployments
# - Upgrade deployments are not expected to work with total cred rotation

GIT_COMMIT_EMAIL:
GIT_COMMIT_USERNAME:
# - Optional
# - You may choose the git committer username and email address by setting these
# - If you leave them blank, they are set to 'CI Bot' and 'cf-release-integration@pivotal.io', respectively
6 changes: 6 additions & 0 deletions bosh-deploy/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,9 @@ params:
# - This is helpful for testing changes around variable generation
# - Works well with fresh deployments
# - Upgrade deployments are not expected to work with total cred rotation

GIT_COMMIT_EMAIL:
GIT_COMMIT_USERNAME:
# - Optional
# - You may choose the git committer username and email address by setting these
# - If you leave them blank, they are set to 'CI Bot' and 'cf-release-integration@pivotal.io', respectively
18 changes: 15 additions & 3 deletions shared-functions
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,23 @@ function check_input_params() {
set -x
}

function commit_vars_store {
function set_git_config() {
if [ -z "${GIT_COMMIT_USERNAME}" ]; then
GIT_COMMIT_USERNAME="CI Bot"
fi

if [ -z "${GIT_COMMIT_EMAIL}" ]; then
GIT_COMMIT_EMAIL="cf-release-integration@pivotal.io"
fi

git config user.name "${GIT_COMMIT_USERNAME}"
git config user.email "${GIT_COMMIT_EMAIL}"
}

function commit_vars_store() {
pushd vars-store
if [[ -n $(git status --porcelain) ]]; then
git config user.name "CI Bot"
git config user.email "cf-release-integration@pivotal.io"
set_git_config
git add "${VARS_STORE_FILE}"
git commit -m "Update vars-store after deploy"
fi
Expand Down
6 changes: 4 additions & 2 deletions update-integration-configs/task
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash -eu
set -o pipefail

# shellcheck disable=SC1091
source cf-deployment-concourse-tasks/shared-functions

function check_fast_fails() {
if [ -z "$VARS_STORE_FILE" ]; then
echo "VARS_STORE_FILE has not been set"
Expand All @@ -18,8 +21,7 @@ function commit_integration_configs {
set -x
pushd integration-configs
if [[ -n $(git status --porcelain) ]]; then
git config user.name "CI Bot"
git config user.email "cf-release-integration@pivotal.io"
set_git_config

if [ -f "${CATS_INTEGRATION_CONFIG_FILE}" ]; then
git add "${CATS_INTEGRATION_CONFIG_FILE}"
Expand Down
7 changes: 7 additions & 0 deletions update-integration-configs/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ params:
# - Optional
# - CF system base domain e.g. `my-cf.com`
# - Should match the value passed to `bosh-deploy`

GIT_COMMIT_EMAIL:
GIT_COMMIT_USERNAME:
# - Optional
# - You may choose the git committer username and email address by setting these
# - If you leave them blank, they are set to 'CI Bot' and 'cf-release-integration@pivotal.io', respectively

0 comments on commit 4606c30

Please sign in to comment.