package org.jenkinsci.plugins.p4.workflow; import com.google.common.collect.ImmutableSet; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.model.Run; import hudson.model.TaskListener; import org.jenkinsci.Symbol; import org.jenkinsci.plugins.p4.tagging.TagNotifierStep; import org.jenkinsci.plugins.workflow.steps.Step; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.StepDescriptor; import org.jenkinsci.plugins.workflow.steps.StepExecution; import org.jenkinsci.plugins.workflow.steps.SynchronousStepExecution; import org.kohsuke.stapler.DataBoundConstructor; import javax.annotation.Nonnull; import java.util.Set; public class P4TaggingStep extends Step { private final String rawLabelName; private final String rawLabelDesc; @DataBoundConstructor public P4TaggingStep(String rawLabelName, String rawLabelDesc) { this.rawLabelName = rawLabelName; this.rawLabelDesc = rawLabelDesc; } public String getRawLabelName() { return rawLabelName; } public String getRawLabelDesc() { return rawLabelDesc; } @Override public StepExecution start(StepContext context) { return new P4TaggingStepExecution(context, this); } @Extension(optional = true) @Symbol("label") public static final class DescriptorImpl extends StepDescriptor { @Override public Set<? extends Class<?>> getRequiredContext() { return ImmutableSet.of(Run.class, FilePath.class, TaskListener.class, EnvVars.class); } @Override public String getFunctionName() { return "p4tag"; } @Override public String getDisplayName() { return "P4 Tag"; } } public static class P4TaggingStepExecution extends SynchronousStepExecution<Void> { private static final long serialVersionUID = 1L; private transient P4TaggingStep step = null; protected P4TaggingStepExecution(@Nonnull StepContext context, P4TaggingStep step) { super(context); this.step = step; } @Override protected Void run() throws Exception { TagNotifierStep notifier = new TagNotifierStep(step.getRawLabelName(), step.getRawLabelDesc(), false); notifier.perform(getContext().get(Run.class), getContext().get(FilePath.class), getContext().get(Launcher.class), getContext().get(TaskListener.class)); return null; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 28463 | Paul Allen |
FindBugs error: SE_TRANSIENT_FIELD_NOT_RESTORED (transient but isn't set by deserialisation) |
||
#4 | 26673 | Paul Allen |
Code cleanup - remove calls to Deprecated methods - Deprecated classes like AbstractStepImpl, AbstractStepDescriptorImpl and AbstractSynchronousStepExecution for P4TaggingStep |
||
#3 | 22684 | Paul Allen | Added @Symbol to Extension classes for Pipeline Syntax. | ||
#2 | 15403 | Paul Allen |
Perforce triggered polling BETA. Perforce triggers on a change-submit and sends a POST to the endpoint http://${JENKINS}/p4/change with the data: {"change":"12345","p4port":"localhost:1666"} Note: ‘change’ is not used (yet), but ‘p4port’ MUST match the credential in the Jenkins Job. JENKINS-25249 |
||
#1 | 15394 | Paul Allen |
Workflow-DSL functionality. Tested workflow DSL against 1.596.1 older functionality tested against 1.580.1 @sven_erik_knop |
||
//guest/sven_erik_knop/p4jenkins/src/main/java/org/jenkinsci/plugins/p4/workflow/P4TaggingStep.java | |||||
#1 | 14133 | Sven Erik Knop | Added p4tag to the DSL part |