github-branch-source-plugin
github-branch-source-plugin copied to clipboard
[JENKINS-66661] Fix fallback behavior of Fork PR trust criteria
Description
JENKINS-66661: The "Collaborators" and "From users with Admin or Write permission" trust strategies of the PR from Fork traits are breaking Indexing / event mechanism / Jenkinsfile retrieval in cases where the request fails with 401 | 403 | 404. Instead of failing the entire scan, the trust check should return that the revision is not trusted.
Submitter checklist
- [x] Link to JIRA ticket in description, if appropriate.
- [x] Change is code complete and matches issue description
- [x] Automated tests have been added to exercise the changes
- [x] Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.
Reviewer checklist
- [ ] Run the changes and verify that the change matches the issue description
- [ ] Reviewed the code
- [ ] Verified that the appropriate tests have been written or valid explanation given
Documentation changes
- [ ] Link to jenkins.io PR, or an explanation for why no doc changes are needed
Users/aliases to notify
ping @jenkinsci/github-branch-source-plugin-developers
(also see https://github.com/jenkinsci/scm-api-plugin/pull/180)
Adjusted the behavior to the following:
- on PR retrieval (org scan / branch indexing / PR event) the PR is skipped if the trust check fails with an exception
- on PR revision retrieval (get the Jenkinsfile when building a PR) the retrieval fails if the trust check fails with an exception