|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +# |
| 18 | +# Runs the Java SDK reviewer checklist ("Verifying a release" in |
| 19 | +# java-sdk/README.md) automatically, minus the GPG signature (only the release |
| 20 | +# manager's key can satisfy that). |
| 21 | +# |
| 22 | +# * on a pull request touching java-sdk/ -> verify HEAD can produce a source |
| 23 | +# release that is self-contained and builds from scratch. |
| 24 | +# * on a `java-sdk/**` tag push -> the same check against the tagged commit |
| 25 | +# (release readiness gate). |
| 26 | +# * on manual dispatch -> verify the ACTUAL staged artifacts: the source |
| 27 | +# package in dist/dev and the closed Nexus staging repo. Run this after |
| 28 | +# staging, before sending the [VOTE] email. |
| 29 | +--- |
| 30 | +name: Java SDK release verification |
| 31 | + |
| 32 | +on: # yamllint disable-line rule:truthy |
| 33 | + pull_request: |
| 34 | + paths: |
| 35 | + - "java-sdk/**" |
| 36 | + - ".github/workflows/java-sdk-release-verify.yml" |
| 37 | + push: |
| 38 | + tags: |
| 39 | + - "java-sdk/**" |
| 40 | + workflow_dispatch: |
| 41 | + inputs: |
| 42 | + tag: |
| 43 | + description: "Java SDK release tag (starts with 'java-sdk/') to verify" |
| 44 | + required: true |
| 45 | + type: string |
| 46 | + nexus_repo_id: |
| 47 | + description: "Nexus staging repo id (the NNNN in orgapacheairflow-NNNN)" |
| 48 | + required: true |
| 49 | + type: string |
| 50 | + |
| 51 | +permissions: |
| 52 | + contents: read |
| 53 | + |
| 54 | +concurrency: |
| 55 | + group: java-sdk-release-verify-${{ github.event_name }}-${{ github.ref }}-${{ inputs.tag }} |
| 56 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 57 | + |
| 58 | +env: |
| 59 | + JAVA_VERSION: "11" |
| 60 | + |
| 61 | +jobs: |
| 62 | + source-release: |
| 63 | + name: Source release builds cleanly |
| 64 | + if: github.event_name != 'workflow_dispatch' |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 69 | + with: |
| 70 | + ref: ${{ github.event_name == 'push' && github.ref || github.sha }} |
| 71 | + fetch-depth: 0 |
| 72 | + persist-credentials: false |
| 73 | + - name: Set up JDK ${{ env.JAVA_VERSION }} |
| 74 | + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 |
| 75 | + with: |
| 76 | + distribution: temurin |
| 77 | + java-version: ${{ env.JAVA_VERSION }} |
| 78 | + - name: Use an isolated Gradle home |
| 79 | + run: echo "GRADLE_USER_HOME=${RUNNER_TEMP}/gradle-home" >> "$GITHUB_ENV" |
| 80 | + - name: Resolve the ref to build the source release from |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | + if [ "${{ github.event_name }}" = "push" ]; then |
| 84 | + echo "RELEASE_REF=${GITHUB_REF_NAME}" >> "$GITHUB_ENV" |
| 85 | + else # A PR HEAD. |
| 86 | + echo "RELEASE_REF=$(git rev-parse HEAD)" >> "$GITHUB_ENV" |
| 87 | + fi |
| 88 | + - name: Build the source tarball from the ref (project's wrapper) |
| 89 | + working-directory: java-sdk |
| 90 | + run: ./gradlew --no-daemon sourceTarball checksumSourceTarball -PgitRef="${RELEASE_REF}" |
| 91 | + - name: Install the latest Gradle to bootstrap a new wrapper for the source extracted from the tarball |
| 92 | + run: | |
| 93 | + set -euo pipefail |
| 94 | + meta=$(curl -fsSL https://services.gradle.org/versions/current) |
| 95 | + ver=$(echo "$meta" | jq -r .version) |
| 96 | + url=$(echo "$meta" | jq -r .downloadUrl) |
| 97 | + sum=$(curl -fsSL "$(echo "$meta" | jq -r .checksumUrl)") |
| 98 | + curl -fsSL -o /tmp/gradle.zip "$url" |
| 99 | + echo "${sum} /tmp/gradle.zip" | sha256sum -c - |
| 100 | + unzip -q -d "$HOME/gradle" /tmp/gradle.zip |
| 101 | + echo "$HOME/gradle/gradle-${ver}/bin" >> "$GITHUB_PATH" |
| 102 | + - name: Verify the source tarball |
| 103 | + run: | |
| 104 | + set -euo pipefail |
| 105 | + tarball=$(ls java-sdk/build/distributions/apache-airflow-java-sdk-*-src.tar.gz) |
| 106 | + java-sdk/scripts/ci/verify-source-release.sh \ |
| 107 | + --tarball "${tarball}" \ |
| 108 | + --sha512 "${tarball}.sha512" \ |
| 109 | + --tag "${RELEASE_REF}" |
| 110 | +
|
| 111 | + artifact: |
| 112 | + name: Staged artifacts pass the reviewer checklist |
| 113 | + if: github.event_name == 'workflow_dispatch' |
| 114 | + runs-on: ubuntu-latest |
| 115 | + steps: |
| 116 | + - name: Checkout tag |
| 117 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 118 | + with: |
| 119 | + ref: ${{ inputs.tag }} |
| 120 | + fetch-depth: 0 |
| 121 | + persist-credentials: false |
| 122 | + - name: Set up JDK ${{ env.JAVA_VERSION }} |
| 123 | + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 |
| 124 | + with: |
| 125 | + distribution: temurin |
| 126 | + java-version: ${{ env.JAVA_VERSION }} |
| 127 | + - name: Use an isolated Gradle home |
| 128 | + run: echo "GRADLE_USER_HOME=${RUNNER_TEMP}/gradle-home" >> "$GITHUB_ENV" |
| 129 | + - name: Download the staged source package from dist/dev |
| 130 | + env: |
| 131 | + TAG: ${{ inputs.tag }} |
| 132 | + run: | |
| 133 | + set -euo pipefail |
| 134 | + rcdir="${TAG#java-sdk/}" # <version>-rc<N> |
| 135 | + version="${rcdir%-rc*}" # <version> |
| 136 | + base="https://dist.apache.org/repos/dist/dev/airflow/java-sdk/${rcdir}" |
| 137 | + file="apache-airflow-java-sdk-${version}-src.tar.gz" |
| 138 | + mkdir -p staged |
| 139 | + curl -fsSL -o "staged/${file}" "${base}/${file}" |
| 140 | + curl -fsSL -o "staged/${file}.sha512" "${base}/${file}.sha512" |
| 141 | + - name: Install the latest Gradle to bootstrap a new wrapper for the source extracted from the tarball |
| 142 | + run: | |
| 143 | + set -euo pipefail |
| 144 | + meta=$(curl -fsSL https://services.gradle.org/versions/current) |
| 145 | + ver=$(echo "$meta" | jq -r .version) |
| 146 | + url=$(echo "$meta" | jq -r .downloadUrl) |
| 147 | + sum=$(curl -fsSL "$(echo "$meta" | jq -r .checksumUrl)") |
| 148 | + curl -fsSL -o /tmp/gradle.zip "$url" |
| 149 | + echo "${sum} /tmp/gradle.zip" | sha256sum -c - |
| 150 | + unzip -q -d "$HOME/gradle" /tmp/gradle.zip |
| 151 | + echo "$HOME/gradle/gradle-${ver}/bin" >> "$GITHUB_PATH" |
| 152 | + - name: Verify the staged artifacts |
| 153 | + env: |
| 154 | + TAG: ${{ inputs.tag }} |
| 155 | + NEXUS_REPO_ID: ${{ inputs.nexus_repo_id }} |
| 156 | + run: | |
| 157 | + set -euo pipefail |
| 158 | + rcdir="${TAG#java-sdk/}"; version="${rcdir%-rc*}" |
| 159 | + file="apache-airflow-java-sdk-${version}-src.tar.gz" |
| 160 | + java-sdk/scripts/ci/verify-source-release.sh \ |
| 161 | + --tarball "staged/${file}" \ |
| 162 | + --sha512 "staged/${file}.sha512" \ |
| 163 | + --tag "${TAG}" \ |
| 164 | + --nexus-repo-id "${NEXUS_REPO_ID}" |
0 commit comments