|
| 1 | +# .circleci/config.yml |
| 2 | + |
| 3 | +# Circle CI arm64 builder |
| 4 | +version: 2.1 |
| 5 | + |
| 6 | +orbs: |
| 7 | + # https://circleci.com/developer/orbs/orb/circleci/docker |
| 8 | + docker: circleci/docker@2.2.0 |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-arm64: |
| 12 | + machine: |
| 13 | + image: ubuntu-2204:current |
| 14 | + resource_class: arm.medium |
| 15 | + environment: |
| 16 | + BUILDX_PLATFORMS: linux/arm64v8 |
| 17 | + DOCKER_BUILDKIT: '1' |
| 18 | + PLATFORM: linux/arm64v8 |
| 19 | + parameters: |
| 20 | + target-version-variant: |
| 21 | + type: string |
| 22 | + steps: |
| 23 | + - checkout |
| 24 | + - run: uname -a |
| 25 | + - run: docker --version |
| 26 | + - run: docker info |
| 27 | + - run: source tools/environment_init.sh |
| 28 | + - run: make check_version |
| 29 | + - docker/check: |
| 30 | + registry: docker.io |
| 31 | + docker-username: DOCKERHUB_USERNAME |
| 32 | + docker-password: DOCKERHUB_ACCESS_TOKEN |
| 33 | + |
| 34 | + - run: |
| 35 | + name: Conditional Docker Check - Halt if not on master branch or if it's a PR |
| 36 | + command: | |
| 37 | + # Check if the current branch is 'master' and the weekly image is not extis |
| 38 | + # If weekly image exists, skip docker build and push |
| 39 | + if [ "$CIRCLE_BRANCH" == "master" ] && check_image_exists "${{ matrix.version }}-${{ matrix.variant }}$(IMAGE_VERSION_ID)"; then |
| 40 | + circleci-agent step halt |
| 41 | + fi |
| 42 | +
|
| 43 | + - run: make -n test-<< parameters.target-version-variant >> |
| 44 | + - run: make test-<< parameters.target-version-variant >> |
| 45 | + - run: docker images |
| 46 | + |
| 47 | + - run: |
| 48 | + name: Conditional Docker Check - Halt if not on master branch or if it's a PR |
| 49 | + command: | |
| 50 | + # Check if the current branch is NOT 'master' or if the build is triggered by a pull request. |
| 51 | + # If either of these conditions is met, halt the workflow. |
| 52 | + if [ "$CIRCLE_BRANCH" != "master" ] || [ -n "$CIRCLE_PULL_REQUEST" ]; then |
| 53 | + circleci-agent step halt |
| 54 | + fi |
| 55 | +
|
| 56 | + - run: |
| 57 | + name: Install manifest-tool (linux-arm64 ) |
| 58 | + command: | |
| 59 | + wget https://github.com/estesp/manifest-tool/releases/download/v2.0.8/binaries-manifest-tool-2.0.8.tar.gz |
| 60 | + mkdir manifest-tool |
| 61 | + tar -xvzf binaries-manifest-tool-2.0.8.tar.gz -C manifest-tool |
| 62 | + sudo mv manifest-tool/manifest-tool-linux-arm64 /usr/local/bin/manifest-tool |
| 63 | + manifest-tool -v |
| 64 | +
|
| 65 | + - run: |
| 66 | + name: "Push docker image : make push-<< parameters.target-version-variant >>" |
| 67 | + command: | |
| 68 | + if [ "$CIRCLE_BRANCH" == "master" ] && [ -z "$CIRCLE_PULL_REQUEST" ]; then |
| 69 | + make push-<< parameters.target-version-variant >> |
| 70 | + make manifest-<< parameters.target-version-variant >> |
| 71 | + echo "...push and manifest done..." |
| 72 | + fi |
| 73 | +
|
| 74 | +workflows: |
| 75 | + build-deploy: |
| 76 | +# AND triggered by weekly from the app.circleci.com UI |
| 77 | + jobs: |
| 78 | + - build-arm64: |
| 79 | + matrix: |
| 80 | + parameters: |
| 81 | + target-version-variant: [ |
| 82 | +# |
| 83 | +# They are created using the ./apply-ci.sh script based on the version.json file, |
| 84 | +# where the architecture is defined as "arm64". |
| 85 | +# These "--skip--" images serve as inputs for the "*-bundle" images, |
| 86 | +# hence they must be generated within the bundle JOB. |
| 87 | +# |
| 88 | +#circleci-targets-start |
| 89 | + "11-3.3-alpine3.18", |
| 90 | + "11-3.3-bookworm", |
| 91 | + "11-3.3-bullseye", |
| 92 | + "12-3.4-alpine3.18", |
| 93 | + "12-3.4-bookworm", |
| 94 | + "12-3.4-bullseye", |
| 95 | + "13-3.4-alpine3.18", |
| 96 | +# --skip-- "13-3.4-bookworm", --> generated with the related bundle job! |
| 97 | + "13-3.4-bullseye", |
| 98 | + "13-3.4-bundle-bookworm", |
| 99 | + "14-3.4-alpine3.18", |
| 100 | +# --skip-- "14-3.4-bookworm", --> generated with the related bundle job! |
| 101 | + "14-3.4-bullseye", |
| 102 | + "14-3.4-bundle-bookworm", |
| 103 | + "15-3.4-alpine3.18", |
| 104 | +# --skip-- "15-3.4-bookworm", --> generated with the related bundle job! |
| 105 | + "15-3.4-bullseye", |
| 106 | + "15-3.4-bundle-bookworm", |
| 107 | + "15-master-bookworm", |
| 108 | + "15-recentstack-bookworm", |
| 109 | + "16-3.4-alpine3.18", |
| 110 | +# --skip-- "16-3.4-bookworm", --> generated with the related bundle job! |
| 111 | + "16-3.4-bullseye", |
| 112 | + "16-3.4-bundle-bookworm", |
| 113 | + "16-master-bookworm", |
| 114 | + "16-recentstack-bookworm", |
| 115 | +#circleci-targets-end |
| 116 | + ] |
0 commit comments