Skip to content

Commit b33cc3a

Browse files
authored
Fix JENKINS-69719: Fetch PR data from target repo (#67)
Jenkins token permissions potentially invalid to access source repo. This is the cause of issue [JENKINS-69719](https://issues.jenkins.io/browse/JENKINS-69719). All required Gitea Pull Request data can be accessed via target repo. Replace access to potentially inaccessible source repository by references in target repository Pull Request head. ### Testing done The change affects token/credential permission scope on the Gitea server. With the changed source for data access, the `MultiBranchPipeline` scan completes. Jenkins can pull/checkout (moving) head of pull request. Resolution to commit hash is done independently in body of `GiteaSCMFileSystem` constructor.
1 parent 27294f0 commit b33cc3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/jenkinsci/plugin/gitea/GiteaSCMFileSystem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public SCMFileSystem build(@NonNull SCMSource source, @NonNull SCMHead head, @Ch
131131
String repository;
132132
String ref;
133133
if (head instanceof PullRequestSCMHead) {
134-
repoOwner = ((PullRequestSCMHead) head).getOriginOwner();
135-
repository = ((PullRequestSCMHead) head).getOriginRepository();
136-
ref = ((PullRequestSCMHead) head).getOriginName();
134+
repoOwner = src.getRepoOwner();
135+
repository = src.getRepository();
136+
ref = head.getName();
137137
} else if (head instanceof BranchSCMHead) {
138138
repoOwner = src.getRepoOwner();
139139
repository = src.getRepository();

0 commit comments

Comments
 (0)