Setup up an infrastructure such as there are three teams/environemnts :
- Production
- Testing
- Quality Assurance
Production Team will deploy the code first, now there is some work going on in the developement team which is to be deployed on testing environment which will be sent to the production only when the QA team approves it.
- Docker
- Image: httpd
- Jenkins
- Github Plugin
- System with 2gb ram (Recommended)
- Git and Hooks
- Github and Github Webhooks
- ngrok
-
Made 3 Jobs for produnction, testing and Quality Assurance
-
Make Environments for production and testing. I am using docker here, I have created a volume(persistant storage) for production and testing and mounted them to their respective containers
- My job 1 and job2 will get their code from the github (from their respective branches => master:production, dev:testing)
- Both the containers have diferent web addresses so the quality team can monitor both
- Quality team continously checks for changes in testing environemnt, and decides wether to approves it or not
- On approval QA team manually builds the job3
- Since job three is the upstream job of job2 and job1 , so on succesfull approval foloowong things will happen:
- Dev and Master branch will be merged
- Code will be pushed to the github
- job 1 and job2 will be build
- ngrok will be running in the system to provide public accessable addres so that github webhook will work and production site can be accessible to the public
-
Created a hook for post-commit and post-merge so the developer need not to be manually push the code each time he commits
-
Added The webhooks to the Jenkins Github API :=> ip/github-webhook/
- Production:
- Testing :
- Produnction:
- Testing :
- QA Rejected
- Testing :
- QA Approved:
- Created a job for cloning the Github repo's master branch which is to be deployed on docker. Github Githook trigger is checked so that whenever the developer pushes the code, github webhook will be activated and it will contact jenkins, then jenkins will pull the updated code, and move it to the created volume.
- Provided the command to check wether the docker conatiner is already running, if not create it mount the volume and expose it's port 80 to base os port 8082.
- Created a job for cloning the Github repo's master branch which is to be deployed on docker. Github Githook trigger is checked so that whenever the developer pushes the code, github webhook will be activated and it will contact jenkins, then jenkins will pull the updated code, and move it to the created volume.
- Provided the command to check wether the docker conatiner is already running, if not create it mount the volume and expose it's port 80 to base os port 8083 QA team will check the testing environment at this port address.
- Provided the github repo link along with credentials as on approval there should be a merge between the master and dev branch, and also the code should be pushed to github.
- Details is provided to the additional behaviour so that merging could be done.
- Post Build Action deatils provided, so that push after the merge can be done
- After the push is being done. This job will call the job1 and job2 so that the code can be updated. (This part can be omitted as webhook will do it's job, but to be on safe side, I have put these projects as downstream projects)