Perforce - queue build on specific changelist via REST API
Hello,
is it currently possible to queue a build on a specific Perforce changelist via the REST API? I tried using the documentation to figure it out, but it looks like it doesn't work as intended.
I'm aware that the shelves are a special case, where I have to use app/perforce/runBuildForShelve endpoint.
Is there something like it for regular builds ran on specific CLs?
Here's my current API call - a bit messy, I was trying pretty much everything to make it work:
"buildType": {
"id": "InternalID"
},
"personal": true,
"lastChanges": {
"change": [
{
"locator": "version:10000"
}
]
},
"revisions": {
"count": 1,
"revision": [{
"version": 10000,
"vcsBranchName": "//branchname",
"vcs-root-instance" : {
"id": 7,
"vcsRootInternalId" : "InternalID",
"vcs-root": {
"name": "InternalID"
}
}
}]
},
"triggeringOptions": {
"rebuildAllDependencies": true
}
}
Thanks!
Please sign in to leave a comment.
Hello Lukas,
Apologies for the delayed response here. For me, the minimal working payload was this:
{"buildType": {
"id": "Support_Perforce"
},
"lastChanges": {
"change": [
{
"locator": "buildType:(id:(Support_Perforce)),version:4"
}
]
}
}
The build configuration ID is Support_Perforce, at the time of execution there were 10 CLs that TeamCity was aware of; build got triggered on the CL 4.
Can you please let me know if this helps?
Hi,
no worries. I ended up using this:
"buildType": {
"id": "XXX"
},
"revisions": {
"count": 1,
"revision": [{
"version": CHANGELIST_NUMBER,
"vcsBranchName": "//project/xxx",
"vcs-root-instance" : {
"id": 7,
"vcsRootInternalId" : "XXX",
"vcs-root": {
"name": "XXX"
}
}
}]
}
}
In your current API call, you're trying to use the "lastChanges" field, which appears to be related to triggering a build based on the latest changes. This might not work for triggering builds on specific changelists. The "revisions" field seems to be more relevant for specifying a version, but its purpose might not be to trigger builds on a specific changelist.
For triggering builds on specific changelists, you might need to find a dedicated field or parameter in the Perforce REST API documentation that allows you to specify a changelist directly. It's possible that there's a specific endpoint or parameter that you haven't found yet.
Since Perforce's REST API and its integration with TeamCity might have changed after my last update, I recommend the following steps:
Check Perforce's Documentation: Look into the latest Perforce REST API documentation to see if there are any specific parameters or endpoints for triggering builds on specific changelists.
Consult TeamCity Documentation: Also, consult the official TeamCity documentation or any updates that might have occurred since my last update. It's possible that there might be new endpoints or fields introduced to better support Perforce integrations.
Contact Support: If you can't find a clear solution in the documentation, consider reaching out to Perforce or TeamCity support. They might be able to provide guidance on the best approach to trigger builds on specific changelists using their current API capabilities.
Community Forums: Search for any community forums or discussions related to Perforce and TeamCity integrations. Other users might have encountered similar issues and could offer insights or workarounds.