Skip to content

Commit 1d4df67

Browse files
committed
Updated latest ci templates
1 parent 508b04e commit 1d4df67

3 files changed

Lines changed: 46 additions & 39 deletions

File tree

ci/pipeline.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
meta:
1616
name: (( param "Please name your pipeline" ))
17+
release: (( grab meta.name ))
1718
target: (( param "Please identify the name of the target Concourse CI" ))
1819
url: (( param "Please specify the full url of the target Concourse CI" ))
1920
pipeline: (( grab meta.name ))
@@ -39,7 +40,7 @@ meta:
3940

4041
slack:
4142
webhook: (( param "Please specify your Slack Incoming Webhook Integration URL" ))
42-
notification: '(( concat ":concourse-fail: <" meta.url "/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME| Failed to build " meta.name "! Click for details.>" ))'
43+
notification: '(( concat ":concourse-fail: <" meta.url "/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME| Failed to build " meta.name "! Click for details.>" ))'
4344
channel: (( param "Please specify the channel (#name) or user (@user) to send messages to" ))
4445
username: concourse
4546
icon: http://cl.ly/image/3e1h0H3H2s0P/concourse-logo.png
@@ -106,38 +107,32 @@ jobs:
106107
params:
107108
REPO_ROOT: git
108109
RELEASE_ROOT: gh
110+
RELEASE_NAME: (( grab meta.release ))
109111
REPO_OUT: pushme/git
110112
VERSION_FROM: version/number
111113

112114
- put: latest # as 'latest'
113115
params:
114-
load_base: edge
115-
load_file: edge/image
116-
load_repository: (( grab meta.dockerhub.repository ))
117-
load_tag: edge
116+
load: edge
118117

119118
- put: latest # as 'vX.Y.Z'
120119
params:
121120
tag: version/number
122121
tag_prefix: v
123-
load_base: edge
124-
load_file: edge/image
125-
load_repository: (( grab meta.dockerhub.repository ))
126-
load_tag: edge
122+
load: edge
127123

128-
- aggregate:
129-
- put: version
130-
params:
131-
bump: patch
132-
- put: git
133-
params:
134-
rebase: true
135-
repository: pushme/git
136-
- put: github
137-
params:
138-
name: gh/name
139-
tag: gh/tag
140-
body: gh/notes.md
124+
- put: version
125+
params:
126+
bump: patch
127+
- put: git
128+
params:
129+
rebase: true
130+
repository: pushme/git
131+
- put: github
132+
params:
133+
name: gh/name
134+
tag: gh/tag
135+
body: gh/notes.md
141136

142137
resource_types:
143138
- name: slack-notification
@@ -173,7 +168,7 @@ resources:
173168
key: version
174169
access_key_id: (( grab meta.aws.access_key ))
175170
secret_access_key: (( grab meta.aws.secret_key ))
176-
initial_version: (( grab meta.initial_version || 0.0.1 ))
171+
initial_version: (( grab meta.initial_version || "0.0.1" ))
177172

178173
- name: notify
179174
type: slack-notification

ci/repipe

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,45 @@ cd $(dirname $BASH_SOURCE[0])
2525
echo "Working in $(pwd)"
2626
need_command spruce
2727

28-
if [[ -z "$VAULT_ADDR" ]] ; then
29-
echo >&2 "Vault address not specified in VAULT_ADDR environment variable"
30-
exit 1
28+
# Allow for target-specific settings
29+
settings_file="$(ls -1 settings.yml ${CONCOURSE_TARGET:+"settings-${CONCOURSE_TARGET}.yml"} 2>/dev/null | tail -n1)"
30+
if [[ -z "$settings_file" ]]
31+
then
32+
echo >&2 "Missing local settings in ci/settings.yml${CONCOURSE_TARGET:+" or ci/settings-${CONCOURSE_TARGET}.yml"}!"
33+
exit 1
3134
fi
3235

33-
if [[ ! -f settings.yml ]]; then
34-
echo >&2 "Missing local settings in ci/settings.yml!"
35-
exit 1
36-
fi
36+
echo >&2 "Using settings found in ${settings_file}"
3737

3838
set -e
3939
trap "rm -f .deploy.yml" QUIT TERM EXIT INT
40-
spruce merge pipeline.yml settings.yml > .deploy.yml
40+
spruce merge pipeline.yml ${settings_file} > .deploy.yml
4141
PIPELINE=$(spruce json .deploy.yml | jq -r '.meta.pipeline // ""')
4242
if [[ -z ${PIPELINE} ]]; then
4343
echo >&2 "Missing pipeline name in ci/settings.yml!"
4444
exit 1
4545
fi
46-
[ -n ${CONCOURSE_TARGET} ] && TARGET=${CONCOURSE_TARGET}
47-
if [[ -z ${TARGET} ]]; then
48-
TARGET=$(spruce json .deploy.yml | jq -r '.meta.target // ""')
46+
47+
TARGET_FROM_SETTINGS=$(spruce json .deploy.yml | jq -r '.meta.target // ""')
48+
if [[ -z ${CONCOURSE_TARGET} ]]; then
49+
TARGET=${TARGET_FROM_SETTINGS}
50+
elif [[ "$CONCOURSE_TARGET" != "$TARGET_FROM_SETTINGS" ]]
51+
then
52+
echo >&2 "Target in {$settings_file} differs from target in \$CONCOURSE_TARGET"
53+
echo >&2 " \$CONCOURSE_TARGET: $CONCOURSE_TARGET"
54+
echo >&2 " Target in file: $TARGET_FROM_SETTINGS"
55+
exit 1
56+
else
57+
TARGET=${CONCOURSE_TARGET}
4958
fi
59+
5060
if [[ -z ${TARGET} ]]; then
5161
echo >&2 "Missing Concourse Target in ci/settings.yml!"
5262
exit 1
5363
fi
5464

65+
fly_cmd="${FLY_CMD:-fly}"
66+
5567
set +x
56-
fly --target ${TARGET} set-pipeline --pipeline ${PIPELINE} --config .deploy.yml
57-
fly --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE}
68+
$fly_cmd --target ${TARGET} set-pipeline --pipeline ${PIPELINE} --config .deploy.yml
69+
$fly_cmd --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE}

ci/scripts/release

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ if [[ -z ${VERSION} ]]; then
3030
exit 2
3131
fi
3232

33-
echo "v${VERSION}" > ${RELEASE_ROOT}/tag
34-
echo "Slack Notification Resource v${VERSION}" > ${RELEASE_ROOT}/name
35-
mv ${REPO_ROOT}/ci/release_notes.md ${RELEASE_ROOT}/notes.md
33+
echo "v${VERSION}" > ${RELEASE_ROOT}/tag
34+
echo "${RELEASE_NAME} v${VERSION}" > ${RELEASE_ROOT}/name
35+
mv ${REPO_ROOT}/ci/release_notes.md ${RELEASE_ROOT}/notes.md
3636

3737
# GIT!
3838
if [[ -z $(git config --global user.email) ]]; then

0 commit comments

Comments
 (0)