Here is my Jenkinsfile, minus the variable declarations...
podTemplate(label: label, containers: [
containerTemplate(name: 'kubectl', image:
"$registry/kubectl:latest", command: 'cat', ttyEnabled: true),
containerTemplate(name: 'helm', image: "$registry/helm:latest",
command: 'cat', ttyEnabled: true),
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath:
'/var/run/docker.sock')
]) {
node(label) {
def myRepo = checkout scm
def gitCommit = myRepo.GIT_COMMIT
def gitBranch = myRepo.GIT_BRANCH
def shortGitCommit = "${gitCommit[0..10]}"
def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~",
returnStdout: true)
stage('Create Docker images') {
container('jnlp') { // inheriteed container
checkout scm
def dockerImage = "$image:${gitCommit}"
def dockerLatest = "$image:latest"
def dockerfile = 'base.Dockerfile'
docker.withRegistry("", "$credentials") {
docker.build(dockerImage, "-f ${dockerfile} .")
docker.build(dockerLatest, "-f ${dockerfile} .")
docker.image(dockerImage).push()
docker.image(dockerLatest).push()
}
}
}
stage('Run kubectl') {
container('kubectl') {
sh """
kubectl get pods
"""
}
}
stage('Run helm') {
container('helm') {
sh """
helm list
"""
}
}
}
}
I get the below error whenever the second stage starts. It's as if the
stages are sharing their contents as any scripts i put in the first stage,
appear in the other containers (all three, including the default jnlp
container). As soon as stage 1 completes, those contents are wiped, and it
throws this error.
What am I doing wrong?
[h_ci-cd_dev_2018-08-13-kube-B25Q2OMNNSNLLVD3BXC7FMQBF3IKQYJE4OSTUSVSM65SZ6NCGBAQ]
Running shell script
sh:
/home/jenkins/workspace/h_ci-cd_dev_2018-08-13-kube-B25Q2OMNNSNLLVD3BXC7FMQBF3IKQYJE4OSTUSVSM65SZ6NCGBAQ@tmp/durable-48affede/script.sh:
not found
script returned exit code 127
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CACTWNKDyoxoixjZq1FJ5NUOTGB9dUJkgCBStPWYQkCzsr-53Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.