DevOps Assembly Lines Task #1
Task Description :
JOB 1
If Developer push to master branch then Jenkins will fetch from master and deploy on "Deploy" environment
JOB 2
If Developer push to dev branch then Jenkins will fetch from dev and deploy on "Test" environment.
JOB 3
Manually the QA team will check (test) for the website running in "Test" environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger Job 1.
Setup on Linux:
- setenforce 0
- systemctl stop firewall
- systemctl start Docker
- systemctl start httpd
- systemctl start Jenkins
Creating repository on github:
- cd DevOps_task1
- git init
- git add README.md
- git commit -m "first commit"
- notepad Index.html
- git commit -m "Create Index.html"
- git remote add origin https://github.com/suchitrasaksena/task1.git
- git push -u origin master
- git checkout -m dev
- notepad Index.html
- git add .
- git commit -m "first commit in dev"
- git push -u origin dev
The repository is created successfully.
Jenkins Configuration:
Job 1
This job will work whenever changes are made in the master branch and will deploy the updated website on an httpd docker image container named "Deploy" and the updated website will be visible on port no. 8081.
EXECUTE SHELL code:
sudo cp * -v /root/task1/deploy
if sudo docker ps | grep deployenv
then
sudo docker rm -f deployenv
fi
sudo docker run -dit -p 8081:80 -v /root/task1/deploy:/usr/local/apache2/htdocs/ --name deployenv httpd
Job 2
This job will work whenever changes are made in the master branch and will deploy the updated website on an httpd docker image container named "Test" and the updated website will be visible on port no. 8082.
EXECUTE SHELL code:
sudo cp * -v /root/task1/test
if sudo docker ps | grep testenv
then
sudo docker rm -f testenv
fi
sudo docker run -dit -p 8082:80 -v /root/task1/test:/usr/local/apache2/htdocs/ --name testenv httpd
Job 3
This job will be triggered remotely when the qat team approves the changes and will merge the changes from dev branch to master branch.
Both the branches are merged.
All the jobs are executed properly.
Thanks for reading and feel free to your suggestions to improve this code:)
Battery management system || Hardware || AI&ML in EV || STM32 || Renesas || Automobile || BeagleBone || AUTOSAR || TEDx speaker
4 年Nice work Suchitra!
Barclays Analyst 3 @ Barclays || HPAIR'21
4 年So so well done!