From dc84a976d96748e98f96121ecf816edd4191cc8e Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 11:34:03 -0400 Subject: [PATCH 01/15] Add missing checkout and revert java artifact type changes --- .github/workflows/build_release_candidate.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 5c35aa744198..205e06519e7e 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -122,18 +122,18 @@ jobs: mkdir -p beam/${{ github.event.inputs.RELEASE }} cd beam/${{ github.event.inputs.RELEASE }} RC_DIR="beam-${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" - RC_ZIP="${RC_DIR}.tar.gz" + RC_ZIP="${RC_DIR}.zip RELEASE_DIR="beam-${{ github.event.inputs.RELEASE }}" RC_TAG="v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" - SOURCE_RELEASE_ZIP="apache-beam-${{ github.event.inputs.RELEASE }}-source-release.tar.gz" + SOURCE_RELEASE_ZIP="apache-beam-${{ github.event.inputs.RELEASE }}-source-release.zip" # Check whether there is an existing dist dir if (svn ls "${SOURCE_RELEASE_ZIP}"); then echo "Removing existing ${SOURCE_RELEASE_ZIP}." svn delete "${SOURCE_RELEASE_ZIP}" fi - echo "Downloading: https://github.com/apache/beam/archive/${RC_TAG}.tar.gz" - wget https://github.com/apache/beam/archive/${RC_TAG}.tar.gz -O "${RC_ZIP}" + echo "Downloading: https://github.com/apache/beam/archive/${RC_TAG}.zip" + wget https://github.com/apache/beam/archive/${RC_TAG}.zip -O "${RC_ZIP}" unzip "$RC_ZIP" rm "$RC_ZIP" @@ -155,6 +155,11 @@ jobs: if: ${{github.event.inputs.STAGE_PYTHON_ARTIFACTS == 'yes'}} runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" + repository: apache/beam - name: Validate and mask apache id/password run: | echo "::add-mask::${{ github.event.inputs.APACHE_PASSWORD }}" From 21f230fa829213b42285a427cd7af958f3c4c44e Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 14:39:49 -0400 Subject: [PATCH 02/15] Fix variables --- .github/workflows/build_release_candidate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 205e06519e7e..db0806658d6c 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -122,7 +122,7 @@ jobs: mkdir -p beam/${{ github.event.inputs.RELEASE }} cd beam/${{ github.event.inputs.RELEASE }} RC_DIR="beam-${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" - RC_ZIP="${RC_DIR}.zip + RC_ZIP="${RC_DIR}.zip" RELEASE_DIR="beam-${{ github.event.inputs.RELEASE }}" RC_TAG="v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" SOURCE_RELEASE_ZIP="apache-beam-${{ github.event.inputs.RELEASE }}-source-release.zip" @@ -187,6 +187,7 @@ jobs: RELEASE_DIR: "beam/${{ github.event.inputs.RELEASE }}" SCRIPT_DIR: release/src/main/scripts GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SVN_ARTIFACTS_DIR: "beam/${{ github.event.inputs.RELEASE }}/python" run: | svn co https://dist.apache.org/repos/dist/dev/beam mkdir -p "${SVN_ARTIFACTS_DIR}" From 4b5097094a7b1ead81ae973d4a98c6bf746ebbc9 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 14:43:31 -0400 Subject: [PATCH 03/15] Install dateutil --- .github/workflows/build_release_candidate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index db0806658d6c..33af7994f481 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -180,6 +180,9 @@ jobs: uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Install dependencies: + run: | + pip install python-dateutil - name: stage python artifacts env: RC_TAG: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" From 60656a6c6dc1eae381affe2ec87e304ff802986c Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 14:44:39 -0400 Subject: [PATCH 04/15] Fix yaml --- .github/workflows/build_release_candidate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 33af7994f481..5cc27d0736ff 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -180,9 +180,9 @@ jobs: uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - - name: Install dependencies: + - name: Install dependencies run: | - pip install python-dateutil + pip install python-dateutil - name: stage python artifacts env: RC_TAG: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" From 6477345ac0cf1a1bbf032a677c67f8df22bcd1ac Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 14:55:18 -0400 Subject: [PATCH 05/15] Install requests --- .github/workflows/build_release_candidate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 5cc27d0736ff..27c2bb6ef7f1 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -183,6 +183,7 @@ jobs: - name: Install dependencies run: | pip install python-dateutil + pip install requests - name: stage python artifacts env: RC_TAG: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" From 145f960c05d2eb992c7d66f75e07afe47a005258 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:15:59 -0400 Subject: [PATCH 06/15] Add option to skip confirmation --- release/src/main/scripts/download_github_actions_artifacts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/src/main/scripts/download_github_actions_artifacts.py b/release/src/main/scripts/download_github_actions_artifacts.py index 5fbeb51a10cd..d587299d3ffe 100644 --- a/release/src/main/scripts/download_github_actions_artifacts.py +++ b/release/src/main/scripts/download_github_actions_artifacts.py @@ -50,6 +50,7 @@ def parse_arguments(): parser.add_argument("--release-commit", required=True) parser.add_argument("--artifacts_dir", required=True) parser.add_argument("--rc_number", required=False, default="") + parser.add_argument("--yes", required=False, default=False) args = parser.parse_args() github_token = get_github_token(args.github_token_var) @@ -57,7 +58,7 @@ def parse_arguments(): print("You passed following arguments:") pprint.pprint({**vars(args), **{"github_token": github_token}}) - if not get_yes_or_no_answer("Do you want to continue?"): + if not args.yes and not get_yes_or_no_answer("Do you want to continue?"): print("You said NO. Quitting ...") sys.exit(1) From 323f69bf74019b16689736b9f5d3bb545cc0c06d Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:16:46 -0400 Subject: [PATCH 07/15] Skip confirmation --- .github/workflows/build_release_candidate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 27c2bb6ef7f1..7361ff0bae15 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -203,7 +203,8 @@ jobs: --repo-url "${GIT_REPO_BASE_URL}" \ --rc-tag "${RC_TAG}" \ --release-commit "${RELEASE_COMMIT}" \ - --artifacts_dir "${RELEASE_DIR}/python" + --artifacts_dir "${RELEASE_DIR}/python" \ + --yes cd "${RELEASE_DIR}"/python From e1cf6a16aafb5b764de57c696861a0832d4a637e Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:19:01 -0400 Subject: [PATCH 08/15] Checkout workflow branch --- .github/workflows/build_release_candidate.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 7361ff0bae15..2928d27ae57e 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -157,9 +157,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" - repository: apache/beam - name: Validate and mask apache id/password run: | echo "::add-mask::${{ github.event.inputs.APACHE_PASSWORD }}" From 4e7950a7dfbc11fcf6f43fc08541eaae58ca36d8 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:24:02 -0400 Subject: [PATCH 09/15] Fetch tags --- .github/workflows/build_release_candidate.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 2928d27ae57e..59f668c882bd 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -157,6 +157,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-tags: true - name: Validate and mask apache id/password run: | echo "::add-mask::${{ github.event.inputs.APACHE_PASSWORD }}" From 0620523a9d6f49ac269b038da96fbf3d5a94cc94 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:39:11 -0400 Subject: [PATCH 10/15] Fetch tags --- .github/workflows/build_release_candidate.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 59f668c882bd..13c525ac099a 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -157,8 +157,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-tags: true - name: Validate and mask apache id/password run: | echo "::add-mask::${{ github.event.inputs.APACHE_PASSWORD }}" @@ -194,7 +192,8 @@ jobs: run: | svn co https://dist.apache.org/repos/dist/dev/beam mkdir -p "${SVN_ARTIFACTS_DIR}" - + + git fetch --all --tags --prune RELEASE_COMMIT=$(git rev-list -n 1 "tags/${RC_TAG}") python "${SCRIPT_DIR}/download_github_actions_artifacts.py" \ From c5185d55645cad7a72c8cd02509d047bd3236107 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:43:18 -0400 Subject: [PATCH 11/15] Fix arg --- .github/workflows/build_release_candidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 13c525ac099a..ff22a1b1d09f 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -202,7 +202,7 @@ jobs: --rc-tag "${RC_TAG}" \ --release-commit "${RELEASE_COMMIT}" \ --artifacts_dir "${RELEASE_DIR}/python" \ - --yes + --yes True cd "${RELEASE_DIR}"/python From 7ea58e6a8e72bddca5e5efb1c989c4614521a1a5 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 3 Nov 2023 15:48:28 -0400 Subject: [PATCH 12/15] Fix repo url --- .github/workflows/build_release_candidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index ff22a1b1d09f..e6ef551a77aa 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -198,7 +198,7 @@ jobs: python "${SCRIPT_DIR}/download_github_actions_artifacts.py" \ --github-token-var GITHUB_TOKEN \ - --repo-url "${GIT_REPO_BASE_URL}" \ + --repo-url "apache/beam" \ --rc-tag "${RC_TAG}" \ --release-commit "${RELEASE_COMMIT}" \ --artifacts_dir "${RELEASE_DIR}/python" \ From 7bea9bcc680eeea10c0a308c52c30ca561d03620 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Sat, 4 Nov 2023 06:33:27 -0400 Subject: [PATCH 13/15] Skip another prompt --- .../main/scripts/download_github_actions_artifacts.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/release/src/main/scripts/download_github_actions_artifacts.py b/release/src/main/scripts/download_github_actions_artifacts.py index d587299d3ffe..99526f1ac7d1 100644 --- a/release/src/main/scripts/download_github_actions_artifacts.py +++ b/release/src/main/scripts/download_github_actions_artifacts.py @@ -68,8 +68,9 @@ def parse_arguments(): artifacts_dir = args.artifacts_dir if os.path.isabs(args.artifacts_dir) \ else os.path.abspath(args.artifacts_dir) rc_number = args.rc_number + skip_prompts = args.yes - return github_token, repo_url, rc_tag, release_commit, artifacts_dir, rc_number + return github_token, repo_url, rc_tag, release_commit, artifacts_dir, rc_number, skip_prompts def get_github_token(github_token_var): @@ -242,7 +243,7 @@ def wait_for_workflow_run_to_finish( ) -def prepare_directory(artifacts_dir): +def prepare_directory(artifacts_dir, skip_prompts): """Creates given directory and asks for confirmation if directory exists before clearing it.""" print(f"Preparing Artifacts directory: {artifacts_dir}") if os.path.isdir(artifacts_dir): @@ -250,7 +251,7 @@ def prepare_directory(artifacts_dir): f"Found that directory already exists.\n" f"Any existing content in it will be erased. Proceed?\n" f"Your answer") - if get_yes_or_no_answer(question): + if skip_prompts or get_yes_or_no_answer(question): print(f"Clearing directory: {artifacts_dir}") shutil.rmtree(artifacts_dir, ignore_errors=True) else: @@ -329,6 +330,7 @@ def extract_single_artifact(file_path, output_dir): release_commit, artifacts_dir, rc_number, + skip_prompts, ) = parse_arguments() try: @@ -336,7 +338,7 @@ def extract_single_artifact(file_path, output_dir): run_id = get_last_run_id( workflow_id, repo_url, rc_tag, release_commit, github_token) validate_run(run_id, repo_url, github_token) - prepare_directory(artifacts_dir) + prepare_directory(artifacts_dir, skip_prompts) fetch_github_artifacts(run_id, repo_url, artifacts_dir, github_token, rc_number) print("Script finished successfully!") print(f"Artifacts available in directory: {artifacts_dir}") From 4d6fdd91fec624c561888622c8e88bb596e18601 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Sat, 4 Nov 2023 06:49:16 -0400 Subject: [PATCH 14/15] Fix variable + debug --- .github/workflows/build_release_candidate.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index e6ef551a77aa..0d26f7841416 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -186,6 +186,7 @@ jobs: RC_TAG: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}" GIT_REPO_BASE_URL: https://github.com/apache/beam RELEASE_DIR: "beam/${{ github.event.inputs.RELEASE }}" + RELEASE: "${{ github.event.inputs.RELEASE }}" SCRIPT_DIR: release/src/main/scripts GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SVN_ARTIFACTS_DIR: "beam/${{ github.event.inputs.RELEASE }}/python" @@ -205,7 +206,8 @@ jobs: --yes True cd "${RELEASE_DIR}"/python - + ls + echo "------Checking Hash Value for apache-beam-${RELEASE}.tar.gz-----" sha512sum -c "apache-beam-${RELEASE}.tar.gz.sha512" From 50c1522d06f1f1fc22c13bffcc7f3f857160eb13 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Sat, 4 Nov 2023 06:54:08 -0400 Subject: [PATCH 15/15] Fix svn auth --- .github/workflows/build_release_candidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release_candidate.yml b/.github/workflows/build_release_candidate.yml index 0d26f7841416..eac2655492ce 100644 --- a/.github/workflows/build_release_candidate.yml +++ b/.github/workflows/build_release_candidate.yml @@ -227,7 +227,7 @@ jobs: cd .. svn add --force python svn status - svn commit --no-auth-cache -m "Staging Python artifacts for Apache Beam ${RELEASE} RC${RC_NUM}" + svn commit -m "Staging Python artifacts for Apache Beam ${RELEASE} RC${RC_NUM}" --non-interactive --username ${{ github.event.inputs.APACHE_ID }} --password ${{ github.event.inputs.APACHE_PASSWORD }} stage_docker: