From aa3d78b1a2ba46905cef6355d30511ad205995b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 11 Oct 2023 12:53:40 +0200 Subject: [PATCH] Use arm docker executor instead of running docker manually Previously there were no docker executors for arm, so we had to use the machine ones. Now the same jobs can be reused for both architectures. --- .circleci/template.yml | 89 ++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 56 deletions(-) diff --git a/.circleci/template.yml b/.circleci/template.yml index edf6d7654b3..e23428ba90b 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -203,9 +203,14 @@ executors: - *elasticsearch_container - *cassandra_container - *cassandra_proxy_container - arm64: - machine: - image: ubuntu-2004:current + otp_26_arm64: + docker: + - image: *OTP26 + resource_class: arm.medium + otp_26_redis_arm64: + docker: + - image: *OTP26 + - *redis_container resource_class: arm.medium commands: fetch_build_packages: @@ -213,7 +218,7 @@ commands: - run: name: Install packages necessary for building command: | - $EXEC tools/circle-install-packages.sh \ + tools/circle-install-packages.sh \ 'libssl-dev unixodbc-dev unixodbc tdsodbc rsync zlib1g-dev' maybe_build_deps_and_cache: steps: @@ -274,7 +279,7 @@ commands: when: on_success command: | echo "Success!" - $EXEC ./rebar3 codecov analyze + ./rebar3 codecov analyze tools/circle-upload-codecov.sh run_small_tests: steps: @@ -282,11 +287,11 @@ commands: - run: name: Wait for redis command: | - $EXEC tools/wait-for-it.sh -p 6379 + tools/wait-for-it.sh -p 6379 - run: name: Run Small Tests command: | - $EXEC tools/test.sh -p small_tests -s true -e true + tools/test.sh -p small_tests -s true -e true run_docker_smoke_test: steps: - checkout @@ -394,7 +399,7 @@ commands: steps: - run: name: Prepare for cache - command: $EXEC bash -c 'echo $OTP_VERSION-$ARCH > otp_version' + command: bash -c 'echo $OTP_VERSION-$ARCH > otp_version' jobs: # ######################### @@ -415,16 +420,14 @@ jobs: command: tools/circle-build-and-push-docker.sh docker_smoke_test: - executor: otp_26 + executor: << parameters.executor >> + parameters: + executor: + type: executor steps: - setup_remote_docker - run_docker_smoke_test - docker_smoke_test_arm64: - executor: arm64 - steps: - - run_docker_smoke_test - docs_build_deploy: parallelism: 1 docker: @@ -477,23 +480,6 @@ jobs: pip3 install mike mike deploy $DOCS_TAG --remote git@github.com:esl/MongooseDocs.git --branch gh-pages --push --rebase - build_in_docker_arm64: - executor: arm64 - environment: - DOCKER_IMAGE: *OTP26 - EXEC: docker exec main - steps: - - run: docker run -dit --name main --rm -v `pwd`:`pwd` $DOCKER_IMAGE - - checkout - - prepare_for_cache - - restore_certs - - fetch_build_packages - - run: $EXEC tools/configure with-all - - run: $EXEC tools/build-releases.sh - - run: $EXEC make rel - - cache_prod_build: {arch: arm64} - - persist_workspace - build_in_docker: executor: << parameters.executor >> parameters: @@ -503,6 +489,10 @@ jobs: type: boolean description: When enabled, prod release will be generated besides the dev ones default: false + arch: + type: string + description: Target architecture + default: amd64 parallelism: 1 environment: SKIP_RELEASE: 1 @@ -522,7 +512,7 @@ jobs: condition: << parameters.build_prod >> steps: - run: make rel - - cache_prod_build: {arch: amd64} + - cache_prod_build: {arch: << parameters.arch >>} - run: name: Generate DOAP and Markdown files with supported XEPs command: make xeplist @@ -546,27 +536,6 @@ jobs: - upload_results_to_aws - publish_github_comment - small_tests_in_docker_arm64: - executor: arm64 - environment: - DOCKER_IMAGE: *OTP26 - EXEC: docker exec main - PRESET: small_tests - SKIP_AUTO_COMPILE: true - steps: - - run: - name: Run main docker image - command: | - docker run -dit -e PRESET -e SKIP_AUTO_COMPILE --name main --network host --rm \ - -v `pwd`:`pwd` $DOCKER_IMAGE - - run: - name: Run redis docker image - command: | - docker run -dit --name redis --network host --rm redis:__REDIS_VERSION__ - - run_small_tests - - upload_results_to_aws - - publish_github_comment - big_tests_in_docker: executor: << parameters.executor >> parallelism: 1 @@ -799,9 +768,12 @@ workflows: context: mongooseim-org build_prod: false filters: *all_tags - - build_in_docker_arm64: + - build_in_docker: name: otp_26_docker_arm64 + executor: otp_26_arm64 context: mongooseim-org + build_prod: true + arch: arm64 filters: *all_tags # ============= DIALYZER ============= - dialyzer: @@ -849,8 +821,9 @@ workflows: requires: - otp_26_docker filters: *all_tags - - small_tests_in_docker_arm64: + - small_tests_in_docker: name: small_tests_26_arm64 + executor: otp_26_redis_arm64 context: mongooseim-org requires: - otp_26_docker_arm64 @@ -1004,11 +977,15 @@ workflows: filters: *all_tags - docker_smoke_test: + name: docker_smoke_test + executor: otp_26 context: mongooseim-org requires: - docker_build_and_ship filters: *all_tags - - docker_smoke_test_arm64: + - docker_smoke_test: + name: docker_smoke_test_arm64 + executor: otp_26_arm64 context: mongooseim-org requires: - docker_build_and_ship