Skip to content

Commit

Permalink
Use arm docker executor instead of running docker manually
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chrzaszcz committed Oct 12, 2023
1 parent f0173c0 commit aa3d78b
Showing 1 changed file with 33 additions and 56 deletions.
89 changes: 33 additions & 56 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,22 @@ 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:
steps:
- 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:
Expand Down Expand Up @@ -274,19 +279,19 @@ commands:
when: on_success
command: |
echo "Success!"
$EXEC ./rebar3 codecov analyze
./rebar3 codecov analyze
tools/circle-upload-codecov.sh
run_small_tests:
steps:
- restore_workspace
- 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
Expand Down Expand Up @@ -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:
# #########################
Expand All @@ -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:
Expand Down Expand Up @@ -477,23 +480,6 @@ jobs:
pip3 install mike
mike deploy $DOCS_TAG --remote [email protected]: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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aa3d78b

Please sign in to comment.