Skip to content

Commit 027c3b2

Browse files
committed
[#154735316] Refactor bosh-upload-stemcell-from-cf-deployment to bosh-upload-stemcells
- The old task name didn't quite make sense when multiple stemcells could be added from outside cf-deployment. - The old task has been symlinked to the new task.
1 parent 7e31bf0 commit 027c3b2

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bosh-upload-stemcells/

bosh-upload-stemcell-from-cf-deployment/task renamed to bosh-upload-stemcells/task

+10-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ upload_stemcell() {
3434
# Hardcode a couple of stable stemcell paramaters
3535
local stemcells_url
3636
stemcells_url="https://bosh.io/d/stemcells"
37+
38+
# Ask bosh if it already has our OS / version stemcell combination
39+
# As of this writing, the new bosh cli doesn't have --skip-if-exists
40+
set +e
41+
local existing_stemcell
42+
existing_stemcell=$(bosh stemcells | grep "${os}" | awk '{print $2}' | tr -d "\*" | grep ^"${version}"$ )
43+
set -e
3744

3845
local stemcell_name
3946

@@ -61,7 +68,7 @@ upload_stemcell() {
6168
# If bosh already has our stemcell, exit 0
6269
if [ "${existing_stemcell}" ]; then
6370
echo "Task bosh-upload-stemcell-from-cf-deployment:"
64-
echo "Stemcell '${stemcell_name}/${version}' already exists. Exiting..."
71+
echo "Stemcell '${stemcell_name}/${version}' already exists. Skipping..."
6572
return
6673
fi
6774

@@ -82,9 +89,9 @@ upload_stemcell() {
8289

8390
function upload_stemcells() {
8491
local arguments=''
85-
for op in ${OPS_FILES_WITH_STEMCELLS}
92+
for op in ${OPS_FILES}
8693
do
87-
arguments="${arguments} -o stemcells-ops-files/${op}"
94+
arguments="${arguments} -o ops-files/${op}"
8895
done
8996

9097
bosh interpolate ${arguments} cf-deployment/${MANIFEST_FILE} > /tmp/cf.yml

bosh-upload-stemcell-from-cf-deployment/task.yml renamed to bosh-upload-stemcells/task.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ inputs:
1111
- name: cf-deployment-concourse-tasks # - This repo
1212
- name: cf-deployment # - The cf-deployment manifest
1313
- name: bbl-state # - The repo containing the Director's bbl state dir
14-
- name: stemcells-ops-files # - Stemcells operations files to be made available
14+
- name: ops-files # - Oplitonal operations files to be made available
1515
optional: true
1616

1717
run:
18-
path: cf-deployment-concourse-tasks/bosh-upload-stemcell-from-cf-deployment/task
18+
path: cf-deployment-concourse-tasks/bosh-upload-stemcells/task
1919

2020
params:
2121
BBL_STATE_DIR: bbl-state
@@ -34,8 +34,10 @@ params:
3434
# - Filepath to the manifest file within the cf-deployment resource
3535
# - The path is relative to root of the `cf-deployment` input
3636

37-
OPS_FILES_WITH_STEMCELLS:
37+
OPS_FILES:
3838
# - Optional
39-
# - List of operations files that contain additional stemcells to be uploaded
39+
# - List of operations files to be applied to the manifest.
40+
# - Additional stemcells specified by operations will also be uploaded.
4041
# - Quoted and space-separated
41-
# - Paths are relative to root of the `stemcell-ops-files` input
42+
# - Ops will be applied in the order they're listed
43+
# - Paths are relative to root of the `ops-files` input

0 commit comments

Comments
 (0)