Skip to content

Commit 79a806b

Browse files
author
Marky Jackson
authored
Merge pull request #927 from Moln/fix/issues-723
Fix PipelineHookTriggerHandlerImpl, replace `hook.getProjectId()` to `hook.getProject().getId()`
2 parents 0c3b3ce + 14fc616 commit 79a806b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/pipeline/PipelineHookTriggerHandlerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected String getTriggerType() {
100100
protected CauseData retrieveCauseData(PipelineHook hook) {
101101
return causeData()
102102
.withActionType(CauseData.ActionType.PIPELINE)
103-
.withSourceProjectId(hook.getProjectId())
103+
.withSourceProjectId(hook.getProject().getId())
104104
.withBranch(getTargetBranch(hook)==null?"":getTargetBranch(hook))
105105
.withSourceBranch(getTargetBranch(hook)==null?"":getTargetBranch(hook))
106106
.withUserName(hook.getUser()==null||hook.getUser().getName()==null?"":hook.getUser().getName())
@@ -109,7 +109,7 @@ protected CauseData retrieveCauseData(PipelineHook hook) {
109109
.withSourceRepoSshUrl(hook.getRepository()==null||hook.getRepository().getGitSshUrl()==null?"":hook.getRepository().getGitSshUrl())
110110
.withSourceRepoHttpUrl(hook.getRepository()==null||hook.getRepository()==null?"":hook.getRepository().getGitHttpUrl())
111111
.withMergeRequestTitle("")
112-
.withTargetProjectId(hook.getProjectId())
112+
.withTargetProjectId(hook.getProject().getId())
113113
.withTargetBranch(getTargetBranch(hook)==null?"":getTargetBranch(hook))
114114
.withTargetRepoName("")
115115
.withTargetNamespace("")
@@ -136,7 +136,7 @@ protected RevisionParameterAction createRevisionParameter(PipelineHook hook, Git
136136
@Override
137137
protected BuildStatusUpdate retrieveBuildStatusUpdate(PipelineHook hook) {
138138
return buildStatusUpdate()
139-
.withProjectId(hook.getProjectId())
139+
.withProjectId(hook.getProject().getId())
140140
.withSha(hook.getObjectAttributes().getSha())
141141
.withRef(hook.getObjectAttributes().getRef())
142142
.build();

src/test/java/com/dabsquared/gitlabjenkins/trigger/handler/pipeline/PipelineHookTriggerHandlerImplTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public void setup() throws IOException, GitAPIException {
7070

7171
pipelineHookTriggerHandler = new PipelineHookTriggerHandlerImpl(allowedStates);
7272
pipelineHook = pipelineHook()
73-
.withProjectId(1)
7473
.withUser(user)
7574
.withRepository(repository()
7675
.withName("test")

src/test/resources/com/dabsquared/gitlabjenkins/webhook/build/PipelineEvent.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon"
2222
},
2323
"project": {
24+
"id": 1,
2425
"name": "Gitlab Test",
2526
"description": "Atque in sunt eos similique dolores voluptatem.",
2627
"web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test",

0 commit comments

Comments
 (0)