Skip to content

Commit 5ee4a96

Browse files
committed
CI: remove light-aws-builder specs, use binary from image.
These specs moved to that pipeline, and the docker image now contains the `light-aws-builder` binary.
1 parent 0488435 commit 5ee4a96

13 files changed

Lines changed: 68 additions & 463 deletions

ci/pipelines/publisher.yml

Lines changed: 15 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,31 @@
33
#@yaml/text-templated-strings
44
---
55

6-
#@ def build_light_aws_stemcell_new(stemcell_os, stemcell_version, builder_src, input_stemcell, output_stemcell, prefix, region, bucket_prefix, tag, ami_destinations, efi, ami_excluded_destinations):
6+
#@ def build_light_aws_stemcell_new(stemcell_os, stemcell_version, prefix, efi, ami_destinations, ami_excluded_destinations):
77
do:
88
- in_parallel:
9-
- get: (@= input_stemcell @)
9+
- get: (@= prefix @)-input-stemcell
1010
params:
1111
include_files:
1212
- bosh-stemcell-*-aws-xen-hvm-(@= stemcell_os @)*.tgz
1313
resource: candidate-(@= stemcell_os @)-stemcell-(@= stemcell_version @)
1414
trigger: true
1515
version: every
16-
#@ if tag != "":
17-
tags:
18-
- (@= tag @)
19-
#@ end
20-
- get: (@= builder_src @)
21-
passed:
22-
- test-aws-unit
23-
- test-aws-integration
24-
- test-aws-drivers
25-
resource: light-aws-builder-src
26-
#@ if tag != "":
27-
tags:
28-
- (@= tag @)
29-
#@ end
30-
- task: build-(@= region @)-stemcell
16+
- get: light-aws-builder-src
17+
- task: build-(@= prefix @)-stemcell
3118
file: bosh-stemcells-ci/ci/tasks/light-aws/build.yml
3219
image: light-stemcell-builder-registry-image
3320
input_mapping:
34-
builder-src: (@= builder_src @)
35-
input-stemcell: (@= input_stemcell @)
21+
builder-src: light-aws-builder-src
22+
input-stemcell: (@= prefix @)-input-stemcell
3623
output_mapping:
37-
light-stemcell: (@= output_stemcell @)
24+
light-stemcell: (@= prefix @)-light-stemcell
3825
params:
3926
AWS_PAGER:
4027
ami_access_key: ((aws_publish_(@= prefix @)_access_key))
4128
ami_secret_key: ((aws_publish_(@= prefix @)_secret_key))
42-
ami_region: ((aws_publish_(@= region @)_region))
43-
ami_bucket_name: ((aws_publish_(@= bucket_prefix @)_bucket))
29+
ami_region: ((aws_publish_(@= prefix @)_region))
30+
ami_bucket_name: ((aws_publish_(@= prefix @)_bucket))
4431
ami_description: Light Stemcell Builder Prod AMI
4532
#@ if ami_destinations != "":
4633
ami_destinations: (@= ami_destinations @)
@@ -55,10 +42,6 @@ do:
5542
ami_visibility: public
5643
S3_API_ENDPOINT: storage.googleapis.com
5744
efi: (@= str(efi).lower() @)
58-
#@ if tag != "":
59-
tags:
60-
- (@= tag @)
61-
#@ end
6245
#@ end
6346

6447
#@yaml/text-templated-strings
@@ -102,9 +85,6 @@ anchors:
10285
groups:
10386
- name: all
10487
jobs:
105-
- test-aws-unit
106-
- test-aws-drivers
107-
- test-aws-integration
10888
- build-light-aws-(@= data.values.stemcell_details.os_name @)-(@= str(data.values.stemcell_details.major_version) @)
10989
- build-light-google-(@= data.values.stemcell_details.os_name @)-(@= str(data.values.stemcell_details.major_version) @)
11090
- publish-(@= data.values.stemcell_details.os_name @)-(@= str(data.values.stemcell_details.major_version) @)
@@ -120,7 +100,6 @@ groups:
120100
- publish-(@= data.values.stemcell_details.os_name @)-(@= str(data.values.stemcell_details.major_version) @)
121101
- name: cleanup-aws-light-stemcells
122102
jobs:
123-
- cleanup-light-aws-builder-test-amis
124103
- cleanup-published-aws-light-stemcells-older-than-three-years
125104
- cleanup-unpublished-(@= data.values.stemcell_details.os_name @)-aws-light-stemcells
126105

@@ -145,101 +124,17 @@ jobs:
145124
- #@ cleanup_unpublished_light_stemcells("us-gov", "us-gov")
146125
#!- #@ cleanup_unpublished_light_stemcells("cn", "cn_north")
147126

148-
- name: test-aws-unit
149-
plan:
150-
- get: bosh-stemcells-ci
151-
- get: bosh-integration-registry-image
152-
- get: builder-src
153-
resource: light-aws-builder-src
154-
trigger: true
155-
- file: bosh-stemcells-ci/ci/tasks/light-aws/test-unit.yml
156-
image: bosh-integration-registry-image
157-
task: test
158-
serial: true
159-
160-
- name: test-aws-drivers
161-
plan:
162-
- get: bosh-stemcells-ci
163-
- get: bosh-integration-registry-image
164-
- get: builder-src
165-
resource: light-aws-builder-src
166-
trigger: true
167-
- file: bosh-stemcells-ci/ci/tasks/light-aws/test-drivers.yml
168-
image: bosh-integration-registry-image
169-
params:
170-
AWS_PAGER:
171-
aws_account_id: ((aws_test_account_id))
172-
access_key: ((aws_test_access_key))
173-
secret_key: ((aws_test_secret_key))
174-
bucket_name: ((aws_test_bucket_name))
175-
copy_region: ((aws_test_copy_region))
176-
region: ((aws_test_region))
177-
ami_fixture_id: ((aws_test_ami_fixture_id))
178-
private_ami_fixture_id: ((aws_test_private_ami_fixture_id))
179-
existing_snapshot_id: ((aws_test_snapshot_fixture_id))
180-
existing_volume_id: ((aws_test_volume_fixture_id))
181-
#! kms key id should be the one created in the region of "copy_region"
182-
kms_key_id: ((aws_test_kms_key_id))
183-
kms_multi_region_key: ((aws_test_kms_multi_region_key_id))
184-
kms_multi_region_key_replication_test: ((aws_test_kms_multi_region_replication_test_key_id))
185-
uploaded_machine_image_url: https://stemcell-test-publish.s3.eu-central-1.amazonaws.com/fixtures/root.img
186-
task: test
187-
attempts: 3
188-
serial: true
189-
190-
- name: test-aws-integration
191-
plan:
192-
- get: bosh-stemcells-ci
193-
- get: bosh-integration-registry-image
194-
- get: builder-src
195-
resource: light-aws-builder-src
196-
trigger: true
197-
- file: bosh-stemcells-ci/ci/tasks/light-aws/test-integration.yml
198-
image: bosh-integration-registry-image
199-
params:
200-
AWS_PAGER:
201-
access_key: ((aws_test_access_key))
202-
secret_key: ((aws_test_secret_key))
203-
bucket_name: ((aws_test_bucket_name))
204-
#! cn_access_key: ((test__cn_access_key))
205-
#! cn_bucket_name: ((test__cn_bucket_name))
206-
#! cn_region: ((test__cn_region))
207-
#! cn_secret_key: ((test__cn_secret_key))
208-
copy_region: ((aws_test_copy_region))
209-
region: ((aws_test_region))
210-
211-
task: test
212-
serial: true
213-
214-
- name: cleanup-light-aws-builder-test-amis
215-
plan:
216-
- get: every-week-on-monday
217-
trigger: true
218-
- get: bosh-stemcells-ci
219-
- get: bosh-integration-registry-image
220-
- task: cleanup-aws-test-amis
221-
file: bosh-stemcells-ci/ci/tasks/light-aws/cleanup-ami.yml
222-
image: bosh-integration-registry-image
223-
params:
224-
AWS_PAGER:
225-
ami_access_key: ((aws_test_access_key))
226-
ami_secret_key: ((aws_test_secret_key))
227-
ami_region: ((aws_test_region))
228-
ami_older_than_days: 1
229-
ami_keep_latest: 0
230-
snapshot_id: ((aws_test_snapshot_fixture_id))
231-
232127
- name: build-light-aws-(@= data.values.stemcell_details.os_name @)-(@= str(data.values.stemcell_details.major_version) @)
233128
plan:
234129
- get: bosh-stemcells-ci
235-
- get: light-stemcell-builder-registry-image
130+
- get: aws-light-stemcell-builder-registry-image
236131
- get: bosh-integration-registry-image
237132
- in_parallel:
238133
- do:
239-
- #@ build_light_aws_stemcell_new(data.values.stemcell_details.os_name, str(data.values.stemcell_details.major_version), "us-gov-builder-src", "us-gov-input-stemcell", "us-gov-light-stemcell", "us-gov", "us-gov", "us-gov", "", "", data.values.stemcell_details.use_efi, "")
240-
- #@ build_light_aws_stemcell_new(data.values.stemcell_details.os_name, str(data.values.stemcell_details.major_version), "us-builder-src", "us-input-stemcell", "us-light-stemcell", "us", "us", "us", "", "", data.values.stemcell_details.use_efi, '["me-central-1"]')
134+
- #@ build_light_aws_stemcell_new(data.values.stemcell_details.os_name, str(data.values.stemcell_details.major_version), "us-gov", data.values.stemcell_details.use_efi, "", "")
135+
- #@ build_light_aws_stemcell_new(data.values.stemcell_details.os_name, str(data.values.stemcell_details.major_version), "us", data.values.stemcell_details.use_efi, "", '["me-central-1"]')
241136
- file: bosh-stemcells-ci/ci/tasks/light-aws/us-gov-merge-builds.yml
242-
image: light-stemcell-builder-registry-image
137+
image: aws-light-stemcell-builder-registry-image
243138
input_mapping:
244139
builder-src: us-builder-src
245140
task: merge-builds
@@ -334,12 +229,11 @@ jobs:
334229
- get: bosh-stemcells-ci
335230
- get: bosh-cpi-release
336231
resource: bosh-google-cpi-release
337-
- get: light-stemcell-builder-registry-image
338232
- get: gce-cpi-release-registry-image
339233
- get: bosh-integration-registry-image
340234
- task: make-raw-from-heavy-stemcell
341235
file: bosh-stemcells-ci/ci/tasks/light-google/make-raw-from-heavy-stemcell.yml
342-
image: light-stemcell-builder-registry-image
236+
image: gce-cpi-release-registry-image
343237
params:
344238
BUCKET_NAME: bosh-gce-raw-stemcells-new
345239
STEMCELL_BUCKET_PATH: bosh-gce-light-stemcells
@@ -854,7 +748,7 @@ resources:
854748
username: ((github_read_write_packages.username))
855749
password: ((github_read_write_packages.password))
856750

857-
- name: light-stemcell-builder-registry-image
751+
- name: aws-light-stemcell-builder-registry-image
858752
type: registry-image
859753
source:
860754
repository: bosh/light-stemcell-builder

ci/tasks/light-aws/build.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ ami_kms_key_id=${ami_kms_key_id:-}
1414
ami_server_side_encryption=${ami_server_side_encryption:-}
1515
ami_excluded_destinations=${ami_excluded_destinations:-}
1616

17-
: ${bosh_io_bucket_name:?}
18-
: ${ami_description:?}
19-
: ${ami_virtualization_type:?}
20-
: ${ami_visibility:?}
21-
: ${ami_region:?}
22-
: ${ami_access_key:?}
23-
: ${ami_secret_key:?}
24-
: ${ami_bucket_name:?}
25-
: ${ami_encrypted:?}
26-
: ${efi:?}
17+
: "${bosh_io_bucket_name:?}"
18+
: "${ami_description:?}"
19+
: "${ami_virtualization_type:?}"
20+
: "${ami_visibility:?}"
21+
: "${ami_region:?}"
22+
: "${ami_access_key:?}"
23+
: "${ami_secret_key:?}"
24+
: "${ami_bucket_name:?}"
25+
: "${ami_encrypted:?}"
26+
: "${efi:?}"
2727

2828
export AWS_ACCESS_KEY_ID=$ami_access_key
2929
export AWS_SECRET_ACCESS_KEY=$ami_secret_key
@@ -38,7 +38,7 @@ if [[ -n "${ami_excluded_destinations}" ]]; then
3838
| jq --argjson exclude "$ami_excluded_destinations" '. - $exclude' -c )"
3939
fi
4040

41-
: ${ami_destinations:=$saved_ami_destinations}
41+
: "${ami_destinations:=$saved_ami_destinations}"
4242

4343
stemcell_path=$(ls "${REPO_PARENT}"/input-stemcell/*.tgz)
4444
version=$(cat "${REPO_PARENT}/input-stemcell/.resource/version")
@@ -70,7 +70,7 @@ echo " Copy regions: ${ami_destinations}"
7070

7171
export CONFIG_PATH="${REPO_PARENT}/config.json"
7272

73-
cat > $CONFIG_PATH << EOF
73+
cat > "${CONFIG_PATH}" << EOF
7474
{
7575
"ami_configuration": {
7676
"description": "$ami_description",
@@ -96,14 +96,14 @@ cat > $CONFIG_PATH << EOF
9696
EOF
9797

9898
extracted_stemcell_dir="${REPO_PARENT}/extracted-stemcell"
99-
mkdir -p ${extracted_stemcell_dir}
100-
tar -C ${extracted_stemcell_dir} -xf ${stemcell_path}
101-
tar -xf ${extracted_stemcell_dir}/image
99+
mkdir -p "${extracted_stemcell_dir}"
100+
tar -C "${extracted_stemcell_dir}" -xf "${stemcell_path}"
101+
tar -xf "${extracted_stemcell_dir}"/image
102102

103103
# image format can be raw or stream optimized vmdk
104104
stemcell_image="$(echo "${REPO_PARENT}"/root.*)"
105105
stemcell_manifest=${extracted_stemcell_dir}/stemcell.MF
106-
manifest_contents="$(cat ${stemcell_manifest})"
106+
manifest_contents="$(cat "${stemcell_manifest}")"
107107

108108
disk_regex="disk: ([0-9]+)"
109109
format_regex="disk_format: ([a-z]+)"
@@ -122,20 +122,20 @@ disk_format="${BASH_REMATCH[1]}"
122122

123123
pushd "${REPO_PARENT}/builder-src" > /dev/null
124124
# Make sure we've closed the manifest file before writing to it
125-
go run main.go \
126-
-c $CONFIG_PATH \
127-
--image ${stemcell_image} \
128-
--format ${disk_format} \
129-
--volume-size ${disk_size_gb} \
130-
--manifest ${stemcell_manifest} \
125+
# see https://github.com/cloudfoundry/bosh-aws-light-stemcell-builder/blob/master/ci/docker/Dockerfile#L30
126+
light-stemcell-builder \
127+
-c "${CONFIG_PATH}" \
128+
--image "${stemcell_image}" \
129+
--format "${disk_format}" \
130+
--volume-size "${disk_size_gb}" \
131+
--manifest "${stemcell_manifest}" \
131132
| tee tmp-manifest
132133

133-
mv tmp-manifest ${stemcell_manifest}
134-
134+
mv tmp-manifest "${stemcell_manifest}"
135135
popd
136136

137-
pushd ${extracted_stemcell_dir}
138-
> image
137+
pushd "${extracted_stemcell_dir}"
138+
touch image
139139
# the bosh cli sees the stemcell as invalid if tar contents have leading ./
140140
tar -czf "${REPO_PARENT}/light-stemcell/${light_stemcell_name}" *
141141
popd

0 commit comments

Comments
 (0)