package org.jenkinsci.plugins.p4.groovy; import java.io.IOException; import org.jenkinsci.plugins.p4.workspace.Workspace; import org.kohsuke.stapler.DataBoundConstructor; import hudson.EnvVars; import hudson.FilePath; import hudson.Launcher; import hudson.model.Run; import hudson.model.TaskListener; import hudson.tasks.BuildStepMonitor; import hudson.tasks.Builder; import jenkins.tasks.SimpleBuildStep; public class GetP4 extends Builder implements SimpleBuildStep { private final String credential; private final Workspace workspace; private P4Groovy p4Groovy; public String getCredential() { return credential; } public Workspace getWorkspace() { return workspace; } public P4Groovy getP4Groovy() { return p4Groovy; } @DataBoundConstructor public GetP4(String credential, Workspace workspace) { this.credential = credential; this.workspace = workspace; } @Override public BuildStepMonitor getRequiredMonitorService() { return BuildStepMonitor.NONE; } @Override public void perform(Run<?, ?> run, FilePath buildWorkspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { // Set environment EnvVars envVars = run.getEnvironment(listener); envVars.put("NODE_NAME", envVars.get("NODE_NAME", "master")); workspace.setExpand(envVars); // Create Task GetP4Task task = new GetP4Task(credential, workspace); task.setListener(listener); p4Groovy = buildWorkspace.act(task); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 29673 | Sandeep Kumar |
Merge pull request #188 from jenkinsci/CodeRefactoring Code Cleanup |
||
#8 | 28018 | Paul Allen |
Workspace formatting for Groovy tasks. Allow the replacement of "@" in the Workspace root when running a Groovy Task. |
||
#7 | 26673 | Paul Allen |
Code cleanup - remove calls to Deprecated methods - Deprecated classes like AbstractStepImpl, AbstractStepDescriptorImpl and AbstractSynchronousStepExecution for P4TaggingStep |
||
#6 | 26236 | matthew_smeeth | Added extra debugging for executor number. | ||
#5 | 26096 | Paul Allen |
Merge pull request #108 from joel-f-brown/master Credentials handling for Folders when using P4Groovy. Use run to determine the credentials in GetP4Task, then pass the P4BaseCredentials instead of the credentials ID. Now the P4Groovy getConnection() method uses the P4BaseCredentials instead of looking up the credentials from the active Jenkins instance. JENKINS-58745 JENKINS-57314 |
||
#4 | 23192 | Paul Allen | Workaround for EXECUTOR_NUMBER not being set. | ||
#3 | 23155 | Paul Allen |
Remove Workspace cloning for better concurrent builds. Remove Workspace cloning and encourage users to make use of EXECUTOR_NUMBER in the Jenkins job name. JENKINS-41432 |
||
#2 | 21821 | Paul Allen |
Merge pull request #40 from s-sutherland/slaveexec P4Groovy execution to run on the slave |
||
#1 | 20308 | Paul Allen |
P4Groovy (experimental) Get a P4 object in groovy. Supporting basic functions: ’run’ (to run perforce commands), ‘fetch’ and ‘save’ (to access Perforce specs). |