Question

I'm trying to write a PowerShell script that creates a parameter in a TeamCity build configuration, this is simple to do with the REST API.

Just set up an authenticated webclient and make a PUT request to the parameters of the build config:

$webclient.UploadString("http://Server:8111/httpAuth/app/rest/buildTypes/buildID/parameters/Password, "PUT", "PasswordString")

But this parameter contains a password and needs to be stored as a Password type in Team City.

I know I can change the type of the parameter manually from TeamCity's UI but is there a way to automate this with the REST API (otherwise I'll be doing this manually for over 100 build configs)

Was it helpful?

Solution

Jetbrains got back to me about this issue and explained that this type of functionality is not available until the release of 8.1

As an alternative, there is a way of defining the parameter in the build's parent project, the parameter is then inherited to all builds under that project.

It's perfect for my situation as the password can be stored in the root project and inherited automatically across all builds.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top