Skip to content

Commit

Permalink
JENKINS-30762 - Environment script fails with job name shorter than 3…
Browse files Browse the repository at this point in the history
… characters
  • Loading branch information
dawidmalina committed Nov 15, 2015
1 parent 334383d commit e325a08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/lookout/jenkins/EnvironmentScript.java
Expand Up @@ -103,8 +103,10 @@ private Environment generateEnvironment(AbstractBuild<?, ?> build,
ByteArrayOutputStream commandOutput = new ByteArrayOutputStream();
int returnCode = -1;
try {
// Make sure prefix will always be more than 3 letters
final String prefix = "env-" + build.getProject().getName();
// Create a file in the system temporary directory with our script in it.
scriptFile = ws.createTextTempFile(build.getProject().getName(), ".sh", script, false);
scriptFile = ws.createTextTempFile(prefix, ".sh", script, false);

// Then we execute the script, putting STDOUT in commandOutput.
returnCode = launcher.launch().cmds(buildCommandLine(scriptFile))
Expand Down

0 comments on commit e325a08

Please sign in to comment.