Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jenkins job to require maintainer trigger #1238

Merged

Conversation

lewijacn
Copy link
Collaborator

@lewijacn lewijacn commented Jan 17, 2025

Description

Require maintainer trigger on Jenkins jobs

pull_request_target events are special: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository

With changes...

When a maintainer creates a PR, pushes a change, or retries the Jenkins action on their own PR, the action will execute as normal:
image

However, when a non-maintainer performs any action that would trigger the Jenkins action (same as list above), the action will fail early with error message:
image

Issues Resolved

N/A

Testing

Personal fork testing

Check List

  • New functionality includes testing
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Tanner Lewis <[email protected]>
Signed-off-by: Tanner Lewis <[email protected]>
@lewijacn lewijacn force-pushed the enforce-maintainer-jenkins branch from bf718f4 to 607bf5a Compare January 17, 2025 15:38
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.39%. Comparing base (a980069) to head (607bf5a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1238   +/-   ##
=========================================
  Coverage     80.39%   80.39%           
  Complexity     3094     3094           
=========================================
  Files           424      424           
  Lines         15742    15742           
  Branches       1066     1066           
=========================================
  Hits          12655    12655           
  Misses         2435     2435           
  Partials        652      652           
Flag Coverage Δ
unittests 80.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

This approach won't run these tests when non-maintainers are making changes, that doesn't seem correct. Please check with @opensearch-project/engineering-effectiveness for if we have an incorrect setting in GitHub Action system

@peternied
Copy link
Member

peternied commented Jan 17, 2025

If you look at your fork's settings for GitHub Actions - you can see this setting that seems relevant:
image

^ I think this setting is the desired configuration

@lewijacn
Copy link
Collaborator Author

If you look at your fork's settings for GitHub Actions - you can see this setting that seems relevant: image

^ I think this setting is the desired configuration

I'm pretty sure this setting is already enabled, since all of our other Github actions require maintainer approval before they will run. This one uses pull_request_target which is considered safe since it uses the base context, and bypasses this approval: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#controlling-changes-from-forks-to-workflows-in-public-repositories

@gaiksaya
Copy link
Member

The current setting in this repo is as below:
image
Let me know if that needs to change to Require approval for all external contributors I believe this applies to all workflows and not just one.

@peternied peternied merged commit 3f0209e into opensearch-project:main Jan 17, 2025
22 checks passed
@peterzhuamazon
Copy link
Member

A working example in the ml repo might be good to try:

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants