-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
Operating System: (master)Windows Server 2012 R2 64-bit, (slave/agent)amazon-linux-ami 2016.03-release 64-bit
JRE/JDK: (master) 1.8.0_20, (slave/agent) 1.8.0_45
Jenkins Verison: 2.17
Plugin Versions:
pipeline 2.2
pipeline-build-step 2.2
pipeline-input-step 2.1
pipeline-rest-api 1.7
pipeline-stage-step 2.1
pipeline-stage-view 1.7
Running as Jenkins service, not in Tomcat
Reverse Proxy: No
Jenkins Install Method: Windows Installer
Slave Deploy method: via SSH
Browser Version: Chrome - Version 53.0.2785.113 (64-bit)Operating System: (master)Windows Server 2012 R2 64-bit, (slave/agent)amazon-linux-ami 2016.03-release 64-bit JRE/JDK: (master) 1.8.0_20, (slave/agent) 1.8.0_45 Jenkins Verison: 2.17 Plugin Versions: pipeline 2.2 pipeline-build-step 2.2 pipeline-input-step 2.1 pipeline-rest-api 1.7 pipeline-stage-step 2.1 pipeline-stage-view 1.7 Running as Jenkins service, not in Tomcat Reverse Proxy: No Jenkins Install Method: Windows Installer Slave Deploy method: via SSH Browser Version: Chrome - Version 53.0.2785.113 (64-bit)
In a multi-branch pipeline using a JenkinsFile in the SCM it does not appear to be possible to execute 'sh' commands on a Linux node/agent. As per the example below, when using the 'sh' command in the JenkinsFile it causes a 'bad interpreter' error.
JenkinsFile Snippit:
node('linux-agent-1') { String jdktool = tool name: "1.7", type: 'hudson.model.JDK' withEnv(["PATH+MVN=${tool 'Maven 2'}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}"]) { stage 'Checkout' checkout scm stage 'Build' try { sh "mvn test" } catch (Exception e) { //Notification here! } }
Error from console log:
[Pipeline] node Running on linux-agent-1 in /opt/jenkins/workspace/ProjectName - TestMultiBranchPipeline/deveoper-branch-1 [Pipeline] { [Pipeline] stage (Build) Entering stage Build Proceeding [Pipeline] sh [developer-branch-1] Running shell script sh: /opt/jenkins/workspace/ProjectName - TestMultiBranchPipeline/developer-branch-1@tmp/durable-6f9c6a38/script.sh: C:\Program: bad interpreter: No such file or directory [Pipeline] }
- relates to
-
JENKINS-50902 shell pipeline step cannot use relative path to shell
- Resolved