How to prompt user for manual parameters when running build in Team City?
Asked Answered
L

1

9

Say you make an automatic deploy script in TeamCity. The script uses SSH for connection to the prod-environment. I do not trust my build server and don't want to store the credentials in the build-script. How can I make TeamCity ask me for the username and password to be submitted to the SSH command when I manually start the build?

Legitimist answered 14/4, 2011 at 8:28 Comment(1)
What type of script is it? PowerShell? I'm looking at using the Windows Credentials Manager but am not there yet.Tailrace
M
4

You have to configure custom build parameter and use Run Custom Build dialog when running a build. Or, you can also use "Promotion" command for a build.

Please read more about deployment configuration and custom build run with parameters.

Mccready answered 14/4, 2011 at 9:59 Comment(6)
That sounds good but I'm guess the passwords will show up in logs etc.Tailrace
That's right. You can configure public/private key SSH authentication for your deployment. Then there is no need to pass password - just the username (if you have different usernames for different environments). Would this work?Mccready
Different scenario now, using Remote Powershell session and passing in username and password. As suggested above, using configuration parameters shows up in the log. Anyone got this figured out? Any feature requests in Team City?Legitimist
Team City 7 has typed parameters and scrambles parameters of type password. Trying it out. Just need to upgrade TC first...Legitimist
This works perfect for Team City 7. Just make sure you upgrade to at least 7.0.3 as this fixes a bug where password would be written to the logfile.Legitimist
The problem is that you cannot pass password to SSHExec nor SSHDeployer builds, as they simply don't accept parameters in password field... So no way to ask user for password and pass to the build step. The only way I can think about is to create scripts to execute all commands you want to execute remotely and run this script using command line runner and pass password to this script so it can be used by ssh command in this script... but this is a bit ugly for me.Shuman

© 2022 - 2024 — McMap. All rights reserved.