forked from jontours/vars-to-credhub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-generate pipeline with latest template
- Loading branch information
Showing
4 changed files
with
144 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
# ci/settings.yml and override what needs overridden. | ||
# This uses spruce, so you have some options there. | ||
# | ||
# author: James Hunt <[email protected]> | ||
# created: 2016-03-30 | ||
# original author: James Hunt <[email protected]> | ||
# created: 2016-03-30 | ||
# maintainer: Benjamin Gandon (Gstack) | ||
|
||
meta: | ||
name: (( param "Please name your pipeline" )) | ||
|
@@ -43,12 +44,14 @@ meta: | |
secret_key: (( param "Please set your AWS Secret Key ID" )) | ||
|
||
github: | ||
uri: (( concat "[email protected]:" meta.github.owner "/" meta.github.repo )) | ||
owner: (( param "Please specify the name of the user / organization that owns the Github repository" )) | ||
repo: (( param "Please specify the name of the Github repository" )) | ||
branch: master | ||
private_key: (( param "Please generate an SSH Deployment Key for this repo and specify it here" )) | ||
access_token: (( param "Please generate a Personal Access Token and specify it here" )) | ||
uri: (( concat "[email protected]:" meta.github.owner "/" meta.github.repo )) | ||
owner: (( param "Please specify the name of the user / organization that owns the Github repository" )) | ||
repo: (( param "Please specify the name of the Github repository" )) | ||
branch: master | ||
pr_base_branch: (( grab meta.github.branch )) | ||
release_branch: (( grab meta.github.branch )) | ||
private_key: (( param "Please generate an SSH Deployment Key for this repo and specify it here" )) | ||
access_token: (( param "Please generate a Personal Access Token and specify it here" )) | ||
|
||
slack: | ||
webhook: (( param "Please specify your Slack Incoming Webhook Integration URL" )) | ||
|
@@ -59,8 +62,8 @@ meta: | |
success_moji: ":airplane_departure:" | ||
upset_moji: ":sadpanda:" | ||
pipeline_url: (( concat meta.url "/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}" )) | ||
fail_link: (( concat "<" meta.slack.pipeline_url "/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}| Concourse Failure! " meta.slack.upset_moji ">" )) | ||
fail_text: '(( concat meta.slack.fail_link " " meta.pipeline ": `${BUILD_JOB_NAME}` job failed" ))' | ||
fail_link: (( concat "<" meta.slack.pipeline_url "/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}| Let's go fix it!>" )) | ||
fail_text: '(( concat meta.pipeline ": `${BUILD_JOB_NAME}` job has failed " meta.slack.upset_moji " " meta.slack.fail_link " :hammer_and_wrench:" ))' | ||
|
||
groups: | ||
- name: (( grab meta.pipeline )) | ||
|
@@ -98,6 +101,7 @@ jobs: | |
MODULE: (( grab meta.go.module )) | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -163,6 +167,7 @@ jobs: | |
SUCCESS_MOJI: (( grab meta.slack.success_moji )) | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -205,6 +210,7 @@ jobs: | |
params: { file: version/number } | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -219,6 +225,7 @@ jobs: | |
- { put: version, params: { file: version/number} } | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -233,6 +240,7 @@ jobs: | |
- { put: version, params: { file: version/number } } | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -247,6 +255,7 @@ jobs: | |
- { put: version, params: { file: version/number } } | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -279,20 +288,20 @@ jobs: | |
path: (( concat "./gopath/src/" meta.go.module "/ci/scripts/shipit" )) | ||
args: [] | ||
params: | ||
BINARY: (( grab meta.go.binary )) | ||
REPO_ROOT: (( concat "gopath/src/" meta.go.module )) | ||
VERSION_FROM: version/number | ||
RELEASE_NAME: (( grab meta.release )) | ||
RELEASE_ROOT: gh | ||
REPO_OUT: pushme | ||
BINARY: (( grab meta.go.binary )) | ||
REPO_ROOT: (( concat "gopath/src/" meta.go.module )) | ||
VERSION_FROM: version/number | ||
RELEASE_NAME: (( grab meta.release )) | ||
RELEASE_ROOT: gh | ||
REPO_OUT: pushme | ||
NOTIFICATION_OUT: notifications | ||
BRANCH: (( grab meta.github.branch )) | ||
GITHUB_OWNER: (( grab meta.github.owner )) | ||
GITHUB_REPO: (( grab meta.github.repo )) | ||
CMD_PKG: (( grab meta.go.cmd_module )) | ||
STATIC_BINARY: (( grab meta.go.force_static_binary )) | ||
GIT_EMAIL: (( grab meta.git.email )) | ||
GIT_NAME: (( grab meta.git.name )) | ||
RELEASE_BRANCH: (( grab meta.github.release_branch )) | ||
GITHUB_OWNER: (( grab meta.github.owner )) | ||
GITHUB_REPO: (( grab meta.github.repo )) | ||
CMD_PKG: (( grab meta.go.cmd_module )) | ||
STATIC_BINARY: (( grab meta.go.force_static_binary )) | ||
GIT_EMAIL: (( grab meta.git.email )) | ||
GIT_NAME: (( grab meta.git.name )) | ||
- put: version | ||
params: { bump: final } | ||
- put: git | ||
|
@@ -314,6 +323,7 @@ jobs: | |
text_file: notifications/message | ||
on_failure: | ||
put: notify | ||
no_get: true | ||
params: | ||
channel: (( grab meta.slack.channel )) | ||
username: (( grab meta.slack.username )) | ||
|
@@ -329,7 +339,7 @@ resource_types: | |
- name: pull-request | ||
type: registry-image | ||
source: | ||
repository: teliaoss/github-pr-resource | ||
repository: cfcommunity/github-pr-resource | ||
|
||
resources: | ||
- name: image | ||
|
@@ -381,4 +391,4 @@ resources: | |
source: | ||
access_token: (( grab meta.github.access_token )) | ||
repository: (( concat meta.github.owner "/" meta.github.repo )) | ||
base_branch: (( grab meta.github.branch )) | ||
base_branch: (( grab meta.github.pr_base_branch )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,20 +5,21 @@ | |
# Script for merging together pipeline configuration files | ||
# (via Spruce!) and configuring Concourse. | ||
# | ||
# author: James Hunt <[email protected]> | ||
# Dennis Bell <[email protected]> | ||
# created: 2016-03-04 | ||
# original authors: James Hunt <[email protected]> | ||
# Dennis Bell <[email protected]> | ||
# created: 2016-03-04 | ||
# maintainer: Benjamin Gandon (Gstack) | ||
|
||
need_command() { | ||
local cmd=${1:?need_command() - no command name given} | ||
|
||
if [[ ! -x "$(command -v $cmd)" ]]; then | ||
echo >&2 "${cmd} is not installed." | ||
if [[ "${cmd}" == "spruce" ]]; then | ||
echo >&2 "Please download it from https://github.com/geofffranks/spruce/releases" | ||
fi | ||
exit 2 | ||
fi | ||
local cmd=${1:?"need_command() - no command name given"} | ||
|
||
if [[ ! -x "$(command -v ${cmd})" ]]; then | ||
echo >&2 "${cmd} is not installed." | ||
if [[ "${cmd}" == "spruce" ]]; then | ||
echo >&2 "Please download it from https://github.com/geofffranks/spruce/releases" | ||
fi | ||
exit 2 | ||
fi | ||
} | ||
|
||
NO_FLY= | ||
|
@@ -45,33 +46,35 @@ usage() { | |
} | ||
|
||
open_pipeline() { | ||
url=$(show_pipeline_url) | ||
url=$(show_pipeline_url) | ||
cleanup | ||
if [[ -x /usr/bin/open ]]; then | ||
exec /usr/bin/open "$url" | ||
else | ||
echo "Sorry, but I was not able to automagically open" | ||
echo "your Concourse Pipeline in the browser." | ||
echo | ||
echo "Here's a link you can click on, though:" | ||
echo | ||
echo " $url" | ||
echo | ||
exit 0; | ||
fi | ||
if [[ -x /usr/bin/open ]]; then | ||
exec /usr/bin/open "${url}" | ||
else | ||
echo "Sorry, but I was not able to automagically open" | ||
echo "your Concourse Pipeline in the browser." | ||
echo | ||
echo "Here's a link you can click on, though:" | ||
echo | ||
echo " ${url}" | ||
echo | ||
exit 0; | ||
fi | ||
} | ||
|
||
show_pipeline_url() { | ||
spruce merge --skip-eval pipeline.yml ${settings_file} > .deploy.yml | ||
concourse_url=$(spruce json .deploy.yml | jq -r ".meta.url") | ||
team=$(spruce json .deploy.yml | jq -r ".meta.team // \"main\"") | ||
pipeline=$(spruce merge --skip-eval \ | ||
--cherry-pick meta.pipeline \ | ||
--cherry-pick meta.name \ | ||
.deploy.yml | spruce merge - | spruce json | jq -r ".meta.pipeline") | ||
|
||
echo "$concourse_url/teams/$team/pipelines/$pipeline" | ||
exit 0 | ||
spruce merge --skip-eval pipeline.yml ${settings_file} > .deploy.yml | ||
concourse_url=$(spruce json .deploy.yml | jq -r ".meta.url") | ||
team=$(spruce json .deploy.yml | jq -r ".meta.team // \"main\"") | ||
pipeline=$( | ||
spruce merge --skip-eval \ | ||
--cherry-pick meta.pipeline \ | ||
--cherry-pick meta.name \ | ||
.deploy.yml \ | ||
| spruce merge - | spruce json | jq -r ".meta.pipeline" | ||
) | ||
echo "${concourse_url}/teams/${team}/pipelines/${pipeline}" | ||
exit 0 | ||
} | ||
|
||
for arg do | ||
|
@@ -90,16 +93,16 @@ for arg do | |
esac | ||
done | ||
|
||
cd $(dirname $BASH_SOURCE[0]) | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
echo >&2 "Working in $(pwd)" | ||
need_command spruce | ||
|
||
# Allow for target-specific settings | ||
settings_file="$(ls -1 settings.yml ${CONCOURSE_TARGET:+"settings-${CONCOURSE_TARGET}.yml"} 2>/dev/null | head -n1)" | ||
if [[ -z "$settings_file" ]] | ||
if [[ -z "${settings_file}" ]] | ||
then | ||
echo >&2 "Missing local settings in ci/settings.yml${CONCOURSE_TARGET:+" or ci/settings-${CONCOURSE_TARGET}.yml"}!" | ||
exit 1 | ||
echo >&2 "Missing local settings in ci/settings.yml${CONCOURSE_TARGET:+" or ci/settings-${CONCOURSE_TARGET}.yml"}!" | ||
exit 1 | ||
fi | ||
|
||
echo >&2 "Using settings found in ${settings_file}" | ||
|
@@ -113,26 +116,26 @@ trap "cleanup" QUIT TERM EXIT INT | |
spruce merge pipeline.yml ${settings_file} > .deploy.yml | ||
PIPELINE=$(spruce json .deploy.yml | jq -r '.meta.pipeline // ""') | ||
if [[ -z ${PIPELINE} ]]; then | ||
echo >&2 "Missing pipeline name in ci/settings.yml!" | ||
exit 1 | ||
echo >&2 "Missing pipeline name in ci/settings.yml!" | ||
exit 1 | ||
fi | ||
|
||
TARGET_FROM_SETTINGS=$(spruce json .deploy.yml | jq -r '.meta.target // ""') | ||
if [[ -z ${CONCOURSE_TARGET} ]]; then | ||
TARGET=${TARGET_FROM_SETTINGS} | ||
elif [[ "$CONCOURSE_TARGET" != "$TARGET_FROM_SETTINGS" ]] | ||
TARGET=${TARGET_FROM_SETTINGS} | ||
elif [[ "${CONCOURSE_TARGET}" != "${TARGET_FROM_SETTINGS}" ]] | ||
then | ||
echo >&2 "Target in {$settings_file} differs from target in \$CONCOURSE_TARGET" | ||
echo >&2 " \$CONCOURSE_TARGET: $CONCOURSE_TARGET" | ||
echo >&2 " Target in file: $TARGET_FROM_SETTINGS" | ||
exit 1 | ||
echo >&2 "Target in {${settings_file}} differs from target in \$CONCOURSE_TARGET" | ||
echo >&2 " \$CONCOURSE_TARGET: ${CONCOURSE_TARGET}" | ||
echo >&2 " Target in file: ${TARGET_FROM_SETTINGS}" | ||
exit 1 | ||
else | ||
TARGET=${CONCOURSE_TARGET} | ||
TARGET=${CONCOURSE_TARGET} | ||
fi | ||
|
||
if [[ -z ${TARGET} ]]; then | ||
echo >&2 "Missing Concourse Target in ci/settings.yml!" | ||
exit 1 | ||
echo >&2 "Missing Concourse Target in ci/settings.yml!" | ||
exit 1 | ||
fi | ||
|
||
fly_cmd="${FLY_CMD:-fly}" | ||
|
@@ -146,6 +149,6 @@ case "${VALIDATE_PIPELINE}" in | |
esac | ||
|
||
set +x | ||
$fly_cmd --target ${TARGET} ${fly_opts} --config .deploy.yml | ||
${fly_cmd} --target ${TARGET} ${fly_opts} --config .deploy.yml | ||
[[ -n ${VALIDATE_PIPELINE} ]] && exit 0 | ||
$fly_cmd --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE} | ||
${fly_cmd} --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE} |
Oops, something went wrong.