• Home
  • About
  • Contact
  • Speaking

Setting up TeamCity agent with SSH on windows

by Piotr Stapp — on TeamCity SSH devops 28 Feb 2014

Where is the problem

I use TeamCity a lot at home and at work. Basically we work on .NET but sometimes we need to use invoke parts on Linux. One solution is to buy licence for Linux agent, but it in our case it will be just throwing out many: we need this more or less once a week for 5 minutes.

One way communication

One way communication: from agent on windows it's quite easy. The only thing you need is a plugin for TeamCity. You can get it from here: http://confluence.jetbrains.com/display/TW/Deployer+plugin
It's really good and allows to create simple build steps like:

  • SSH Deployer - upload files to SSH
  • SSH Exec - my favorite it allows to run commands using SSH
  • SMB Deployer - upload to windows share, which is useless for me
  • FTP Deployer - same for FTP

Two ways communication

Above plugin are missing one much important feature: it doesn't allow to download files from Linux
But we have got pscp.exe from putty which we can install on agent machine ore include in our build.
So the build step is quite easy:

  • We setup Powershell build step
  • In the Script field we enter: echo y | & "C:\Program Files (x86)\PuTTY\pscp.exe" -pw [YOUR PASS][USER]@%RedHat_host%:/somewhere/you_file.txt . Small explanation the echo y statement. When you first connect to SSH host it ask you to add host into trust one. This command allow to "skip" this part.

Unfortunately we need to include pass in statement or run in this agent a SSH agent to store password. The easiest and enought security option in my opinion is to create guest account with only read-only rights

That's all folks, see you next time.


Follow @ptrstpp950

0%
Setting up TeamCity agent with SSH on windows
words - read.
Recent Posts:

Comments

comments powered by Disqus
Piotr Stapp Author

Piotr Stapp

Developer, engineer, craftsmen, speaker & biker. User of all useful technologies. Believe in people not papers. DevOps & automation adept. In love with web technologies. I speak here for myself only.

Previous post HSTS error in Google Chrome Sometimes, specially after using Fiddler, my Google Chrome shows me HSTS error like below: localhost normally uses encryption to…
Next post Using poshgit @VisualStudio Git in Visual Studio As You probably know Visual Studio has integrated git client. It is really cool thing.…
All content copyright Reset your code © 2014 • All rights reserved.
Proudly published with Ghost