2

I have one step in Jenkins called xxx-Checkout to trigger the TFS checkout and get the code, then that job triggers a pipeline which builds another job called xxx-Build. The question is how can I pass the checkout's changes to the pipeline job because with one job to other without pipelines works but in the pipeline doesn't. I can't see the changes made in the checkout job.

This is how I trigger the build:

enter image description here

And here shows me that there are no changes even though there are:

enter image description here

Jason Aller
  • 3,391
  • 28
  • 37
  • 36
Hector Scesa
  • 93
  • 1
  • 1
  • 8
  • Not clear the detail workflow for me, can you provide the sample to explain it? On the other hand, do you check the env variables for future build steps? https://wiki.jenkins.io/display/JENKINS/Parameterized+Trigger+Plugin – starian chen-MSFT Oct 02 '17 at 06:03
  • Please add the pipeline's code to your question. – Gerold Broser Dec 03 '17 at 12:17

1 Answers1

4

You can use a custom workspace for both jobs or pass the "custom workspace" as a parameter to the pipeline job.

Upstream job - Freestyle project

1) Configure a custom workspace: Go to your job > advanced > tick "Use custom workspace":

Freestyle - custom workspace

2) Trigger the pipeline job using the Parametrized Trigger Plugin.

Downstream job - Pipeline

Use the same custom workspace:

node{
    stage('build'){
       dir('D:\\Jenkins\\shared')  {
        //some code
       }      
    }
}
Gerold Broser
  • 11,355
  • 4
  • 36
  • 85
Lesly Bernaola
  • 313
  • 1
  • 12
  • All jobs shared a customo worskpace, the problem is tha job A trigger the Pipeline X, X trigger jobs B and C. I cant see the changes in jobs A,X and B but not in C. – Hector Scesa Nov 28 '17 at 20:57
  • I'm not sure I understand your comment. Do you mean you are able to share the workspace beetwen A, X and B, but not with C? – Lesly Bernaola Nov 28 '17 at 21:50