3

I am running jenkins jobs using the kubernetes pod templates plugin.

In the first stage of the build i have some files that get created and they are using pod template A, but these files seem to not be written to the workspace for other stages to use.

For instance, the second stage using pod template B can not see the files written by template A in the first stage. Template B writes files to the workspace in stage two, and pod template C in stage third can see those files written by template B in stage two.

This leads me to believe theres an issue with the pod template, but i have completely copied all variables, volume mounts, and jnlp container to my template A and yet it still doesnt work. If i kubectl describe my pod it says all volume mounts were successful, any thoughts, or tips for debugging the volume mounts?

pipeline {
  agent {
    label "jenkins-nodejs"
  }
  stages {
    stage('first stage'){
        steps{
            container('template A'){
                sh 'echo this file wont be found > fileOne.txt'
            }
        }
    }

    stage('second stage'){
        steps{
            container('template B'){
                // No file found here
                sh 'cat fileOne.txt'
                sh 'echo this file will be found > fileTwo.txt'
            }
        }
    }

    stage('third stage'){
        steps{
            container('template C'){
                // No file found here
                sh 'cat fileOne.txt'

                // File found here
                sh 'cat fileTwo.txt'
            }
        }
    }
  }
  post {
    always {
        cleanWs()
    }
  }
}
BLang
  • 930
  • 3
  • 16
  • 35
  • Did you ever find a solution to this? – Jolleyboy Apr 22 '22 at 15:16
  • 1
    Its been too long, i cant remember what happened, my other pipelines worked just fine from what i remember, so i think it was a pod template issue, but i cant remember the RCA, sorry dude!! – BLang Apr 27 '22 at 00:54
  • 1
    No worries! Thanks for reaching out :) – Jolleyboy Apr 28 '22 at 16:50
  • Hope you can find a solution to your problem! post a question if you have a pipeline issue, i like debugging jenkins issues!! – BLang Apr 30 '22 at 01:52

0 Answers0