Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Mar 9, 2023
1 parent 83f82c7 commit 160d052
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 51 deletions.
102 changes: 68 additions & 34 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ executors:
- *elasticsearch_container
- *cassandra_container
- *cassandra_proxy_container
arm64:
machine:
image: ubuntu-2004:current
resource_class: arm.medium
commands:
fetch_build_packages:
steps:
- run:
name: Install packages necessary for building
command: |
sudo pkill -9 apt-get || true && \
echo "Acquire::ForceIPv4 'true';" | sudo tee -a /etc/apt/apt.conf.d/99force-ipv4 && \
sudo ./tools/retry.sh apt-get update && \
sudo ./tools/retry.sh apt-get install libssl-dev unixodbc-dev unixodbc tdsodbc rsync zlib1g-dev -y
command: $EXEC tools/circle-install-packages.sh
maybe_build_deps_and_cache:
steps:
- restore_cache:
Expand All @@ -266,18 +266,27 @@ commands:
paths:
- ~/project/_build/default/
- ~/project/big_tests/_build/default/
build_and_cache_prod_build:
cache_prod_build:
parameters:
arch:
type: string
steps:
- run:
name: Generate prod release
name: Create prod tarball
command: |
echo $ERLANG_VERSION > otp_version
make rel
export BUILD_PATH=_build/prod/rel/mongooseim
tar czh --transform="s,${BUILD_PATH},mongooseim,S" \
-f mongooseim-<<parameters.arch>>.tar.gz ${BUILD_PATH}
- save_cache:
key: *BUILD_CACHE_KEY
paths: ~/project/_build/prod/rel/mongooseim
paths: ~/project/mongooseim-<<parameters.arch>>.tar.gz
restore_prod_build:
parameters:
arch:
type: string
steps:
- run:
echo $OTP_VERSION-<<parameters.arch>> > otp_version
- restore_cache:
key: *BUILD_CACHE_KEY
persist_workspace:
Expand Down Expand Up @@ -406,7 +415,7 @@ commands:
steps:
- run:
name: Prepare for cache
command: echo $ERLANG_VERSION > otp_version
command: $EXEC bash -c 'echo $OTP_VERSION-$ARCH > otp_version'

jobs:
# #########################
Expand All @@ -417,11 +426,13 @@ jobs:
parameters:
executor:
type: executor
environment:
IMAGE: ${DOCKERHUB_REPO}/mongooseim:${DOCKERHUB_TAG}
steps:
- checkout
- prepare_for_cache
- setup_remote_docker
- restore_prod_build
- restore_prod_build: {arch: amd64}
- restore_prod_build: {arch: arm64}
- run:
name: Execute Docker image build and upload
command: tools/circle-build-and-push-docker.sh
Expand Down Expand Up @@ -479,6 +490,21 @@ 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: *OTP25
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 make rel
- cache_prod_build: {arch: arm64}

build_in_docker:
executor: << parameters.executor >>
parameters:
Expand All @@ -505,7 +531,9 @@ jobs:
command: ./tools/build-releases.sh
- when:
condition: << parameters.build_prod >>
steps: [ build_and_cache_prod_build ]
steps:
- run: make rel
- cache_prod_build: {arch: amd64}
- run:
name: Build Big Tests
command: tools/build-tests.sh
Expand Down Expand Up @@ -715,6 +743,9 @@ workflows:
executor: otp_24
context: mongooseim-org
build_prod: false
- build_in_docker_arm64:
name: otp_25_docker_arm64
context: mongooseim-org
# ============= DIALYZER =============
- dialyzer:
name: dialyzer_24
Expand Down Expand Up @@ -884,25 +915,28 @@ workflows:
executor: otp_25
context: mongooseim-org
requires:
- small_tests_24
- ldap_mnesia_24
- pgsql_mnesia_24
- riak_mnesia_24
- dynamic_domains_pgsql_mnesia_24
- dialyzer_24
# - small_tests_24
# - ldap_mnesia_24
# - pgsql_mnesia_24
# - riak_mnesia_24
# - dynamic_domains_pgsql_mnesia_24
# - dialyzer_24
#
# - small_tests_25
# - internal_mnesia_25
# - pgsql_mnesia_25
# - mysql_redis_25
# - mssql_mnesia_25
# - ldap_mnesia_25
# - elasticsearch_and_cassandra_25
# - dynamic_domains_pgsql_mnesia_25
# - dynamic_domains_mysql_redis_25
# - dynamic_domains_mssql_mnesia_25
# - dialyzer_25
#
# - xref
# - edoc

- small_tests_25
- internal_mnesia_25
- pgsql_mnesia_25
- mysql_redis_25
- mssql_mnesia_25
- ldap_mnesia_25
- elasticsearch_and_cassandra_25
- dynamic_domains_pgsql_mnesia_25
- dynamic_domains_mysql_redis_25
- dynamic_domains_mssql_mnesia_25
- dialyzer_25

- xref
- edoc
- otp_25_docker
- otp_25_docker_arm64
filters: *all_tags
25 changes: 8 additions & 17 deletions tools/circle-build-and-push-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@

set -e
# From https://github.com/esl/mongooseim-docker/pull/47
MIM_DOCKER_VERSION=fe6d9d31a720a254ea0150c44138e5f3955bf77b

MONGOOSE_TGZ=mongooseim.tar.gz

BUILD_PATH=_build/prod/rel/mongooseim

tar czh --transform="s,${BUILD_PATH},mongooseim,S" -f $MONGOOSE_TGZ ${BUILD_PATH}

export BUILDS=`pwd`
MIM_DOCKER_VERSION=2209ab3a8c32f12cf58d7a1c255ad7ccfd3aefa1

# 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
Expand All @@ -33,21 +25,20 @@ 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

cp ../${MONGOOSE_TGZ} member
cp ../mongooseim-*.tar.gz member

docker build -f Dockerfile.member -t mongooseim -t ${IMAGE_TAG} \
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --name builder --driver docker-container --bootstrap --use
docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PASS}

docker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile.member -t ${IMAGE} --push --progress=plain \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${GIT_REF} \
--build-arg VCS_REF_DESC="${GIT_COMMIT_MSG}" \
--build-arg VERSION=${VERSION} \
.

docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PASS}

docker push ${IMAGE_TAG}
8 changes: 8 additions & 0 deletions tools/circle-install-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e

sudo pkill -9 apt-get || true
echo "Acquire::ForceIPv4 'true';" | sudo tee -a /etc/apt/apt.conf.d/99force-ipv4
sudo ./tools/retry.sh apt-get update
sudo ./tools/retry.sh apt-get install libssl-dev unixodbc-dev unixodbc tdsodbc rsync zlib1g-dev -y

0 comments on commit 160d052

Please sign in to comment.