use of hudson.plugins.git.SubmoduleConfig in project workflow-cps-plugin by jenkinsci.
the class CpsScmFlowDefinitionTest method usingParameter.
@Issue("JENKINS-28447")
@Test
public void usingParameter() throws Exception {
sampleRepo.init();
sampleRepo.write("flow.groovy", "echo 'version one'");
sampleRepo.git("add", "flow.groovy");
sampleRepo.git("commit", "--message=one");
sampleRepo.git("tag", "one");
sampleRepo.write("flow.groovy", "echo 'version two'");
sampleRepo.git("commit", "--all", "--message=two");
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
CpsScmFlowDefinition def = new CpsScmFlowDefinition(new GitSCM(Collections.singletonList(new UserRemoteConfig(sampleRepo.fileUrl(), null, null, null)), Collections.singletonList(new BranchSpec("${VERSION}")), false, Collections.<SubmoduleConfig>emptyList(), null, null, Collections.<GitSCMExtension>emptyList()), "flow.groovy");
// TODO SCMFileSystem.of cannot pick up build parameters
def.setLightweight(false);
p.setDefinition(def);
p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("VERSION", "master")));
r.assertLogContains("version two", r.assertBuildStatusSuccess(p.scheduleBuild2(0)));
r.assertLogContains("version one", r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("VERSION", "one")))));
}
use of hudson.plugins.git.SubmoduleConfig in project workflow-cps-plugin by jenkinsci.
the class CpsScmFlowDefinitionTest method usingParameterInScriptPath.
@Issue("JENKINS-42836")
@Test
public void usingParameterInScriptPath() throws Exception {
sampleRepo.init();
sampleRepo.write("flow.groovy", "echo 'version one'");
sampleRepo.git("add", "flow.groovy");
sampleRepo.write("otherFlow.groovy", "echo 'version two'");
sampleRepo.git("add", "otherFlow.groovy");
sampleRepo.git("commit", "--all", "--message=commits");
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
CpsScmFlowDefinition def = new CpsScmFlowDefinition(new GitSCM(Collections.singletonList(new UserRemoteConfig(sampleRepo.fileUrl(), null, null, null)), Collections.singletonList(new BranchSpec("master")), false, Collections.<SubmoduleConfig>emptyList(), null, null, Collections.<GitSCMExtension>emptyList()), "${SCRIPT_PATH}");
p.setDefinition(def);
p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("SCRIPT_PATH", "flow.groovy")));
r.assertLogContains("version one", r.assertBuildStatusSuccess(p.scheduleBuild2(0)));
r.assertLogContains("version two", r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("SCRIPT_PATH", "otherFlow.groovy")))));
}
Aggregations