Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-32391] Basic implementation of Perforce P4 plugin support.
- Loading branch information
1 parent
bc346eb
commit c0f637f
Showing
5 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/helpers/ScmContext/perforcep4.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
job('example-1') { | ||
scm { | ||
perforcep4('p4_credentials') { | ||
manual('ws_name', '//depot/Tools/build //ws_name/build') | ||
} | ||
} | ||
} | ||
|
||
job('example-2') { | ||
scm { | ||
perforcep4('p4_credentials') { | ||
manual('ws_name', '//depot/Tools/build //ws_name/build') | ||
configure { node -> | ||
node / workspace / spec / clobber('true') | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/scm/P4Context.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package javaposse.jobdsl.dsl.helpers.scm | ||
|
||
import javaposse.jobdsl.dsl.AbstractContext | ||
import javaposse.jobdsl.dsl.JobManagement | ||
|
||
import static javaposse.jobdsl.dsl.Preconditions.checkNotNull | ||
|
||
class P4Context extends AbstractContext { | ||
|
||
Node workspaceConfig | ||
Closure withXmlClosure | ||
|
||
P4Context(JobManagement jobManagement) { | ||
super(jobManagement) | ||
} | ||
|
||
/** | ||
* Set up a manual workspace with workspace name and viewspec. | ||
*/ | ||
void manual(String workspaceName, String viewspec) { | ||
checkNotNull(workspaceName, 'workspaceName must not be null') | ||
checkNotNull(viewspec, 'viewspec must not be null') | ||
|
||
workspaceConfig = new NodeBuilder().workspace(class: 'org.jenkinsci.plugins.p4.workspace.ManualWorkspaceImpl') { | ||
charset 'none' | ||
pinHost 'false' | ||
name workspaceName | ||
spec { | ||
allwrite 'false' | ||
clobber 'false' | ||
compress 'false' | ||
locked 'false' | ||
modtime 'false' | ||
rmdir 'false' | ||
streamName '' | ||
line 'LOCAL' | ||
view viewspec | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Allows direct manipulation of the generated XML. The {@code scm} node is passed into the configure block. | ||
* | ||
*/ | ||
void configure(Closure withXmlClosure) { | ||
this.withXmlClosure = withXmlClosure | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters