3
votes

I'm trying to build a Jenkins Pipeline job.

My job is taking code from 2 repositories and doing some other stuff, on the end it should send email notification with changeset from first repository. Due to multiple SCM jobs it is saying that there are no changes.

How could I select to get changes from my first job?

1
Update. Now I have pipeline with only 1 step using SCM and changes still are not catched by the pipeline job.Rafael
Which SCM are you using? Git? Mercurial? Are those public or private repositories? Do you have 2FA (like help.github.com/en/github/authenticating-to-github/…) activated on the remote hosting SCM server?VonC
@VonC, I'm using SVN and Git repositories. They are private. I'm able to get the sources from the repository and I can see in single job "changes history" but not in the pipeline which is "parent" job.Rafael
Could you please provide more info about your overall setup? A screenshot of your Jenkins job would already help.B--rian
So you've a job 1 which calls 2 other jobs A and B. and each of the downstream jobs has configs to pull changes from 2 different repository respectively. And when both the downstream project run is completed, you wanted only the changesets from job A to be sent via email notifier in Job 1? Is that your question?vijay

1 Answers

0
votes

After cloning the first repository you can insert in your pipeline a stage like this:

stage("Do stuff") {
  when{
    changeset "file.js"
  }
  steps {
    script {
      //do stuff
    }
  }
}

Other examples on https://pillsfromtheweb.blogspot.com/2020/07/execute-jenkins-pipeline-step-basing-on.html