Pending changes API call
Answered
I have a build chain set (build, test, QA, Prod)
The Prod build step is manual, and in the GUI it says the number of pending changes since the last Prod-run.
In the QA it display my pending changes if the TEST deployment failed (e.g. because of auto-tests failing)
This is very convenient so when I'm about to go live, I can easily see all the changes and files that has actually changed in my project since last deploy.
I need to get the same view from the API. How can I get that?
the app/rest/buildTypes/id:DeployToProd/builds gives me a list of all previous builds in the Production. But from here - where do I go to get the "Pending Changes" ?
Please sign in to leave a comment.
Hello Lars,
Looks like the thing I'm looking for, but I'm having serious problems in finding out what to write in the locator/buildtype/buildConfID.
Can you help me getting to what the locators are called?
The only thing I'm sure about is the name of my build, for instance
viewType.html?buildTypeId=Test_DeployToProd
In the settings the "Test_DeployToProd" is named "Build Configuration ID" and the settingspage is not disclosing any other id's
If i try the most likely scenario
guestAuth/app/rest/changes?locator=buildType:(id:Test_DeployToProd),pending=true
I'm getting an error:
Bad locator syntax: Invalid dimension name :'pending=true'. Should contain only alpha-numeric symbols or be known one
I'm running version 9.1.6 build 37459
"Test_DeployToProd" is a build configuration ID that can be used in request. Please use ":" instead of "=" in you request:
http://teamcity/app/rest/changes?locator=buildType:(id:Test_DeployToProd),pending:true
I see that now. Sorry...typo.
The syntax is working (it returns a result instead of error), but the result is different than expected.
I get
<changes count="0" href="/guestAuth/app/rest/changes?locator=buildType:(id:Test_DeployToProd),pending:true"/>
However, the UI indicates 4 pending changes at the moment.
Any suggestions? I'd like to see the 4 changes in the API (actually I'm mostly interested in a total list of files affected)
Could you please double check that the build configure ID is correct?
Do you see pending changes in TeamCity UI if you login as guest user?
Yes, the pending change is also visible in UI when i log on as guest.
The BuildID must be correct, 'cause if I remove pending:true, i get the list of completed builds. And I'm certainly hitting a buildconfig, becuase if I'm misspelling, I get an error telling that the config cannot be found:
"No build type nor template is found by id 'Test_DeployToProdx' "
Do you use feature branches in this build configuration? By default only changes in default branch are returned.
Please try to add branch locator: /app/rest/changes?locator=buildType:(id:Test_DeployToProd),pending:true,branch:master
No feature branches. We are using a TFS repository. In VCS setup there's no mention of branches. I don't think I can set it any way.
The suggested change with branch locator does not change the result.
If I remove pending and keep branch:master, it returns no results either.
Hi Lars,
Sorry for delay, I was on vacation. Is the issue still actual?
Still actual. It seems that the call you are suggesting is not hitting the right place, thus not return the expected result