package org.jenkinsci.plugins.p4.groovy; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.model.Item; import hudson.model.Run; import hudson.model.TaskListener; import hudson.util.ListBoxModel; import org.jenkinsci.plugins.p4.credentials.P4CredentialsImpl; import org.jenkinsci.plugins.p4.workspace.Workspace; import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl; import org.jenkinsci.plugins.workflow.steps.AbstractStepImpl; import org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution; import org.jenkinsci.plugins.workflow.steps.StepContextParameter; import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import javax.inject.Inject; public class GetP4Step extends AbstractStepImpl { private final String credential; private final Workspace workspace; public String getCredential() { return credential; } public Workspace getWorkspace() { return workspace; } @DataBoundConstructor public GetP4Step(String credential, Workspace workspace) { this.credential = credential; this.workspace = workspace; } @Extension(optional = true) public static final class DescriptorImpl extends AbstractStepDescriptorImpl { public DescriptorImpl() { super(P4RunCommandStepExecution.class); } @Override public String getFunctionName() { return "p4"; } @Override public String getDisplayName() { return "P4 Groovy (BETA)"; } public ListBoxModel doFillCredentialItems(@AncestorInPath Item project, @QueryParameter String credential) { return P4CredentialsImpl.doFillCredentialItems(project, credential); } } public static class P4RunCommandStepExecution extends AbstractSynchronousStepExecution<P4Groovy> { private static final long serialVersionUID = 1L; @Inject private transient GetP4Step step; @StepContextParameter private transient Run<?, ?> run; @StepContextParameter private transient FilePath workspace; @StepContextParameter private transient TaskListener listener; @StepContextParameter private transient Launcher launcher; @Override protected P4Groovy run() throws Exception { GetP4 p4Groovy = new GetP4(step.getCredential(), step.getWorkspace()); p4Groovy.perform(run, workspace, launcher, listener); return p4Groovy.getP4Groovy(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 21999 | Paul Allen | Remove BETA mark from p4 groovy. | ||
#2 | 21994 | Paul Allen |
Update P4Groovy to use Step and not AbstractStepImpl. Minor fix to test UX for displaying workspace/email in change summary. |
||
#1 | 21940 | Paul Allen | Branching using p4-jenkins | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/groovy/GetP4Step.java | |||||
#3 | 21794 | Paul Allen |
Merge pull request #39 from Dohbedoh/JENKINS-34825 Jenkins 34825 |
||
#2 | 20783 | Paul Allen | Tidy up and mark as BETA | ||
#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). |