Tuesday, June 22, 2021

Jenkins Learning Task 08 - Upstream and Downstream build jobs in Jenkins

 Upstream and Downstream build Jobs in Jenkins (chained build)

1. Create a Jenkins job named chain-app-deployment and configure it in a way that if anyone pushes any new change to the origin repository on master branch then the job should auto build and deploy the latest code on app server(mnode02) under /var/www/html directory. 

2. Create another Jenkins job named services and make it a downstream job for chain-app-deployment job. Things to take care about this job:
        a. This job should restart httpd service on all app servers.
        b. Trigger this job only if the upstream job i.e chain-app-deployment is stable.

3.create repo in gitea named chainweb and create an home.html file under it.

4. SSH into gitea Server(mnode01) using user credentials which you used to create the gitea repo (chainweb) mentioned above.  cloned Git repository chainweb. update home.html content to Welcome to my chain-app-deployement and then push the changes to the origin into master branch. This push must trigger your Jenkins job and the latest changes must be deployed.

===================================================

Note: * This is a learning task and you can try to do it in your own learning environment. I have done a sample solution using VirtualBox with Ubuntu OS.

Pre-Requisite

* This Task based on the LAB which I have set up with 3 servers, one for Jenkins, one for the App server and another one for Gitea.
* Should have ssh connection between servers.
* You might need to install some plugins and restart Jenkins service. 


Solution:
Step 1: Enable password-less sudo in App server.
Step 2: Install GiteaSSH, publish over SSH, authorization token root Plugins in Jenkins.
Step 3: add Gitea user with credentials in jenkins
Step 3: Add sudo users and their SSH credentials in Jenkins
Step 4: Add SSH Hosts in Jenkins
Step 5: Configure publish over SSH on jenkins
Step 6: Create the upstream build job.
Step 7: Create the downstream build job.
Step 8: Setup Gitea Webhooks
Step 9: Commit changes to home.html

Verification:

Check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

No comments:

Post a Comment

Docker Learning Task 02 - How to create a basic docker network

 How to create a basic docker network 1. Create a docker network named  mynetwork . 2. Configure it to use bridge drivers. 3. Set it to use ...