如何从JenkinsSlave吊舱(k8)存放到其他JenkinsSlave吊舱(k8)

时间:2019-07-25 12:23:44

标签: kubernetes jenkins-pipeline git-stash git-stage

我有两个处于同一Jenkins文件中的阶段,要求是我要在阶段('AAA')中存储一个存储库,并从阶段('BBB')中的另一个kubernetes容器中取消存储

我遇到了如下所示的代码,经过许多小时的努力,我无法修复它。

        stage('AAA') {
            steps {
                script {
                // HERE WE CLONES MANY GIT REPOSITORIES into app directory
                //Please repository is cloned to the {PWD}/app directory
                }
                dir('app') {
                stash name: "sunnyday"
                }
            }
        }
        stage('BBB') {
            agent {
                kubernetes {
                    label "dotnet"
                    yaml """
            apiVersion: v1
            kind: Pod
            metadata:
              namespace: sandbox-test
            spec:
              containers:
              - name: dotnet-core-sdk
                image: mcr.microsoft.com/dotnet/core/sdk:2.2
                imagePullPolicy: IfNotPresent
                command:
                - /bin/cat
                tty: true
            """        
                }
            }
            steps {
                container(name: "dotnet-core-sdk") {
                    unstash sunnyday
                }
            }
        }

0 个答案:

没有答案