Is it still possible to programatically label a VCS root?

I am submitting this post based on Yegor's comment on https://youtrack.jetbrains.com/issue/TW-46503 

I found https://confluence.jetbrains.com/display/TCD7/Accessing+Server+by+HTTP?focusedCommentId=41485657#comment-41485657 but initially had issues in that a POST to

http://mmg-bustamd2:48080/httpAuth/ajax.html?setLabelForBuild=1644&labelName=PROD&labelingRootsManual[PlasticSCMGenericVCSRoot]=true

would do nothing.

The reason we are not using the build feature VCS labeling is due to removing the source dependency on our PROD Deploy build configuration. We did that to prevent the scheduled trigger (daily) from prompting a rebuild of the entire chain when repository changes have taken place (even though the deploy configuration deploys from the pinned PROD Package build configuration).

Build configurations:

1 - CI
2 - DEV Package
3 - DEV Deploy
4 - UAT Package
5 - UAT Deploy
6 - PROD Package
7 - PROD Deploy

It appears that enabling "Trigger only if watched build changes" -> "Last pinned build" would greatly reduce the frequency of this happening, but repository changes would still prompt a rebuild of the entire chain when triggered. Is this assessment correct? Is there any way of achieving the desired behavior without the ajax.html call above?

-----

Manually labeling from Changes tab posts form data:

labelName=TEST&labelingRootsManual%5B8%5D=true&_labelingRootsManual%5B8%5D=&setLabelForBuild=1569

Decoded:

 

labelName=TEST&labelingRootsManual[8]=true&_labelingRootsManual[8]=&setLabelForBuild=1569

 

Which is odd because even though the following works

 

Invoke-RestMethod "http://mmg-bustamd2:48080/httpAuth/ajax.html?labelName=TEST2&labelingRootsManual %5B8%5D=true&_labelingRootsManual%5B8%5D=&setLabelForBuild=1569" -WebSession $TeamCitySession -Method Post
the VCS Root ID of 8 seems wrong:

> (Invoke-RestMethod ($base_url + "/httpAuth/app/rest/vcs-roots/8") -WebSession $TeamCitySession -Method Get -ContentType "application/xml")."vcs-root"


id : SamplesDeploymentPipelineYTIntegration_PscmTest
name : PSCM-TEST
vcsName : PlasticSCM
href : /httpAuth/app/rest/vcs-roots/id:SamplesDeploymentPipelineYTIntegration_PscmTest
project : project
properties : properties
vcsRootInstances : vcsRootInstances

Although logs show:

[2016-08-08 16:06:40,517] INFO [pr-8080-exec-10] - jetbrains.buildServer.VCS - Labeling VCS root "PlasticSCM_GenericVCSRoot" {instance id=8, parent internal id=5, parent id=PlasticSCM_GenericVCSRoot, description: "rep "MMG.CLBRDBTSAA_WEB@scc.mmgct.int:8087"
path "/"
smartbranch "/main""}@cs:160@rep:MMG.CLBRDBTSAA_WEB@repserver:scc.mmgct.int:8087 for build MMG.CLBRDBTSAA_WEB :: 1 - Continuous Integration [AUTO] 1569 on localadmin. Started Mon Aug 08 15:36:44 EDT 2016, finished Mon Aug 08 15:43:37 EDT 2016. Status NORMAL Tests passed: 1; inspections total: 1676 (+436 -289), errors: 34 (+31)

And a query for root 5 (parent internal id) shows:

> (Invoke-RestMethod ($base_url + "/httpAuth/app/rest/vcs-roots/5") -WebSession $TeamCitySession -Method Get -ContentType "application/xml")."vcs-root"


id : PlasticSCM_GenericVCSRoot
name : PlasticSCM_GenericVCSRoot
vcsName : PlasticSCM
href : /httpAuth/app/rest/vcs-roots/id:PlasticSCM_GenericVCSRoot
project : project
properties : properties
vcsRootInstances : vcsRootInstances

Does that make any sense?

Please sign in to leave a comment.