Skip to content

Commit

Permalink
Merge pull request jenkinsci#709 from keymux/keymux-master
Browse files Browse the repository at this point in the history
Implement the DSL for commentFilePath to fix jenkinsci#514
  • Loading branch information
bjoernhaeuser authored Oct 21, 2018
2 parents d4211c1 + 94f7a5d commit a438acd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ job('upstreamJob') {
blackListLabels(['baz'])
allowMembersOfWhitelistedOrgsAsAdmin()
extensions {
commentFilePath {
commentFilePath("relative/path/to/file")
}
commitStatus {
context('deploy to staging site')
triggeredStatus('starting deployment to staging site...')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.jenkinsci.plugins.ghprb.jobdsl;

import javaposse.jobdsl.dsl.Context;

class GhprbCommentFilePathContext implements Context {
private String commentFilePath;

public String getCommentFilePath() {
return commentFilePath;
}

/**
* sets the path to the comment file
*/
public void commentFilePath(String commentFilePath) {
this.commentFilePath = commentFilePath;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.jenkinsci.plugins.ghprb.extensions.GhprbExtension;
import org.jenkinsci.plugins.ghprb.extensions.build.GhprbCancelBuildsOnUpdate;
import org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildStatus;
import org.jenkinsci.plugins.ghprb.extensions.comments.GhprbCommentFile;
import org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus;

import java.util.ArrayList;
Expand Down Expand Up @@ -41,6 +42,16 @@ void buildStatus(Runnable closure) {
extensions.add(new GhprbBuildStatus(context.getCompletedStatus()));
}

/**
* Adds comment file path handling
*/
void commentFilePath(Runnable closure) {
GhprbCommentFilePathContext context = new GhprbCommentFilePathContext();
ContextExtensionPoint.executeInContext(closure, context);

extensions.add(new GhprbCommentFile(context.getCommentFilePath()));
}

/**
* Overrides global settings for cancelling builds when a PR was updated
*/
Expand Down

0 comments on commit a438acd

Please sign in to comment.