Skip to content

Commit

Permalink
Enable triggering postcommit via specific file (apache#29549)
Browse files Browse the repository at this point in the history
* Enable triggering postcommit via specific file

* address comments

* Add file path trigger approach and its context to Comment Triggering Support section
  • Loading branch information
Abacn authored Nov 30, 2023
1 parent 6c7606e commit c6c7086
Show file tree
Hide file tree
Showing 167 changed files with 356 additions and 323 deletions.
35 changes: 27 additions & 8 deletions .github/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ buildscript {
/** check that yml are valid */
task check {
doLast {
List<String> errors = []
fileTree("${project.projectDir}/workflows").matching {
include "*.yml"
include "*.yaml"
Expand All @@ -36,23 +37,41 @@ task check {
// attempt load yml to make sure its valid
def workflow = new org.yaml.snakeyaml.Yaml().load(it.newInputStream())

// additional guards for running all tests functionality
// TODO(yathu) expand this also to post commits prior teardown Jenkins postcommits
if ( fname.startsWith("beam_PreCommit")) {
// additional guards to ensure tests configured in same way
if ( fname.startsWith("beam_PreCommit") || fname.startsWith("beam_PostCommit") ) {
List paths
try {
paths = workflow.getAt(true).pull_request_target.paths as List
} catch (Exception e) {
throw new GradleException("Fail to get the trigger path for ${fname}. " +
"Make sure precommit has a pull_request_target trigger.", e)
errors.add("Fail to get the trigger path for ${fname}. " +
"Make sure it has a pull_request_target trigger.")
return
}
// precommit should triggered by this specific file

// precommit and postcommit should triggered by this specific file
// this is to ensure not missing test during release branch verification
if (paths != null && !paths.contains('release/trigger_all_tests.json')) {
throw new GradleException("Error validating ${fname}: " +
"Please add 'release/trigger_all_tests.json' to the trigger path for release verification run properly")
errors.add("Error validating ${fname}: " +
"Please add 'release/trigger_all_tests.json' to the trigger path")
return
}

// postcommit should triggered by a specific file so that there is a way to exercise post for open PR
// TODO(https://github.com/apache/beam/issues/28909)
// remove file match trigger once a better trigger (e.g. comment trigger) is implemented
if (fname.startsWith("beam_PostCommit")) {
String triggerFile = '.github/trigger_files/' + fname.take(fname.lastIndexOf('.')) + '.json'
if (paths != null && !paths.contains(triggerFile)) {
errors.add("Error validating ${fname}: " +
"Please add ${triggerFile} to the trigger path")
return
}
}
}
}
if (!errors.isEmpty()) {
throw new GradleException("Check failed: " + errors.join('\n'))
}
}
}

Expand Down
357 changes: 161 additions & 196 deletions .github/workflows/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/beam_Java_JMH.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 0 * * 0'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_Java_JMH.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Go.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Go_Dataflow_ARM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Go_Dataflow_ARM.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Go_VR_Flink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Go_VR_Flink.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Go_VR_Samza.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Go_VR_Samza.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Go_VR_Spark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Go_VR_Spark.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '0 5/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Avro_Versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Avro_Versions.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_BigQueryEarlyRollout.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_DataflowV1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_DataflowV1.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_DataflowV2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '30 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_DataflowV2.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_ARM.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_Java.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_V2.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Dataflow_V2_Java.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Examples_Direct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Direct.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Examples_Flink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Flink.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Examples_Spark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Examples_Spark.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Hadoop_Versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '45 3/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Hadoop_Versions.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_IO_Performance_Tests.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_InfluxDbIO_IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_InfluxDbIO_IT.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Dataflow_Java11.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Dataflow_Java17.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Direct_Java11.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Direct_Java17.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 */6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Direct_Java21.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Flink_Java11.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Jpms_Spark_Java11.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Dataflow.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Dataflow_V2.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '0 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Dataflow_V2_Java.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Nexmark_Direct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Direct.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Nexmark_Flink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Flink.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_Nexmark_Spark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_Nexmark_Spark.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_PVR_Flink_Streaming.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_PostCommit_Java_PVR_Samza.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_PVR_Samza.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
schedule:
- cron: '15 4/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json']
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Java_PVR_Spark3_Streaming.json']
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
Expand Down
Loading

0 comments on commit c6c7086

Please sign in to comment.