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?

UBCoder
  • 659
  • 1
  • 6
  • 7

1 Answers1

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.

KIR
  • 5,614
  • 1
  • 31
  • 23
  • 1
    That sounds good but I'm guess the passwords will show up in logs etc. – Michael Blake Apr 14 '11 at 10:34
  • 1
    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? – KIR Apr 15 '11 at 10:32
  • 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? – UBCoder Apr 11 '12 at 08:44
  • Team City 7 has typed parameters and scrambles parameters of type password. Trying it out. Just need to upgrade TC first... – UBCoder Apr 11 '12 at 09:40
  • 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. – UBCoder Jun 06 '12 at 07:50
  • 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. – Krzysztof Wolny Mar 16 '15 at 14:41