Scripted Git Branch Deployment with Jenkins
When working with git, normally work is done on a branch then merged onto master. However, it is often desired or required that someone else take a look at it before putting it on master. The process of deploying your branch to a test environment is oftentimes manual / time consuming. It does not have to be that way. It can be as simple as ‘git push; ./deploy.sh;’ using remotely triggered parameterized Jenkins builds. Despite the overly verbose description, the setup is actually not time consuming. In the following section, I am making the assumption that you already have Jenkins build that deploys master to the test environment.
- Firstly, create a new Jenkins build cloned from your normal deploy job for master.
- Mark it as parameterized.
- Mark it as remotely triggered.
- Save the configuration.
- Finally, write the deploy script. Something like this: