|
| 1 | +#@ load("@ytt:data", "data") |
| 2 | +#@yaml/text-templated-strings |
| 3 | + |
| 4 | +#@ def job_names(plugins): |
| 5 | +#@ names = [] |
| 6 | +#@ for p in plugins: |
| 7 | +#@ names.append("test-"+p) |
| 8 | +#@ end |
| 9 | +#@ return names |
| 10 | +#@ end |
| 11 | + |
| 12 | +#@ def sharded_job_names(plugin, shard_count): |
| 13 | +#@ names = [] |
| 14 | +#@ for shard_index in range(0, shard_count): |
| 15 | +#@ names.append("test-"+plugin+"-"+str(shard_index)) |
| 16 | +#@ end |
| 17 | +#@ return names |
| 18 | +#@ end |
| 19 | + |
| 20 | +--- |
| 21 | +name: Test Mixed Version Clusters |
| 22 | +on: |
| 23 | + push: |
| 24 | + branches: |
| 25 | + - main |
| 26 | + - v3.12.x |
| 27 | + - v3.11.x |
| 28 | + - v3.10.x |
| 29 | + - v3.9.x |
| 30 | + - v3.8.x |
| 31 | + - bump-otp-* |
| 32 | + - bump-elixir-* |
| 33 | + - bump-rbe-* |
| 34 | + - bump-rules_erlang |
| 35 | + paths: |
| 36 | + - 'deps/**' |
| 37 | + - 'scripts/**' |
| 38 | + - Makefile |
| 39 | + - plugins.mk |
| 40 | + - rabbitmq-components.mk |
| 41 | + - .bazelrc |
| 42 | + - .bazelversion |
| 43 | + - BUILD.* |
| 44 | + - '*.bzl' |
| 45 | + - '*.bazel' |
| 46 | + - .github/workflows/test-mixed-versions.yaml |
| 47 | + pull_request: |
| 48 | +concurrency: |
| 49 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 50 | + cancel-in-progress: true |
| 51 | +jobs: |
| 52 | + ensure-mixed-version-archive: |
| 53 | + runs-on: ubuntu-22.04 |
| 54 | + steps: |
| 55 | + - name: CHECKOUT REPOSITORY |
| 56 | + uses: actions/checkout@v4 |
| 57 | + with: |
| 58 | + path: primary-umbrella |
| 59 | + #! - name: Setup tmate session |
| 60 | + #! uses: mxschmitt/action-tmate@v3 |
| 61 | + - name: CHECK FOR ARCHIVE ON S3 |
| 62 | + id: check |
| 63 | + working-directory: primary-umbrella |
| 64 | + run: | |
| 65 | + set -u |
| 66 | +
|
| 67 | + ARCHIVE_URL="$(grep -Eo 'https://rabbitmq-github-actions.s3.eu-west-1.amazonaws.com.*.tar.xz' bazel/bzlmod/secondary_umbrella.bzl)" |
| 68 | + echo "ARCHIVE_URL: ${ARCHIVE_URL}" |
| 69 | +
|
| 70 | + curl -LO "${ARCHIVE_URL}" |
| 71 | +
|
| 72 | + if xzcat --test package-generic-unix-for-mixed-version-testing-v*.tar.xz; then |
| 73 | + exists=true |
| 74 | + else |
| 75 | + exists=false |
| 76 | + fi |
| 77 | + echo "exists=${exists}" | tee $GITHUB_ENV |
| 78 | +
|
| 79 | + OTP_VERSION_ID=${ARCHIVE_URL#*secondary-umbrellas/rbe-} |
| 80 | + OTP_VERSION_ID=${OTP_VERSION_ID%*/package-generic-unix-for-mixed-version-testing-v*.tar.xz} |
| 81 | + echo "otp_version_id=${OTP_VERSION_ID}" | tee -a $GITHUB_OUTPUT |
| 82 | +
|
| 83 | + VERSION=${ARCHIVE_URL#*package-generic-unix-for-mixed-version-testing-v} |
| 84 | + VERSION=${VERSION%*.tar.xz} |
| 85 | + echo "version=${VERSION}" | tee -a $GITHUB_OUTPUT |
| 86 | + - name: CHECKOUT REPOSITORY (MIXED VERSION) |
| 87 | + if: env.exists != 'true' |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + ref: v${{ steps.check.outputs.version }} |
| 91 | + path: secondary-umbrella |
| 92 | + - name: BUILD SECONDARY UMBRELLA ARCHIVE |
| 93 | + if: env.exists != 'true' |
| 94 | + working-directory: secondary-umbrella |
| 95 | + run: | |
| 96 | + if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then |
| 97 | + cat << EOF >> user.bazelrc |
| 98 | + build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} |
| 99 | + EOF |
| 100 | + fi |
| 101 | + cat << EOF >> user.bazelrc |
| 102 | + build:buildbuddy --build_metadata=ROLE=CI |
| 103 | + build:buildbuddy --build_metadata=VISIBILITY=PRIVATE |
| 104 | + build:buildbuddy --remote_instance_name=buildbuddy-io/buildbuddy/ci-secondary-umbrella |
| 105 | + build:buildbuddy --color=yes |
| 106 | +
|
| 107 | + build:buildbuddy --remote_download_toplevel |
| 108 | + EOF |
| 109 | +
|
| 110 | + sed -i"_orig" -E "/APP_VERSION/ s/3\.[0-9]+\.[0-9]+/${{ steps.check.outputs.version }}/" rabbitmq.bzl |
| 111 | + bazelisk build :package-generic-unix \ |
| 112 | + --config=rbe-${{ steps.check.outputs.otp_version_id }} \ |
| 113 | + --test_build \ |
| 114 | + --verbose_failures |
| 115 | +
|
| 116 | + OUTPUT_DIR=${{ github.workspace }}/output |
| 117 | + mkdir -p ${OUTPUT_DIR}/rbe-${{ steps.check.outputs.otp_version_id }} |
| 118 | + cp \ |
| 119 | + bazel-bin/package-generic-unix.tar.xz \ |
| 120 | + ${OUTPUT_DIR}/rbe-${{ steps.check.outputs.otp_version_id }}/package-generic-unix-for-mixed-version-testing-v${{ steps.check.outputs.version }}.tar.xz |
| 121 | + - name: UPLOAD THE ARCHIVE TO S3 |
| 122 | + if: env.exists != 'true' |
| 123 | + uses: jakejarvis/[email protected] |
| 124 | + with: |
| 125 | + args: --acl public-read --follow-symlinks |
| 126 | + env: |
| 127 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 128 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}} |
| 129 | + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} |
| 130 | + AWS_REGION: ${{ secrets.AWS_REGION }} |
| 131 | + SOURCE_DIR: output |
| 132 | + DEST_DIR: secondary-umbrellas |
| 133 | + |
| 134 | + check-workflow: |
| 135 | + needs: ensure-mixed-version-archive |
| 136 | + runs-on: ubuntu-latest |
| 137 | + outputs: |
| 138 | + repo_cache_key: ${{ steps.repo-cache-key.outputs.value }} |
| 139 | + steps: |
| 140 | + - name: CHECKOUT REPOSITORY |
| 141 | + uses: actions/checkout@v4 |
| 142 | + - name: SETUP ERLANG/ELIXIR |
| 143 | + uses: erlef/setup-beam@v1 |
| 144 | + with: |
| 145 | + otp-version: 26 |
| 146 | + elixir-version: 1.15 |
| 147 | + - name: ENSURE WORKFLOWS ARE UP TO DATE |
| 148 | + run: | |
| 149 | + mkdir local-bin/ |
| 150 | + curl -L https://carvel.dev/install.sh | K14SIO_INSTALL_BIN_DIR=local-bin bash |
| 151 | + make actions-workflows YTT=$PWD/local-bin/ytt |
| 152 | + git diff --exit-code |
| 153 | + - name: COMPUTE REPO CACHE KEY |
| 154 | + id: repo-cache-key |
| 155 | + run: | |
| 156 | + echo "value=bazel-repo-cache-${{ hashFiles('MODULE.bazel') }}" | tee -a $GITHUB_OUTPUT |
| 157 | +
|
| 158 | +#@ for plugin in data.values.internal_deps: |
| 159 | + test-(@= plugin @): |
| 160 | + needs: check-workflow |
| 161 | + uses: ./.github/workflows/test-plugin-mixed.yaml |
| 162 | + with: |
| 163 | + repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }} |
| 164 | + plugin: #@ plugin |
| 165 | + secrets: inherit |
| 166 | +#@ end |
| 167 | + |
| 168 | +#@ rabbit_shard_count = 10 |
| 169 | +#@ for shard_index in range(0, rabbit_shard_count): |
| 170 | + test-rabbit-(@= str(shard_index) @): |
| 171 | + needs: #@ ["check-workflow"] + job_names(data.values.internal_deps) |
| 172 | + uses: ./.github/workflows/test-plugin-mixed.yaml |
| 173 | + with: |
| 174 | + repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }} |
| 175 | + plugin: rabbit |
| 176 | + shard_index: #@ shard_index |
| 177 | + shard_count: #@ rabbit_shard_count |
| 178 | + secrets: inherit |
| 179 | +#@ end |
| 180 | + |
| 181 | +#@ for plugin in data.values.tier1_plugins: |
| 182 | + test-(@= plugin @): |
| 183 | + needs: #@ ["check-workflow"] + sharded_job_names("rabbit", rabbit_shard_count) |
| 184 | + uses: ./.github/workflows/test-plugin-mixed.yaml |
| 185 | + with: |
| 186 | + repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }} |
| 187 | + plugin: #@ plugin |
| 188 | + secrets: inherit |
| 189 | +#@ end |
| 190 | + |
| 191 | + summary-test: |
| 192 | + needs: #@ job_names(data.values.internal_deps + data.values.tier1_plugins) + sharded_job_names("rabbit", rabbit_shard_count) |
| 193 | + runs-on: ubuntu-latest |
| 194 | + steps: |
| 195 | + - name: SUMMARY |
| 196 | + run: | |
| 197 | + cat << 'EOF' | jq -e 'map(.result == "success") | all(.)' |
| 198 | + ${{ toJson(needs) }} |
| 199 | + EOF |
0 commit comments