pingtimeout commented on code in PR #3321: URL: https://github.com/apache/polaris/pull/3321#discussion_r2645997090
########## .github/workflows/release-X-cancel-release-candidate.yml: ########## @@ -0,0 +1,253 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Note: This workflow uses "X" instead of a number because it's an exceptional +# workflow. It may be run after the third workflow has been run for a given RC. +name: Release - X - Cancel Release Candidate After Vote Failure + +on: + workflow_dispatch: + inputs: + dry_run: + description: 'Dry run mode (check to enable, uncheck to perform actual operations)' + required: false + type: boolean + default: true + staging_repository_id: + description: 'Nexus staging repository ID to drop (e.g., orgapachepolaris-1234)' + required: true + type: string + +jobs: + cancel-release-candidate: + name: Release - X - Cancel Release Candidate After Vote Failure + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + fetch-depth: 0 + + - name: Setup test environment + uses: ./.github/actions/setup-test-env + + - name: Set up environment variables + run: | + echo "RELEASEY_DIR=$(pwd)/releasey" >> $GITHUB_ENV + echo "LIBS_DIR=$(pwd)/releasey/libs" >> $GITHUB_ENV + + echo "## Mode" >> $GITHUB_STEP_SUMMARY + if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then + echo "DRY_RUN=1" >> $GITHUB_ENV + echo "‼️ DRY_RUN mode enabled - No actual changes will be made" >> $GITHUB_STEP_SUMMARY + else + echo "DRY_RUN=0" >> $GITHUB_ENV + echo "DRY_RUN mode disabled - Performing actual operations" >> $GITHUB_STEP_SUMMARY + fi + + # Validate staging repository ID parameter + staging_repo_id="${{ github.event.inputs.staging_repository_id }}" + if [[ -z "${staging_repo_id}" ]]; then + echo "❌ Staging repository ID is required but not provided." >> $GITHUB_STEP_SUMMARY + exit 1 + fi + echo "STAGING_REPOSITORY_ID=${staging_repo_id}" >> $GITHUB_ENV + + - name: Install Subversion + run: | + sudo apt-get update + sudo apt-get install -y subversion + + - name: Validate and extract version from RC tag + run: | + source "${LIBS_DIR}/_version.sh" + + echo "## Parameters" >> $GITHUB_STEP_SUMMARY + + # Extract the ref name from github.ref + # github.ref format: refs/heads/branch-name or refs/tags/tag-name + ref="${{ github.ref }}" + + if [[ "${ref}" =~ ^refs/tags/(.+)$ ]]; then + # Running from a tag + git_tag="${BASH_REMATCH[1]}" + else + echo "❌ Workflow must be run from a release candidate tag, not a branch." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Current ref: \`${ref}\`" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Please select a release candidate tag (e.g., \`apache-polaris-1.0.0-incubating-rc0\`) from the 'Use workflow from' dropdown in the GitHub UI." >> $GITHUB_STEP_SUMMARY + exit 1 + fi + + # Validate git tag format and extract version components + if ! validate_and_extract_git_tag_version "${git_tag}"; then + echo "❌ Invalid git tag format: \`${git_tag}\`. Expected format: apache-polaris-x.y.z-incubating-rcN." >> $GITHUB_STEP_SUMMARY + exit 1 + fi + + # Export variables for next steps + echo "git_tag=${git_tag}" >> $GITHUB_ENV + echo "version_without_rc=${version_without_rc}" >> $GITHUB_ENV + echo "rc_number=${rc_number}" >> $GITHUB_ENV + + cat <<EOT >> $GITHUB_STEP_SUMMARY + | Parameter | Value | + | --- | --- | + | Git tag | \`${git_tag}\` | + | Version | \`${version_without_rc}\` | + | RC number | \`${rc_number}\` | + | Staging Repository ID | \`${STAGING_REPOSITORY_ID}\` | + EOT + + - name: Set up Java Review Comment: My bad, it is a leftover from the first attempt, which was using `./gradlew dropApacheStagingRepository`. But unfortunately the gradle plugin does not offer the possibility to drop staging repositories so I had to revert to `curl` and forgot to remove the Java installation. Fixing... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
