TFS & GO & Chef, oh my: Part 8 - How we'll handle trunks/branches, build/git push oopsie, SSH keys auth
Because of how I'd planned on setting up pipelines, the question arose: What do you do with branches?
With that process, you would have to create a fresh pipeline for each branch - the idea being your build repo project list is 'clean' for each project. Well after discussion, this didn't make much sense, so we now will simply have a pipeline per project (app/svc/site), and we simply adjust the pipeline material project path on each build request. In other words, from a build/deploy point of view - we don't care if it's a trunk or branch request, just give us the project path and we'll build it. Simple process change!
The 'downside' to this is if you need to push out an emergency build, it'll 'interrupt' anything currently running in the environment chain. This is primarily due to us only having one of each environment. Eventually, with rapid build/teardown environments, this will go away.
It also became clear as I was testing that the build process actually nukes the destination folder for built files - this causes the git directory to also disappear. So the build agent will now have a skeleton folder structure that acts as a local repo workspace, and the actual build process will dump files that are moved to the skeleton.
One item about Git - we are using SSH. SSH from Windows to Linux is complicated in a sense, mainly because of how the Git Bash shell handles users. If I am logged on as 'user1@ad-domain.com', my 'user' when I SSH to another server is 'user1'. So you have to set up 'user1' on the destination box. Here's how to get it working, took way too long...
With that process, you would have to create a fresh pipeline for each branch - the idea being your build repo project list is 'clean' for each project. Well after discussion, this didn't make much sense, so we now will simply have a pipeline per project (app/svc/site), and we simply adjust the pipeline material project path on each build request. In other words, from a build/deploy point of view - we don't care if it's a trunk or branch request, just give us the project path and we'll build it. Simple process change!
The 'downside' to this is if you need to push out an emergency build, it'll 'interrupt' anything currently running in the environment chain. This is primarily due to us only having one of each environment. Eventually, with rapid build/teardown environments, this will go away.
It also became clear as I was testing that the build process actually nukes the destination folder for built files - this causes the git directory to also disappear. So the build agent will now have a skeleton folder structure that acts as a local repo workspace, and the actual build process will dump files that are moved to the skeleton.
One item about Git - we are using SSH. SSH from Windows to Linux is complicated in a sense, mainly because of how the Git Bash shell handles users. If I am logged on as 'user1@ad-domain.com', my 'user' when I SSH to another server is 'user1'. So you have to set up 'user1' on the destination box. Here's how to get it working, took way too long...
- Log on to the build server (Windows) as your build account
- Open Powershell and ssh-keygen
- This gets you a .ssh directory (c:\users\build.svc\.ssh) with id_rsa and id_rsa.pub
- Set up the user on the Linux box (private Git for us), do an ssh-keygen (sets up the dir for you)
- THE USERNAME MUST BE THE SAME, so if your build acct is domain\build.svc, your Linux acct must be build.svc
- SCP the two id_rsa files from the Windows .ssh directory into the Linux user's .ssh directory
- Run this: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- Run this: chmod -R 700 .ssh
- Now try SSH, should work from Windows to Linux with no password prompt.
A lot of hurdles cleared here!
Comments
Post a Comment