Skip to content

Comments

Create Github Action to validate PR Test success#1715

Merged
TravisStark merged 1 commit intomainfrom
tjstark/github-pr-ruleset
Jun 6, 2025
Merged

Create Github Action to validate PR Test success#1715
TravisStark merged 1 commit intomainfrom
tjstark/github-pr-ruleset

Conversation

@TravisStark
Copy link
Contributor

@TravisStark TravisStark commented Jun 3, 2025

Description of the issue

To require integration test success prior to PR merge, we need to add a required status check that only passes if the test workflow completes.

Note: Investigated blocking PR merge based on a workflow success using rulesets is only available to Github Enterprise accounts
https://docs.github.com/en/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#require-workflows-to-pass-before-merging

Description of changes

Create new jobs on the PR Build and PR Test workflows to validate prior job success on workflow completion.

  • Verify All PR Test Jobs
  • Verify All PR Build Jobs

The Verify All PR Test Jobs action will be added to the required status checks in the branch protection settings after this PR is merged and the job runs successfully.

Added BuildAndUpload as a required dependency of the EC2SELinuxIntegrationTest job

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Validated on this PR

https://github.com/aws/amazon-cloudwatch-agent/actions/runs/15494936344/job/43630356781?pr=1715

Job output for Verify All PR Build Jobs (PR Tests are not passing consistently currently)

Successfully validated jobs:
test-data-race
build
changes
lint

All required jobs completed without failures!

Sample failing case:

Successfully validated jobs:
BuildAndUpload
CheckLabel
EC2SELinuxIntegrationTest
GenerateTestMatrix
OutputEnvVariables
StartLocalStack
StopLocalStack

Failed jobs:
EC2LinuxIntegrationTest

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@TravisStark TravisStark requested a review from a team as a code owner June 3, 2025 14:47
@TravisStark TravisStark added the ready for testing Indicates this PR is ready for integration tests to run label Jun 3, 2025
@TravisStark TravisStark changed the title tjstark/github pr ruleset Create Github Action to validate PR Test success Jun 3, 2025
@TravisStark TravisStark force-pushed the tjstark/github-pr-ruleset branch from 845e6a5 to 2804f3c Compare June 3, 2025 22:29
@TravisStark TravisStark added ready for testing Indicates this PR is ready for integration tests to run and removed ready for testing Indicates this PR is ready for integration tests to run labels Jun 5, 2025
@TravisStark TravisStark force-pushed the tjstark/github-pr-ruleset branch from 0f03cff to 0d98e84 Compare June 6, 2025 15:07
- name: Check Job Status
run: |
declare -A job_statuses=(
["changes"]="${{ needs.changes.result }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be changed into a for loop to make it reusable? It seems like the rest of the validation is identical here and in the other file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try that out.

agarakan
agarakan previously approved these changes Jun 6, 2025
Copy link
Contributor

@agarakan agarakan left a comment

Choose a reason for hiding this comment

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

All comments minor, logic looks good. approved

@TravisStark TravisStark force-pushed the tjstark/github-pr-ruleset branch from d7dcb28 to 468befd Compare June 6, 2025 16:12
@TravisStark TravisStark requested a review from agarakan June 6, 2025 16:32
Copy link
Contributor

@agarakan agarakan left a comment

Choose a reason for hiding this comment

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

Looks clean, maybe a future iteration can be about consolidating these into a common function that both workflows invoke.

@TravisStark TravisStark merged commit 265291a into main Jun 6, 2025
181 of 183 checks passed
@TravisStark TravisStark deleted the tjstark/github-pr-ruleset branch June 6, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants