MLOPS TASK 1 : CI & CD with Manual Integration and Testing using Github Jenkins and Docker

MLOPS TASK 1 : CI & CD with Manual Integration and Testing using Github Jenkins and Docker

No alt text provided for this image

Task Instructions :

  • JOB 1 : If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.
  • JOB 2 : If Developer push to master branch then Jenkins will fetch from master and deploy on master-docker environment. Both dev-docker and master-docker environment are on different docker containers.
  • JOB 3 : Manually the QA team will check (test) for the website running in dev-docker environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger #job 2.

Application Used

  • Git
  • GitHub
  • Jenkins
  • Linux
  • Docker

Procedure :

Task 1 :

Step 1 : Create a local repository with web code using git.(Stage It and Commit it)

commands:

git init                          # to initialize repository
git add .                         # to stage all files in the folder
git commit . -m "comment"         # to commit all files
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Step 2 : Now we push the repository from workspace to GitHub.

git push -u origin dev        # to push to dev branch on GitHub
No alt text provided for this image

Step 3 : Now we create a job in Jenkins named as "dev_code_deployer" which clone repository data from GitHub and create a docker container for testing environment and deploy the website on the container.

No alt text provided for this image
The configuration of the job 1 "dev_code_deployer" is shown in these screenshots.


No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Step 4 : Now we create the webhook on GitHub by tunnel the jenkins using ngrok.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Step 5 : Now we once manually build the job and check the configuration.

No alt text provided for this image
No alt text provided for this image

Hence, the Job 1 is successfully created and configured. Now we configure Job 2 for master branch similarly.

Task 2 :

Step 1 : Create file and stage, commit the files by using git.

No alt text provided for this image
No alt text provided for this image

Step 2 : Now push the master branch of local repository on GitHub.

No alt text provided for this image

Step 3 : Now we create Job 2 "Master_code_deployer" with following configuration.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Step 4 : Now we manually build the job and check the configuration.

No alt text provided for this image
No alt text provided for this image

Hence, the Job 2 is successfully created and configured. Now we configure Job 3 for merging dev branch with master branch after manual testing of dev branch code on dev_docker testing environment.

JOB 3 :

Now for job 3, we create a job named as "code merger", which merge the developer branch code after testing with master branch code and trigger job 2 again for deploy fresh resultant. The configuration of job 3 is as follows :

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Now we manually build the job 3 and our dev branch merged and deployed over master environment.

No alt text provided for this image
No alt text provided for this image

Hence, our environment is fully setup. Now we test it with one use case.

Use Case :

We consider a website which need to be deployed, so first devloper write code and push it over GitHub. As our setup is already setup, so job 1 deploy the website on developer or testing environment, where QA team anlayse the app, if they find it good then they trigger the job build by given link :

JENKINS_URL/job/github%20Developer/build?token=TOKEN_NAME

and the code updated by merge with master branch and deployed successfullt over production (master) environment.

Practical :

Copy the webcode and paster to git repository.

No alt text provided for this image

Now add (stage) all the files with command

git add .   # to stage files

and commit files using command :

git commit . -m "comment"
No alt text provided for this image

Now push code to github by " git push " command. Due to GitHub webhook the job 1 automatically trigger and website deployed over testing environment.

No alt text provided for this image
No alt text provided for this image

When QA team approve the job 3 is triggered.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

The background running docker containers are shown below.

No alt text provided for this image


So thanks Guys. That's all. By this we can crate our environment. We will meet in my next task.

Thank You !!!!!!!!!!!!!!

Special thanks to Vimal Daga Sir. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

GitHub : https://github.com/kush95300/Mlops_Task1


To view or add a comment, sign in

More articles by Kaushal Soni

Others also viewed

Explore content categories