Simplifying My Jenkins Work Flow
Up until recently, my Jenkins work flow has been tedious. It typically went something like:
- Install Jenkins instance, fully configure it the way I want.
- Setup a few new projects to start building / testing / deploying.
- Spin up a new application server to deploy my project to.
- Watch my Jenkins deploy fail, as I forgot to accept my new server’s SSH identity manually.
- Log into my Jenkins server as the
ssh <new_server_ip>, and accept the stupid identity.
At work, we’re constantly building out new servers–sometimes, automatically. And Jenkins is a critical part of our infrastructure. We use it to build, test, then deploy all of our code straight into production. When we spin up new servers, the process looks like this:
- New server is booted.
- New server is bootstrapped with puppet configurations.
- New server auto-configures itself according to our puppet node rules.
- Project deployment script is updated to include new server.
- We push an update to our code to GitHub.
- Jenkins pulls the latest code changes, tests the code, then attempts to deploy it to our new server.
This is where the problems happen–since we haven’t manually verified the identity of our new server, our Jenkins box will just start failing builds since it won’t SSH into a server before accepting the identity.
To remove the hassle of manually accepting each server’s identity, we recently decided to do away with the identity check all together to make our lives easier. This solution may not work for everyone (especially if security is a real concern for your team), but for us it works great!
Just modify your
/etc/ssh/sshd_config file and change
This will let your SSH client completely ignore the remote machine’s identity when ssh’ing into an unknown server. This is great for us, since we’re constantly building out new servers automatically, and we’re willing to accept the associated risk.
PS: If you read this far, you might want to follow me on Mastodon or GitHub and subscribe via RSS or email below (I'll email you new articles when I publish them).