Skip to content

Commit

Permalink
Reproduce JENKINS-42473 failure.
Browse files Browse the repository at this point in the history
Required bumping git plugin version, running in a folder, and making
the git plugin a direct dependency rather than a test dependency. phew.
  • Loading branch information
abayer committed Mar 4, 2017
1 parent 944d34f commit b4bd7fd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pipeline-model-definition/pom.xml
Expand Up @@ -119,7 +119,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<scope>test</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
Expand Down
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.pipeline.modeldefinition;

import com.cloudbees.hudson.plugins.folder.Folder;
import com.google.common.base.Predicate;
import hudson.model.Result;
import hudson.model.Slave;
Expand All @@ -43,6 +44,7 @@
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.graphanalysis.DepthFirstScanner;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.libs.FolderLibraries;
import org.jenkinsci.plugins.workflow.libs.GlobalLibraries;
import org.jenkinsci.plugins.workflow.libs.LibraryConfiguration;
import org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever;
Expand Down Expand Up @@ -533,6 +535,43 @@ public void librariesDirective() throws Exception {
.go();
}

@Issue("JENKINS-42473")
@Test
public void folderLibraryParsing() throws Exception {
otherRepo.init();
otherRepo.git("checkout", "-b", "test");
otherRepo.write("src/org/foo/Zot.groovy", "package org.foo;\n" +
"\n" +
"class Zot implements Serializable {\n" +
" def steps\n" +
" Zot(steps){\n" +
" this.steps = steps\n" +
" }\n" +
" def echo(msg) {\n" +
" steps.sh \"echo ${msg}\"\n" +
" }\n" +
"}\n");
otherRepo.git("add", "src");
otherRepo.git("commit", "--message=init");
Folder folder = j.jenkins.createProject(Folder.class, "testFolder");
LibraryConfiguration echoLib = new LibraryConfiguration("zot-stuff",
new SCMSourceRetriever(new GitSCMSource(null, otherRepo.toString(), "", "*", "", true)));
folder.getProperties().add(new FolderLibraries(Collections.singletonList(echoLib)));

WorkflowRun firstRun = expect("folderLibraryParsing")
.inFolder(folder)
.logContains("hello")
.go();

WorkflowRun secondRun = firstRun.getParent().scheduleBuild2(0).waitForStart();
j.assertBuildStatusSuccess(j.waitForCompletion(secondRun));
ExecutionModelAction action = secondRun.getAction(ExecutionModelAction.class);
assertNotNull(action);
ModelASTStages stages = action.getStages();
assertNull(stages.getSourceLocation());
assertNotNull(stages);
}

@Issue("JENKINS-40657")
@Test
public void libraryObjectInScript() throws Exception {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -173,7 +173,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.6.0</version>
<version>3.0.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
Expand All @@ -184,7 +184,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.6.0</version>
<version>3.0.1</version>
<classifier>tests</classifier>
<exclusions>
<exclusion>
Expand Down

0 comments on commit b4bd7fd

Please sign in to comment.