Skip to content

Commit

Permalink
Merge pull request #3988 from esl/docker-arm64-smoke-test
Browse files Browse the repository at this point in the history
Docker arm64 smoke test

Run docker image smoke test for arm64
  • Loading branch information
DenysGonchar authored Mar 17, 2023
2 parents 79133e8 + 9737f85 commit afb9ecf
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 33 deletions.
32 changes: 28 additions & 4 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

references:
- &OTP24 mongooseim/cimg-erlang:24.3.4.9
- &OTP25 mongooseim/cimg-erlang:25.2.3
- &OTP25 mongooseim/cimg-erlang:25.3
- &ENTRYPOINT ["/bin/sh", "-c", "eval ${INSTALL_DEPS_CMD:-echo} && echo __INJECT_FILES__ | eval ${BASE32DEC:-base32 --decode} | bash"]
# Caches created via the save_cache step are stored for up to 15 days
- &CERT_KEY certs-cache-{{ checksum "certs_cache_key" }}-v3
Expand Down Expand Up @@ -326,6 +326,14 @@ commands:
- run_coverage_analysis
- upload_results_to_aws
- publish_github_comment
run_docker_smoke_test:
steps:
- checkout
- run:
name: Smoke testing
command: |
source tools/circleci-prepare-mongooseim-docker.sh
./smoke_test.sh
upload_results_to_aws:
steps:
- run:
Expand Down Expand Up @@ -433,9 +441,17 @@ jobs:
- run:
name: Execute Docker image build and upload
command: tools/circle-build-and-push-docker.sh
- run:
name: Smoke testing
command: IMAGE_TAG=`cat image_tag` mongooseim-docker/smoke_test.sh

docker_smoke_test:
executor: otp_25
steps:
- setup_remote_docker
- run_docker_smoke_test

docker_smoke_test_arm64:
executor: arm64
steps:
- run_docker_smoke_test

docs_build_deploy:
parallelism: 1
Expand Down Expand Up @@ -942,3 +958,11 @@ workflows:
- edoc

filters: *all_tags
- docker_smoke_test:
context: mongooseim-org
requires:
- docker_build_and_ship
- docker_smoke_test_arm64:
context: mongooseim-org
requires:
- docker_build_and_ship
31 changes: 2 additions & 29 deletions tools/circle-build-and-push-docker.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
#!/bin/bash

set -e
# From https://github.com/esl/mongooseim-docker/pull/49
MIM_DOCKER_VERSION=6b62e9cf26c523e35fe78c57cbae2e8832f555d2

# We use output of generate_vsn, because it does not contain illegal characters, returns
# git tag when building from tag itself, and is unique in any other case
VERSION=`tools/generate_vsn.sh`
DOCKERHUB_TAG=${VERSION}
GIT_REF=`git rev-parse HEAD`
GIT_COMMIT_MSG=`git log --format=%B -n 1 HEAD`

if [ -n "$CIRCLE_PULL_REQUEST" ]; then
# CircleCI doesn't provide PR number in env. var., so we need to extract it from PR URL
# May not work with different service than GitHub
# TODO: Possibly change it to something else during Tide integration
PR_NUMBER=${CIRCLE_PULL_REQUEST##*/}
DOCKERHUB_TAG="PR-${PR_NUMBER}"
elif [ ${CIRCLE_BRANCH} == 'master' ]; then
DOCKERHUB_TAG="latest";
fi

echo "Tag: ${DOCKERHUB_TAG}"

IMAGE_TAG=${DOCKERHUB_REPO}/mongooseim:${DOCKERHUB_TAG}

git clone https://github.com/esl/mongooseim-docker.git
cd mongooseim-docker
git checkout $MIM_DOCKER_VERSION
SRC_ROOT="$(dirname "${BASH_SOURCE}")"
source $SRC_ROOT/circleci-prepare-mongooseim-docker.sh

cp ../mongooseim-*.tar.gz member

Expand All @@ -42,5 +17,3 @@ docker buildx build --platform linux/amd64,linux/arm64 \
--build-arg VCS_REF_DESC="${GIT_COMMIT_MSG}" \
--build-arg VERSION=${VERSION} \
.

echo $IMAGE_TAG > ../image_tag
30 changes: 30 additions & 0 deletions tools/circleci-prepare-mongooseim-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e
# From https://github.com/esl/mongooseim-docker/pull/49
MIM_DOCKER_VERSION=6b62e9cf26c523e35fe78c57cbae2e8832f555d2

# We use output of generate_vsn, because it does not contain illegal characters, returns
# git tag when building from tag itself, and is unique in any other case
VERSION=`tools/generate_vsn.sh`
DOCKERHUB_TAG=${VERSION}
GIT_REF=`git rev-parse HEAD`
GIT_COMMIT_MSG=`git log --format=%B -n 1 HEAD`

if [ -n "$CIRCLE_PULL_REQUEST" ]; then
# CircleCI doesn't provide PR number in env. var., so we need to extract it from PR URL
# May not work with different service than GitHub
# TODO: Possibly change it to something else during Tide integration
PR_NUMBER=${CIRCLE_PULL_REQUEST##*/}
DOCKERHUB_TAG="PR-${PR_NUMBER}"
elif [ ${CIRCLE_BRANCH} == 'master' ]; then
DOCKERHUB_TAG="latest";
fi

echo "Tag: ${DOCKERHUB_TAG}"

export IMAGE_TAG=${DOCKERHUB_REPO}/mongooseim:${DOCKERHUB_TAG}

git clone https://github.com/esl/mongooseim-docker.git
cd mongooseim-docker
git checkout $MIM_DOCKER_VERSION

0 comments on commit afb9ecf

Please sign in to comment.