<p>It will be set after any <code>checkout</code> steps (or derivatives of <code>checkout</code> such as <code>git</code> or <code>svn</code>).</p>

<p>So for instance:</p>

<pre><code>println(currentBuild.changeSets) // should print an empty set

checkout(scm)

println(currentBuild.changeSets) // should print out any changes in the current build
</code></pre>

CC BY-SA 4.0
2023-05-15T16:06:13.143Z
I get this as output:
hudson.plugins.git.GitChangeSetList@517831da
Jeff Mattson
CC BY-SA 4.0
2018-08-17T22:04:18.243Z
2018-08-17T22:04:18.243Z
jayhendren
<p>Some background: The project I'm working on is in SVN. Very very large. A lot of tests are running on Jenkins. I want to implement a new tests which should be executed only if files in certain directory have been changed.</p>

<p>The idea that I had was:</p>

<ul>
<li>to trigger the job using a pollSCM every ten minutes</li>
<li>check the files in currentBuild.changeSets. If a file contains the directory, continue.</li>
<li>Only then I do a full checkout of the repository, compile, and run the tests.</li>
</ul>

<p>But before I write the code, I was wondering when does  currentBuild.changeSets? Will it have the required information when triggered by a pollSCM? I could not find this in the documentation</p>

<p>Yes, this could be done in a better way using git and hooks and other tools but that's what I have right now.</p>

<jenkins>
when does currentBuild.changeSets in Jenkins gets filled?
cauchi
# when does currentBuild.changeSets in Jenkins gets filled?

(Asked by: username_0 on 2018-08-16)

Some background: The project I'm working on is in SVN. Very very large. A lot of tests are running on Jenkins. I want to implement a new tests which should be executed only if files in certain directory have been changed.

The idea that I had was:

* to trigger the job using a pollSCM every ten minutes
* check the files in currentBuild.changeSets. If a file contains the directory, continue.
* Only then I do a full checkout of the repository, compile, and run the tests.

But before I write the code, I was wondering when does currentBuild.changeSets? Will it have the required information when triggered by a pollSCM? I could not find this in the documentation

Yes, this could be done in a better way using git and hooks and other tools but that's what I have right now.

**Tags:** jenkins


---

## 1 answers

### Answer by username_1 on 2018-08-17. Score: 5 | Accepted answer

It will be set after any checkout steps (or derivatives of checkout such as git or svn).
So for instance:
println(currentBuild.changeSets) // should print an empty set

checkout(scm)

println(currentBuild.changeSets) // should print out any changes in the current build

> **Comments:**
> **username_2**: I get this as output: hudson.plugins.git.GitChangeSetList@517831da  

---

