Sync to Perforce CL from artifact dependency build number

Hi All,


I need to be able to kick off a custom build based on a dependent builds value (a specific Perforce CL number), but it appears there is no way to do that in a project itself. How does the custom build dialogue pass the info from the 'Last Change' drop down?

https://confluence.jetbrains.com/display/TCD8/Triggering+a+Custom+Build


Details:

I have a specific build that runs and publishes an artifact, and would like to kick off a different build at the same Perforce CL/Sources of the build that generated the artifact, but without using an snapshot dependency. The snapshot dependency makes the build time too long, as we have constant changes being submitted and a snapshot will kick off another dependenct build at the latest sources (which adds significant time to the builds)

Basically I want to make the second build kick off at the same Perforce changelist as the build that published the artifact.

1: 'Dev' build runs at the head CL and if successful, publishes and artifact. - This build runs continuously throughout the day
2: 'Dev2' needs to start and sync the sources at the same CL as 'Dev' by consuming the dependent build.vcs.numer (%dep.BuildsDev.build.vcs.number%) - This build only runs twice per day

I have the build number as a variable (%dep.BuildsDev.build.vcs.number%) available in 'Dev2', but I cannot see a way to pass that value of %dep.BuildsDev.build.vcs.number% to the sync command. I had tried passing that to the "Label/revision to checkout", but that expects a label or CL number so for builds that need to sync to head each time, that option will not work. (not to mention it appears it is not evaluated until after the build starts).

Any ideas?

Cheers

Steve

11 comments
Comment actions Permalink

Anybody from Jetbrains that can answer this? All I need to do is specify the CL I want to sync to based on the build ID of the dependent build but cannot find a way to do that.

It seems like since you can do it in the GUI, you should be able to do this in a build step.

0
Comment actions Permalink

Hi Steve,

Sorry for delay in replaying.

There is no build-in functionality for this use case in TeamCity now. Please watch and vote for the related feature request: https://youtrack.jetbrains.com/issue/TW-14975.

As for workaround you can emulate the HTTP request sent by the browser on invoking the promote action in the UI for a specific build.

Also you can trigger a Dev2 build on specified change using REST API.

0
Comment actions Permalink

Thanks Alina,

Hopefully this gets in soon, as (in my opinion), as the functionality is there in the gui, so should be one of the core pieces to be able to pass that in during a build step.

How does the custom build dialogue pass the changes to the build? is there not a variable that can be set at runtime? or does that use the REST service.

Cheers

0
Comment actions Permalink

Steve,

>How does the custom build dialogue pass the changes to the build? is there not a variable that can be set at runtime? or does that use the REST service.

It uses HTTP-request (not REST API) to send data to the server and it is not possible to change it at runtime.
0
Comment actions Permalink

Sorry one more question: Is there a specific format for the HTTP request? we should be able to do that as well then correct?

0
Comment actions Permalink

You can find POST HTTP request which is send when you run custom build using Developer tools in your browser (Inspect Element > Network in Chrome).

0
Comment actions Permalink

So I abandoned the other workflow I was trying to get up due to the limitation of being able to specify the revision I wanted the build to run at, but have come across another similar scenario which is forcing me to find another way around it.

Now I have a build kicking off a build through HTTP, but if I manually track down the modificationID in diff view in the UI, as again, I cannot tell TeamCity what version of that changelist I would like it to sync at, introducing manual steps again.....


Can we please get the ability to pass a revision/label in to a build instead of forcing us to use the UI? that totally defeats the purpose of automation.


http://testuser:testpassword@teamcity.jetbrains.com:8111/httpAuth/action.html?add2Queue=MyBuildConf&modificationId=ThisShouldBeTheCLNumber


Is there a property/variable I am missing somewhere in order to be able to pass that in? if not, how do I request a feature.

0
Comment actions Permalink

Steve,

Unfortunately it is not possible to pass revision to the build at the moment. There is an option for Perforce VCS root "Label/revision to checkout", but it is not possible to specify it for a build.
Please watch and vote for the feature request and see the comment.

0
Comment actions Permalink

Thanks Alina,

I see the option to specify a label/revision, but that has to be hard coded so will not work. Anytime I try and pass that info in through a variable, it is not evaluated due to the way the VCS root handles variables. It gives the option for a variable, but does not respect it.

Just to provide additional inf I have attached an image. teh red outline does not work.


I did try passing it via HTTP, but as mentioned, I have to manually find the internal ID instead of being able to pass THAT a CL number. Is that possible? Is there a paramter I am missing?



Attachment(s):
TCResponse.png
0
Comment actions Permalink

Hi Steve,

We have released 9.1 EAP a week ago with improvements in Scheduled build trigger. Please have a look, probably now it provides needed functionality.

0

Please sign in to leave a comment.