diff --git a/.circleci/config.yml b/.circleci/config.yml index f89d36c9..06f854d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -317,11 +317,29 @@ jobs: executor: default-machine steps: - checkout + - run: + name: Setup buildx and qemu + command: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + sudo apt-get install -y binfmt-support + - run: + name: Check versions + command: | + qemu-aarch64-static --version + update-binfmts --version + - run: + name: Login to Docker Hub + command: docker login -u $DOCKER_USER -p $DOCKER_PASS - run: name: Build Docker local image command: | + export DOCKER_CLI_EXPERIMENTAL=enabled + docker buildx create --name multi-arch-builder + docker buildx use multi-arch-builder + docker buildx inspect --bootstrap echo "Building Docker image: local" - docker build -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local . + docker buildx build --platform linux/amd64 --load -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local . - run: name: Save docker image to workspace command: docker save -o /tmp/docker-image-local.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local @@ -330,27 +348,6 @@ jobs: paths: - ./docker-image-local.tar - build: - executor: default-machine - steps: - - attach_workspace: - at: /tmp - - run: - name: Load the pre-built docker local image from workspace - command: docker load -i /tmp/docker-image-local.tar - - run: - name: Re-tag the image - command: | - echo "Re-tagging Docker image: $CIRCLE_TAG" - docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG - - run: - name: Save the new docker image to workspace - command: docker save -o /tmp/docker-image.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG - - persist_to_workspace: - root: /tmp - paths: - - ./docker-image.tar - license-scan: executor: default-machine steps: @@ -358,12 +355,12 @@ jobs: at: /tmp - run: name: Load the pre-built docker image from workspace - command: docker load -i /tmp/docker-image.tar + command: docker load -i /tmp/docker-image-local.tar - run: <<: *defaults_license_scanner - run: name: Run the license-scanner - command: cd /tmp/license-scanner && mode=docker dockerImages=$DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG make run + command: cd /tmp/license-scanner && mode=docker dockerImages=$DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local make run - store_artifacts: path: /tmp/license-scanner/results prefix: licenses @@ -403,7 +400,7 @@ jobs: at: /tmp - run: name: Load the pre-built docker image from workspace - command: docker load -i /tmp/docker-image.tar + command: docker load -i /tmp/docker-image-local.tar - run: name: Download the mojaloop/ci-config repo command: | @@ -419,7 +416,7 @@ jobs: - anchore/analyze_local_image: # Force the older version, version 0.7.0 was just published, and is broken anchore_version: v0.6.1 - image_name: "docker.io/node:16.15.0-alpine $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG" + image_name: "docker.io/node:16.15.0-alpine $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local" policy_failure: false timeout: '500' # Note: if the generated policy is invalid, this will fallback to the default policy, which we don't want! @@ -534,26 +531,30 @@ jobs: echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV - - attach_workspace: - at: /tmp - run: - name: Load the pre-built docker image from workspace - command: | - docker load -i /tmp/docker-image.tar + name: Setup buildx and qemu + command: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + sudo apt-get install -y binfmt-support + - run: + name: Check versions + command: | + qemu-aarch64-static --version + update-binfmts --version - run: name: Login to Docker Hub command: docker login -u $DOCKER_USER -p $DOCKER_PASS - run: - name: Re-tag pre built image - command: | - docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG - - run: - name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub + name: Build Multi Arch Docker image and push command: | - echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG" - docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG - echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG" - docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG + export DOCKER_CLI_EXPERIMENTAL=enabled + docker buildx create --name multi-arch-builder + docker buildx use multi-arch-builder + docker buildx inspect --bootstrap + docker buildx build --platform linux/amd64,linux/arm64 --push -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG . + echo "Published $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG" + echo "Published $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG" - run: name: Set Image Digest command: | @@ -592,26 +593,30 @@ jobs: echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV - - attach_workspace: - at: /tmp - run: - name: Load the pre-built docker image from workspace - command: | - docker load -i /tmp/docker-image.tar + name: Setup buildx and qemu + command: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + sudo apt-get install -y binfmt-support + - run: + name: Check versions + command: | + qemu-aarch64-static --version + update-binfmts --version - run: name: Login to Docker Hub command: docker login -u $DOCKER_USER -p $DOCKER_PASS - run: - name: Re-tag pre built image + name: Build Multi Arch Docker image and push command: | - docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG - - run: - name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub - command: | - echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG" - docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG - echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG" - docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG + export DOCKER_CLI_EXPERIMENTAL=enabled + docker buildx create --name multi-arch-builder + docker buildx use multi-arch-builder + docker buildx inspect --bootstrap + docker buildx build --platform linux/amd64,linux/arm64 --push -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG . + echo "Published $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG" + echo "Published $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG" - run: name: Set Image Digest command: | @@ -752,30 +757,10 @@ workflows: ignore: - /feature*/ - /bugfix*/ - - build: - context: org-global - requires: - - setup - - test-dependencies - - test-lint - - test-unit - - test-coverage - - test-functional - ## Currently not implemented - # - test-integration - - vulnerability-check - - audit-licenses - - build-local - filters: - tags: - only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/ - branches: - ignore: - - /.*/ - license-scan: context: org-global requires: - - build + - build-local filters: tags: only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/ @@ -785,7 +770,7 @@ workflows: - image-scan: context: org-global requires: - - build + - build-local filters: tags: only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/ diff --git a/package-lock.json b/package-lock.json index 9a9f43f3..22eef4ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ml-testing-toolkit", - "version": "16.0.0", + "version": "16.1.0-snapshot.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ml-testing-toolkit", - "version": "16.0.0", + "version": "16.1.0-snapshot.4", "license": "Apache-2.0", "dependencies": { "@elastic/elasticsearch": "^8.6.0", diff --git a/package.json b/package.json index 28de149e..f2ce473c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ml-testing-toolkit", "description": "Testing Toolkit for Mojaloop implementations", - "version": "16.0.0", + "version": "16.1.0-snapshot.4", "license": "Apache-2.0", "author": "Vijaya Kumar Guthi, ModusBox Inc. ", "contributors": [