Skip to content
Permalink
Browse files
Merge pull request #124 from abayer/jenkins-42286
[FIXED JENKINS-42286] Allow dir separator in Dockerfile name
  • Loading branch information
abayer committed Feb 27, 2017
2 parents b20a621 + d65281d commit faa4b12cea651228a212d92943bfcea7a78a9b43
@@ -588,13 +588,6 @@ class ModelValidatorImpl implements ModelValidator {
}
}
map.variables.each { k, v ->
// TODO: JENKINS-41746 - get rid of this hardcoding and use extensible validation instead once we can
if (typeName == "dockerfile") {
if (k.key == "filename" && (v.toGroovy().contains("/") || v.toGroovy().contains("\\"))) {
errorCollector.error(k, Messages.ModelValidatorImpl_DirSeparatorInDockerfileName())
valid = false
}
}
// Make sure we don't actually include "context" in the valid param names, since, well, it's
// not really one.
List<String> validParamNames = model.parameters.collect { it.name }
@@ -218,6 +218,26 @@ public void fromDockerfileInOtherDir() throws Exception {
.go();
}

@Issue("JENKINS-42286")
@Test
public void dirSepInDockerfileName() throws Exception {
assumeDocker();
// Bind mounting /var on OS X doesn't work at the moment
onAllowedOS(PossibleOS.LINUX);

sampleRepo.write("subdir/Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
sampleRepo.git("init");
sampleRepo.git("add", "subdir/Dockerfile");
sampleRepo.git("commit", "--message=Dockerfile");

expect("fromDockerfileInOtherDir")
.logContains("[Pipeline] { (foo)",
"The answer is 42",
"-v /tmp:/tmp -p 8000:8000",
"HI THERE")
.go();
}

@Test
public void fromDockerfileNoArgs() throws Exception {
assumeDocker();
@@ -484,14 +484,6 @@ public void notificationsSectionRemoved() throws Exception {
.go();
}

@Issue("JENKINS-41668")
@Test
public void dirSepInDockerfileName() throws Exception {
expectError("dirSepInDockerfileName")
.logContains(Messages.ModelValidatorImpl_DirSeparatorInDockerfileName())
.go();
}

@Issue("JENKINS-41645")
@Test
public void invalidEnvironmentIdentifiers() throws Exception {
@@ -25,7 +25,7 @@
pipeline {
agent {
dockerfile {
filename "Dockerfile/alternate"
filename "subdir/Dockerfile"
args "-v /tmp:/tmp -p 8000:8000"
}
}

0 comments on commit faa4b12

Please sign in to comment.