Hi,
I have a trouble about running test code in LInux container from Jenkins.
I installed Jenkin on Windows. and wanna test source code in Linux container - which pulled from DockerHub. Any idea for that ?
i use this command in pipeline below
withDockerContainer(‘dungnt081191/ubuntu_jdk8’) {
stage(‘Backend Test’) {
try {
sh “gradlew test -PnodeInstall --no-daemon”
} catch(err) {
throw err
} finally {
junit ‘/build//TEST-*.xml’
}
}
stage('packaging') {
sh "gradlew bootRepackage -x test -Pprod -PnodeInstall --no-daemon"
archiveArtifacts artifacts: '**/build/libs/*.war', fingerprint: true
}
}
but Jenkin fail with exception:
[Pipeline] }
[Pipeline] // stage
[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:249)
at hudson.Proc$LocalProc.(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.whoAmI(DockerClient.java:310)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:184)