我正在使用kubernetes pod模板插件运行jenkins作业 .

在构建的第一阶段,我有一些文件被创建,他们正在使用pod模板A,但这些文件似乎没有被写入工作区以供其他阶段使用 .

例如,使用pod模板B的第二阶段无法在第一阶段看到模板A写入的文件 . 模板B在第二阶段将文件写入工作区,第三阶段的pod模板C可以在第二阶段查看模板B写入的文件 .

这让我相信pod模板的问题,但我已经完全将所有变量,卷安装和jnlp容器复制到我的模板A,但它仍然无法正常工作 . 如果我kubectl描述我的pod它说所有卷安装成功,任何想法或调试卷的提示安装?

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()
    }
  }
}