Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c1cdf52
Added verify_release_build.yml file with check_environment an create_…
dannymartinm Sep 1, 2022
ec99072
Fixing typo issue in checkout step in yml.
dannymartinm Sep 1, 2022
aa17ac5
Removing blank spaces
dannymartinm Sep 2, 2022
6be03a3
Adding RELEASE_BRANCH env as GITHUB_ENV variable.
dannymartinm Sep 2, 2022
ea954fa
Fixed ref RELASE_BRANCH
dannymartinm Sep 2, 2022
ebfb62c
Added RELEASE_ENV as step env var. Set github config user
dannymartinm Sep 2, 2022
00ef379
Fixed RELEASE_VER env var.
dannymartinm Sep 2, 2022
bb032b7
Added write pull_request permission.
dannymartinm Sep 2, 2022
5b81aac
Added write contents permission. Print RELEASE_BRANCH for confirmatio…
dannymartinm Sep 2, 2022
a655b1d
Adding base and header in hub pull-request command.
dannymartinm Sep 2, 2022
a5fbfa8
Using env.VAR_NAME convention.
dannymartinm Sep 2, 2022
384a41d
Print variables
dannymartinm Sep 2, 2022
b47dce2
Fixing env var syntaxis issue issue
dannymartinm Sep 2, 2022
1216f94
Adding missing GITHUB_TOKEN env var in create PR job.
dannymartinm Sep 2, 2022
6d5a9ab
Moved set RELEASE_BRANCH to create PR job.
dannymartinm Sep 2, 2022
e6a2695
Print both env.RB and $RB.
dannymartinm Sep 5, 2022
fecb008
Print both RELASE_BRANCH env var
dannymartinm Sep 5, 2022
3f4e76d
Adding RELEASE_VER env var in create_release_ir step.
dannymartinm Sep 5, 2022
ed4c1a7
Adding RELEASE_VER env var in create_release_ir step.
dannymartinm Sep 5, 2022
d484dee
Cleaned code
dannymartinm Sep 5, 2022
0909c4c
Adding run set_version script before creating the new PR.
dannymartinm Sep 5, 2022
5cb9b65
Run the script using bash to fix the ubuntu issue. Removed unused pri…
dannymartinm Sep 5, 2022
e65b4ff
Updating gradle.properties path
dannymartinm Sep 5, 2022
423aed9
Updating gradle.properties path.
dannymartinm Sep 5, 2022
c87b59b
Passing GITHUB_WORKSPACE to set_version script.
dannymartinm Sep 6, 2022
065995b
Removing working-directory in workflow and update set_version path in…
dannymartinm Sep 6, 2022
040523e
Set new GITHUB_PR as env variable.
dannymartinm Sep 6, 2022
21b6067
Get the GH_PR_NUMBER and set it as env variable. Create PR comment vi…
dannymartinm Sep 6, 2022
e408983
Fixing yml issue.
dannymartinm Sep 6, 2022
4aef494
Fixing yml format issue.
dannymartinm Sep 6, 2022
2c66321
comment_trigger_phrases step needs create_release_pr to run.
dannymartinm Sep 6, 2022
6f7be00
Fixed set GITHUB_PR_NUMBER GITHUB_ENV var.
dannymartinm Sep 6, 2022
3688e01
Adding PR Number as an output.
dannymartinm Sep 7, 2022
577666a
Fixed lint yml issue
dannymartinm Sep 7, 2022
b8e1d93
Passing GH_TOKEN to hub.
dannymartinm Sep 7, 2022
6f172df
Fixed env vars in comment step.
dannymartinm Sep 7, 2022
c4b3a5c
Added command to comment new pr
dannymartinm Sep 7, 2022
e3ad54f
Updated gh pr command and passing the whole PR URL.
dannymartinm Sep 7, 2022
b1eef0d
Adding pull-requests write permission to comment_trigger_phrases job.
dannymartinm Sep 7, 2022
ede162b
Run the comment_pr_trigger_phrases.sh script to comment the PR with t…
dannymartinm Sep 9, 2022
18f4b29
List the files in working-directory for testing
dannymartinm Sep 15, 2022
147fc7d
Fixing linter issue in working-directory
dannymartinm Sep 15, 2022
78d2a2b
Moved comment_trigger_Phrases job into the update_create_release_pr job.
dannymartinm Sep 19, 2022
2982e30
Added checkout step in comment_trigger_phrases job.
dannymartinm Sep 19, 2022
cc9e426
Check out code from RELEASE_BRANCH in Commenting Trigger Phrases.
dannymartinm Sep 19, 2022
6640399
Adding, Install hub cli tool step
dannymartinm Sep 20, 2022
45c0c6a
Print gh actions variables
dannymartinm Sep 20, 2022
daf09ad
Print gh actions config
dannymartinm Sep 20, 2022
25f94bd
Using hub in GH-hosted runner.
dannymartinm Sep 20, 2022
645617e
Testing pr creation in apache repo. Commented code.
dannymartinm Sep 20, 2022
47d2b13
Create the PR in testing org.
dannymartinm Sep 20, 2022
cd5f50f
Removing workflow permissions
dannymartinm Sep 22, 2022
a6056ec
Removed owner from head branch.
dannymartinm Sep 22, 2022
d788c05
Adding setup-gh-cli as an composite action.
dannymartinm Sep 23, 2022
0d03675
Created a setup-gh-cli-linux composite action. Updated verify_release…
dannymartinm Sep 23, 2022
185c9f4
Merge remote-tracking branch 'origin/verify-release-workflow' into ve…
dannymartinm Sep 23, 2022
a1f74f7
Updated sh file to comment the real trigger phrases insted of the exa…
dannymartinm Sep 26, 2022
dce2608
Updated jenkins_trigger_phrases.txt file using the Jobs that have not…
dannymartinm Sep 27, 2022
b425e14
Merge branch 'apache:master' into verify-release-workflow
dannymartinm Sep 27, 2022
3b0106b
Added Verify Release Build workflow in CI.md doc.
dannymartinm Sep 27, 2022
76d8fbf
Updated comment_pr_trigger_phrases file to point to mass_comment file.
dannymartinm Sep 27, 2022
78da986
Commented with Apache License in verify_release_build.yml and comment…
dannymartinm Sep 27, 2022
1245874
Removed unused code in inputs vars in verify_release_build.yml
dannymartinm Sep 27, 2022
2764d43
Added blank line at the end of txt files to remove RAT issue.
dannymartinm Sep 27, 2022
170d3a8
Moved trigger_phrases txt files into /test/resources folder.
dannymartinm Oct 5, 2022
de6e130
Update CI.md, removing Jenkins word to make it generic.
dannymartinm Oct 5, 2022
0d8424e
Adding script for branch validation.
dannymartinm Oct 14, 2022
cc9064a
Removing unused word.
dannymartinm Oct 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/actions/setup-gh-cli-linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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.

name: 'Setup GH CLI - Linux'
description: 'Setup GitHub CLI tool in a Linux Operating System.'
runs:
using: "composite"
steps:
- id: setup-gh-cli-linux
shell: bash
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
gh --version
82 changes: 82 additions & 0 deletions .github/workflows/verify_release_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 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.

# To learn more about GitHub Actions in Apache Beam check the CI.md

name: Verify Release Build
on:
workflow_dispatch:
inputs:
RELEASE_VER:
description: Beam version of current release
required: true
COMMENT_TRIGGER_PHRASES:
description: Flag to comment the Jenkins Trigger Phrases in the new PR
required: true
env:
WORKING_BRANCH: postcommit_validation_pr
jobs:
verify_release:
runs-on: [self-hosted, ubuntu-20.04]
permissions:
pull-requests: write
contents: write
env:
RELEASE_VER: ${{ github.event.inputs.RELEASE_VER }}
steps:
- name: Verify branch name
run:
- sh ./ci_check_git_branch.sh $WORKING_BRANCH
working-directory: 'scripts/ci'
- name: Set RELEASE_BRANCH env variable
run: |
RELEASE_BRANCH=release-${{env.RELEASE_VER}}
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ env.RELEASE_BRANCH }}
- name: Install gh cli
uses: ./.github/actions/setup-gh-cli-linux
- name: Set git config
run: |
git config user.name $GITHUB_ACTOR
git config user.email actions@"$RUNNER_NAME".local
- name: Set Release Version
run: |
git checkout -b ${{env.WORKING_BRANCH}} --quiet
/bin/bash release/src/main/scripts/set_version.sh "$RELEASE_VER" --git-add
# In case the version string was not changed, append a newline to CHANGES.md
echo "" >> CHANGES.md
- name: Push Changes in ${{ env.WORKING_BRANCH }} Branch
run: |
git add CHANGES.md
git commit -m "Changed version.py and gradle.properties to python dev version to create a test PR" --quiet
git push origin $WORKING_BRANCH --quiet
- name: Create new Release PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GITHUB_PR_URL=$(gh pr create -B ${{env.RELEASE_BRANCH}} -H ${{env.WORKING_BRANCH}} -t "[DO NOT MERGE] Run all PostCommit and PreCommit Tests against Release Branch" -b "Run Gradle Release Build and Jenkins PreCommit and PostCommits tests automatically in this PR (refer to scripts/ci/release/mass_comment.txt). Please run the missing tests manually.")
# Run Gradle Release Build and PostCommit/PreCommit Tests against Release Branch on Jenkins.
- name: Comment Jenkins Trigger Phrases in PR
if: ${{ github.event.inputs.COMMENT_TRIGGER_PHRASES == 'true' }}
run: |
sh ./comment_pr_trigger_phrases.sh $GITHUB_PR_URL
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: 'scripts/ci/release'
7 changes: 7 additions & 0 deletions CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ Service Account shall have following permissions ([IAM roles](https://cloud.goog
| Java Wordcount Direct Runner | Runs Java WordCount example with Direct Runner. | Yes | Yes | Yes | - |
| Java Wordcount Dataflow | Runs Java WordCount example with DataFlow Runner. | - | Yes | Yes | Yes |

### Release Preparation and Validation Workflows
#### Verify Release Build - [verify_release_build.yml](.github/workflows/verify_release_build.yml)
| Job | Description | Pull Request Run | Direct Push/Merge Run | Scheduled Run | Requires GCP Credentials |
|------------------------------|-----------------------------------------------------------------------------------------------|------------------|-----------------------|---------------|--------------------------|
| Verify Release Build | Verifies full life cycle of Gradle Build and all PostCommit/PreCommit tests against Release Branch on CI. | No | No | No | No |


### All migrated workflows run based on the following triggers

| Description | Pull Request Run | Direct Push/Merge Run | Scheduled Run | Workflow Dispatch |
Expand Down
33 changes: 33 additions & 0 deletions scripts/ci/ci_check_git_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# 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.

function is_branch() {
#if nothing matches show-ref will return an error code of 1
if git show-ref --quiet --verify -- "refs/heads/$1" ; then
return 1
else
return 0
fi
}

if is_branch "$1"; then
echo "Branch [$1] doesn't exist."
else
echo "Branch [$1] already exists!"
echo >&2 "Please make sure your branch doesn't exist."
fi
26 changes: 26 additions & 0 deletions scripts/ci/release/comment_pr_trigger_phrases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# 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.
#
# This script adds comments from a txt file, in the given GitHub Pull Request.
# test/resources/mass_comment.txt file has the Trigger Phrases for running Gradle Build and PostCommit/PreCommit tests.

file="./test/resources/mass_comment.txt"
GITHUB_PR=$1
while IFS= read -r trigger_phrase
do
gh pr comment "$GITHUB_PR" --body "$trigger_phrase"
Copy link
Copy Markdown
Contributor

@damccorm damccorm Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennknowles this approach probably won't work with the migration to GHA. Do we have work planned to make this script/process work with GHA?

This is out of scope for the current pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally, that's why I was thinking on having for the moment the jenkins_trigger_phrases.txt which includes the trigger phrases of the Jenkins Jobs that won't be migrated to GitHub Actions in this first iteration/migration.

On the other hand, if you think commenting is out of scope and it would be better to not have it yet, I can remove the Comment Jenkins Trigger Phrases in PR step of the workflow.

Thank you!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving it in is the right thing. My point is just that once we've fully migrated to GHA, AFAIK we won't have trigger phrases available to us and that functionality will need to be replaced in this process.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. I think it would be great to start thinking of some GHA triggers out of the Continuous Integration ones.
Thanks Danny for your comments!

done <"$file"
19 changes: 19 additions & 0 deletions scripts/ci/release/test/resources/jenkins_trigger_phrases.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Run Release Gradle Build
Run CommunityMetrics PreCommit
Run Direct ValidatesRunner Java 11
Run Direct ValidatesRunner Java 17
Run Java 11 Examples on Dataflow Runner V2
Run Java 17 Examples on Dataflow Runner V2
Run Java PreCommit
Run Java examples on Dataflow Java 11
Run Java examples on Dataflow Java 17
Run Javadoc PostCommit
Run Jpms Dataflow Java 17 PostCommit
Run Jpms Direct Java 17 PostCommit
Run Python Flink ValidatesRunner
Run Python PreCommit
Run Python Samza ValidatesRunner
Run Python Spark ValidatesRunner
Run SQL_Java17 PreCommit
Run XVR_Flink PostCommit
Run XVR_GoUsingJava_Dataflow PostCommit
103 changes: 103 additions & 0 deletions scripts/ci/release/test/resources/mass_comment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Run Release Gradle Build
Run CommunityMetrics PreCommit
Run Dataflow Runner Nexmark Tests
Run Dataflow Runner V2 Java 11 Nexmark Tests
Run Dataflow Runner V2 Java 17 Nexmark Tests
Run Dataflow Runner V2 Nexmark Tests
Run Dataflow Streaming ValidatesRunner
Run Dataflow ValidatesRunner Java 11
Run Dataflow ValidatesRunner Java 17
Run Dataflow ValidatesRunner
Run Direct Runner Nexmark Tests
Run Direct ValidatesRunner Java 11
Run Direct ValidatesRunner Java 17
Run Direct ValidatesRunner in Java 11
Run Direct ValidatesRunner
Run Flink Runner Nexmark Tests
Run Flink ValidatesRunner Java 11
Run Flink ValidatesRunner
Run Go Flink ValidatesRunner
Run Go PostCommit
Run Go PreCommit
Run Go Samza ValidatesRunner
Run Go Spark ValidatesRunner
Run GoPortable PreCommit
Run Java 11 Examples on Dataflow Runner V2
Run Java 17 Examples on Dataflow Runner V2
Run Java Dataflow V2 ValidatesRunner Streaming
Run Java Dataflow V2 ValidatesRunner
Run Java Examples on Dataflow Runner V2
Run Java Examples_Direct
Run Java Examples_Flink
Run Java Examples_Spark
Run Java Flink PortableValidatesRunner Streaming
Run Java Portability examples on Dataflow with Java 11
Run Java PostCommit
Run Java PreCommit
Run Java Samza PortableValidatesRunner
Run Java Spark PortableValidatesRunner Batch
Run Java Spark v2 PortableValidatesRunner Streaming
Run Java Spark v3 PortableValidatesRunner Streaming
Run Java examples on Dataflow Java 11
Run Java examples on Dataflow Java 17
Run Java examples on Dataflow with Java 11
Run Java_Examples_Dataflow PreCommit
Run Java_Examples_Dataflow_Java11 PreCommit
Run Java_Examples_Dataflow_Java17 PreCommit
Run Java_PVR_Flink_Batch PreCommit
Run Java_PVR_Flink_Docker PreCommit
Run Javadoc PostCommit
Run Jpms Dataflow Java 11 PostCommit
Run Jpms Dataflow Java 17 PostCommit
Run Jpms Direct Java 11 PostCommit
Run Jpms Direct Java 17 PostCommit
Run Jpms Flink Java 11 PostCommit
Run Jpms Spark Java 11 PostCommit
Run PortableJar_Flink PostCommit
Run PortableJar_Spark PostCommit
Run Portable_Python PreCommit
Run PostCommit_Java_Dataflow
Run PostCommit_Java_DataflowV2
Run PostCommit_Java_Hadoop_Versions
Run Python 3.7 PostCommit
Run Python 3.8 PostCommit
Run Python 3.9 PostCommit
Run Python Dataflow V2 ValidatesRunner
Run Python Dataflow ValidatesContainer
Run Python Dataflow ValidatesRunner
Run Python Examples_Dataflow
Run Python Examples_Direct
Run Python Examples_Flink
Run Python Examples_Spark
Run Python Flink ValidatesRunner
Run Python PreCommit
Run Python Samza ValidatesRunner
Run Python Spark ValidatesRunner
Run PythonDocker PreCommit
Run PythonDocs PreCommit
Run PythonFormatter PreCommit
Run PythonLint PreCommit
Run Python_PVR_Flink PreCommit
Run RAT PreCommit
Run SQL PostCommit
Run SQL PreCommit
Run SQL_Java11 PreCommit
Run SQL_Java17 PreCommit
Run Samza ValidatesRunner
Run Spark Runner Nexmark Tests
Run Spark StructuredStreaming ValidatesRunner
Run Spark ValidatesRunner Java 11
Run Spark ValidatesRunner
Run Spotless PreCommit
Run Twister2 ValidatesRunner
Run Typescript PreCommit
Run ULR Loopback ValidatesRunner
Run Whitespace PreCommit
Run XVR_Direct PostCommit
Run XVR_Flink PostCommit
Run XVR_JavaUsingPython_Dataflow PostCommit
Run XVR_PythonUsingJavaSQL_Dataflow PostCommit
Run XVR_PythonUsingJava_Dataflow PostCommit
Run XVR_Samza PostCommit
Run XVR_Spark PostCommit
Run XVR_Spark3 PostCommit