Skip to content

Commit

Permalink
Merge pull request #4145 from esl/use-arm-docker-executor
Browse files Browse the repository at this point in the history
Use arm docker executor instead of running docker manually
  • Loading branch information
DenysGonchar authored Oct 13, 2023
2 parents 355991b + c075882 commit f358d08
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 64 deletions.
91 changes: 34 additions & 57 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,9 +512,9 @@ 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
name: Generate DOAP, JSON and Markdown files with supported XEPs
command: make xeplist
- run:
name: Build Big Tests
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
10 changes: 7 additions & 3 deletions tools/circle-upload-codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

set -eo pipefail

PLATFORM=$(uname -m)
[ $PLATFORM == "x86_64" ] && PLATFORM=linux
BASE_URL="https://uploader.codecov.io/latest/$PLATFORM"

# Source: https://docs.codecov.com/docs/codecov-uploader#integrity-checking-the-uploader
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
curl -Os "${BASE_URL}/codecov"
curl -Os "${BASE_URL}/codecov.SHA256SUM"
curl -Os "${BASE_URL}/codecov.SHA256SUM.sig"
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM

Expand Down
4 changes: 1 addition & 3 deletions tools/circleci-upload-to-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ fi
echo "Uploading test results to s3"
echo $(s3_url ${CT_REPORTS})



FILE_COUNT=$(find "${CT_REPORTS}" -type f | wc -l)
echo "Uploading $FILE_COUNT files"
ls $CT_REPORTS

if which aws ; then
echo "aws tool ready"
else
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install
fi
Expand Down
2 changes: 1 addition & 1 deletion tools/db-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PGSQL_VERSION_DEFAULT=latest

LDAP_VERSION_DEFAULT="1.5.0"

REDIS_VERSION_DEFAULT="6.2.6"
REDIS_VERSION_DEFAULT="7.2.1"

RMQ_VERSION_DEFAULT="3.11-alpine"

Expand Down

0 comments on commit f358d08

Please sign in to comment.