Jenkins pipeline share information between jobs

前端 未结 3 706
渐次进展
渐次进展 2021-01-20 21:40

We are trying to define a set of jobs on Jenkins that will do really specific actions. JobA1 will build maven project, while JobA2 will build .NET code, JobB will upload it

3条回答
  •  悲哀的现实
    2021-01-20 22:05

    The first part of your question(to pass variables between jobs) please use the below command as a post build section:

    post {
        always {
            build job:'/Folder/JobB',parameters: [string(name: 'BRANCH', value: "${params.BRANCH}")], propagate: false
        }
    }
    

    The above post build action is for all build results. Similarly, the post build action could be triggered on the current build status. I have used the BRANCH parameter from current build(JobA) as a parameter to be consumed by 'JobB' (provide the exact location of the job). Please note that there should be a similar parameter defined in JobB.

    Moreover, for sharing the workspace you can refer this link and share the workspace between the jobs.

提交回复
热议问题