11version : 2.1
22
3- # orbs:
4- # slack: circleci/slack@4.4.2
5-
63jobs :
74 install :
85 machine :
@@ -109,7 +106,7 @@ jobs:
109106 root :
110107 /tmp/workspace
111108 paths :
112- - repo/target/coverage
109+ - repo/target/coverage/
113110 - store_test_results :
114111 path : target/reports/
115112
@@ -126,7 +123,7 @@ jobs:
126123 DEBUG : 1
127124 SQS_PROVIDER : " elasticmq"
128125 TEST_PATH : " tests/integration/test_sns.py -k test_publish_sqs_from_sns_with_xray_propagation"
129- PYTEST_ARGS : " --junitxml=target/reports/elasticmq.xml -o junit_suite_name='elasticmq'"
126+ PYTEST_ARGS : " --reruns 3 -- junitxml=target/reports/elasticmq.xml -o junit_suite_name='elasticmq'"
130127 COVERAGE_ARGS : " -p"
131128 command : make test-coverage
132129 - run :
@@ -136,117 +133,88 @@ jobs:
136133 root :
137134 /tmp/workspace
138135 paths :
139- - repo/target/coverage
140- - store_test_results :
141- path : target/reports/
142-
143- docker-build-amd64 :
144- machine :
145- image : ubuntu-2004:202107-02
146- working_directory : /tmp/workspace/repo
147- steps :
148- - attach_workspace :
149- at : /tmp/workspace
150- - run :
151- name : Initialize build environment
152- command : make init
153- - run :
154- name : Build localstack docker image
155- command : make docker-build-linux-amd64
156- - run :
157- name : Output the Image Stats
158- command : make docker-image-stats
159- - run :
160- name : Run the tests
161- command : |
162- PYTEST_ARGS='--junitxml=target/reports/test-report-amd64.xml' \
163- COVERAGE_FILE='target/coverage/.coverage.amd64' \
164- make docker-run-tests
165- - run :
166- name : Save docker image
167- command : |
168- test "$CIRCLE_BRANCH" = "master" \
169- && PLATFORM="amd64" make docker-save-image || true
170- - run :
171- name : Build light docker image
172- command : |
173- test "$CIRCLE_BRANCH" = "master" \
174- && make docker-build-linux-amd64-light || true
175- - run :
176- name : Save light docker image
177- command : |
178- test "$CIRCLE_BRANCH" = "master" \
179- && PLATFORM="amd64" make docker-save-image-light || true
180- - persist_to_workspace :
181- root :
182- /tmp/workspace
183- paths :
184- - repo
136+ - repo/target/coverage/
185137 - store_test_results :
186138 path : target/reports/
187139
188- docker-build-arm64 :
140+ docker-build :
141+ parameters :
142+ platform :
143+ description : " Platform to build for"
144+ default : " amd64"
145+ type : string
146+ machine_image :
147+ description : " CircleCI machine type to run at"
148+ default : " ubuntu-2004:202107-02"
149+ type : string
150+ resource_class :
151+ description : " CircleCI machine type to run at"
152+ default : " medium"
153+ type : string
189154 machine :
190- # The latest version of ubuntu is not yet supported for ARM: https://circleci.com/docs/2.0/arm-resources/
191- image : ubuntu-2004:202101-01
192- resource_class : arm.medium
155+ image : << parameters.machine_image >>
156+ docker_layer_caching : true
157+ resource_class : << parameters.resource_class >>
193158 working_directory : /tmp/workspace/repo
194159 steps :
195160 - attach_workspace :
196161 at : /tmp/workspace
197- - run :
198- # Since we are using an old version of ubuntu, we need to install the latest version of docker
199- name : Update docker engine to most current
200- command : |
201- # Remove old version
202- sudo apt-get remove --purge docker docker-engine docker.io containerd runc -y
203- # Install Docker deb package repo
204- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
205- sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
206- echo "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
207- | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
208- sudo apt-get update
209- # Install the latest version of Docker and haveged
210- # (https://github.com/docker/compose/issues/6678#issuecomment-526831488)
211- sudo apt-get install docker-ce docker-ce-cli containerd.io haveged -y
212- sudo usermod -aG docker $USER
213- - run :
214- name : Build localstack docker image
215- command : make docker-build-linux-arm64
216- - run :
217- name : Output the Image Stats
218- command : make docker-image-stats
219- - run :
220- name : Install amd64 emulation support for lambda tests
221- command : |
222- docker run --rm --privileged tonistiigi/binfmt:latest --install all
223- docker buildx create --name multiarch-builder --use
224- - run :
225- name : Run the tests
162+ - when :
163+ condition :
164+ equal : [ arm64, << parameters.platform >> ]
165+ steps :
166+ - run :
167+ # Since we are using an old version of ubuntu, we need to install the latest version of docker
168+ name : Update docker engine to most current
169+ command : |
170+ # Remove old version
171+ sudo apt-get remove --purge docker docker-engine docker.io containerd runc -y
172+ # Install Docker deb package repo
173+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
174+ sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
175+ echo "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
176+ | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
177+ sudo apt-get update
178+ # Install the latest version of Docker and haveged
179+ # (https://github.com/docker/compose/issues/6678#issuecomment-526831488)
180+ sudo apt-get install docker-ce docker-ce-cli containerd.io haveged -y
181+ sudo usermod -aG docker $USER
182+ - run :
183+ # Install the emulation support before starting to build (resets the build cache)
184+ name : Install amd64 emulation support for lambda tests
185+ command : |
186+ docker run --rm --privileged tonistiigi/binfmt:latest --install all
187+ docker buildx create --name multiarch-builder --use
188+ - run :
189+ name : Build full docker image
190+ command : make docker-build
191+ - run :
192+ name : Run tests
226193 command : |
227- PYTEST_ARGS='--junitxml=target/reports/test-report-arm64 .xml' \
228- COVERAGE_FILE='target/coverage/.coverage.arm64 ' \
194+ PYTEST_ARGS='--junitxml=target/reports/test-report-<< parameters.platform >> .xml' \
195+ COVERAGE_FILE='target/coverage/.coverage.<< parameters.platform >> ' \
229196 make docker-run-tests
230- - run :
231- name : Save docker image
232- command : |
233- test "$CIRCLE_BRANCH" = "master" \
234- && PLATFORM="arm64" make docker-save-image || true
235- - run :
236- name : Build light docker image
237- command : |
238- test "$CIRCLE_BRANCH" = "master" \
239- && make docker-build-linux-amd64-light || true
240- - run :
241- name : Save light docker image
242- command : |
243- test "$CIRCLE_BRANCH" = "master" \
244- && PLATFORM="arm64" make docker-save-image-light || true
197+ - when :
198+ condition :
199+ equal : [ master, << pipeline.git.branch >> ]
200+ steps :
201+ - run :
202+ name : Build light docker image
203+ command : make docker-build-light
204+ - run :
205+ name : Run pre-release smoke tests
206+ command : make ci-pro-smoke-tests
207+ - run :
208+ name : Save full docker image
209+ command : PLATFORM="<< parameters.platform >>" make docker-save-image
210+ - run :
211+ name : Save light docker image
212+ command : PLATFORM="<< parameters.platform >>" make docker-save-image-light
245213 - persist_to_workspace :
246214 root :
247215 /tmp/workspace
248216 paths :
249- - repo
217+ - repo/target/
250218 - store_test_results :
251219 path : target/reports/
252220
@@ -272,66 +240,41 @@ jobs:
272240 coverage report || true
273241 coverage html || true
274242 coveralls || true
275- # - slack/notify:
276- # event: pass
277- # template: basic_success_1
278243 - store_artifacts :
279244 path : htmlcov/
280245
281- docker-push-amd64 :
246+ docker-push :
282247 machine :
283248 image : ubuntu-2004:202107-02
284249 working_directory : /tmp/workspace/repo
285250 steps :
286251 - attach_workspace :
287252 at : /tmp/workspace
288253 - run :
289- name : Load docker image
254+ name : Load docker image - amd64/full
290255 command : docker load -i target/localstack-docker-image-amd64.tar
291256 - run :
292- name : Load docker image light
257+ name : Load docker image - amd64/ light
293258 command : docker load -i target/localstack-docker-image-light-amd64.tar
294259 - run :
295- name : Run pre-release smoke tests
296- command : make ci-pro-smoke-tests
297- - run :
298- name : Push docker image
260+ name : Push docker images - amd64
299261 command : PLATFORM="amd64" make docker-push-master
300-
301- docker-push-arm64 :
302- machine :
303- image : ubuntu-2004:202101-01
304- resource_class : arm.medium
305- working_directory : /tmp/workspace/repo
306- steps :
307- - attach_workspace :
308- at : /tmp/workspace
262+ # Load and push per architecture (load overwrites the previous ones)
309263 - run :
310- name : Load docker image
264+ name : Load docker image - arm64/full
311265 command : docker load -i target/localstack-docker-image-arm64.tar
312266 - run :
313- name : Load docker image light
267+ name : Load docker image - arm64/ light
314268 command : docker load -i target/localstack-docker-image-light-arm64.tar
315269 - run :
316- name : Run pre-release smoke tests
317- command : make ci-pro-smoke-tests
318- - run :
319- name : Push docker image
270+ name : Push docker images - arm64
320271 command : PLATFORM="arm64" make docker-push-master
321-
322- docker-create-manifests :
323- machine :
324- image : ubuntu-2004:202107-02
325- working_directory : /tmp/workspace/repo
326- steps :
327- - attach_workspace :
328- at : /tmp/workspace
329272 - run :
330- name : create multi-platform manifests
331- command : make docker-create-manifests
273+ name : Create multi-platform manifests - full
274+ command : make docker-create-push- manifests
332275 - run :
333- name : create multi-platform manifests light
334- command : make docker-create-manifests-light
276+ name : Create multi-platform manifests - light
277+ command : make docker-create-push- manifests-light
335278
336279workflows :
337280 main :
@@ -346,27 +289,29 @@ workflows:
346289 - itest-elasticmq :
347290 requires :
348291 - preflight
349- - docker-build-amd64 :
292+ - docker-build :
293+ name : docker-build-amd64
294+ platform : amd64
295+ machine_image : ubuntu-2004:202107-02
296+ resource_class : medium
350297 requires :
351298 - preflight
352- - docker-build-arm64 :
299+ - docker-build :
300+ name : docker-build-arm64
301+ platform : arm64
302+ # The latest version of ubuntu is not yet supported for ARM:
303+ # https://circleci.com/docs/2.0/arm-resources/
304+ machine_image : ubuntu-2004:202101-01
305+ resource_class : arm.medium
353306 requires :
354307 - preflight
355308 - report :
356309 requires :
357310 - itest-lambda-docker
358311 - itest-elasticmq
359312 - docker-build-amd64
360- - docker-push-amd64 :
361- filters :
362- branches :
363- only : master
364- requires :
365- - itest-lambda-docker
366- - itest-elasticmq
367- - docker-build-amd64
368313 - docker-build-arm64
369- - docker-push-arm64 :
314+ - docker-push :
370315 filters :
371316 branches :
372317 only : master
@@ -375,10 +320,3 @@ workflows:
375320 - itest-elasticmq
376321 - docker-build-amd64
377322 - docker-build-arm64
378- - docker-create-manifests :
379- filters :
380- branches :
381- only : master
382- requires :
383- - docker-push-amd64
384- - docker-push-arm64
0 commit comments