Day-80: Jenkins Chained Build

Question:

The DevOps team was looking for a solution where they want to restart Apache service on all app servers if the deployment goes fine on these servers in Stratos Datacenter. After having a discussion, they came up with a solution to use Jenkins chained builds so that they can use a downstream job for services which should only be triggered by the deployment job. So as per the requirements mentioned below configure the required Jenkins jobs.

Click on the Jenkins button on the top bar to access the Jenkins UI. Login using username admin and Adm!n321 password.

Similarly you can access Gitea UI on port 3000 (or click the Gitea button) and username and password for Git is sarah and Sarah_pass123 respectively. Under user sarah you will find a repository named web.

Apache is already installed and configured on the app server. The doc root /var/www/html on App Server 1 is a local git repository tracking the origin web repository.

  1. Create a Jenkins job named xfusion-app-deployment and configure it to pull changes from the master branch of the web repository on App Server 1 under /var/www/html directory.
  1. Create another Jenkins job named manage-services and make it a downstream job for xfusion-app-deployment. Things to take care about this job are:

a. This job should restart httpd service on the app server (App Server 1).

b. Trigger this job only if the upstream job i.e xfusion-app-deployment is stable.

The LB server is already configured. Click on the App button on the top bar to access the app. Please make sure the required content is loading on the main URL (e.g. http://stlb01:8091) i.e there should not be a sub-directory like http://stlb01:8091/web etc.

I have created the two jobs as mentioned in the question and tested them out too.

The ‘xfusion-app-deployment’ job gets triggered everytime there’s a new change in the master branch (configured via webhook).
And the ‘manage-services’ job gets triggered everytime the previous job is successful, which in turn restarts the httpd service in app server 01 and checks the status. Also, checked in the app, if the updated index.html is reflecting.

Have tested this out succesfully, yet, the challenge is still failing for me with the error as seen in the screenshot.
Am I missing out on something?

All the existing solutions seems quite old, (some has some solution with the storage server). I am assuming that’s an older question. But, yes, essentially, the solution given should work, right?

So, could you guide me as to what am I missing here?

Hi @nileena

Please refer to the solution here and try again 100-Days-Of-DevOps-Challenge-KodeKloud/days/080.md at main · imShakil/100-Days-Of-DevOps-Challenge-KodeKloud · GitHub

I have tried this solution out, but the challenge still fails with the same error.
I’ve tested out multiple times with the two Jenkins job and it does successfully restart the apache service in the manage-services jenkins job, after the first job is successful.
I used the following plugins:

  • SSH Build Agent (To add the node as Jenkins Agent.)
  • Publish over SSH (To update the files in /var/www/html)
  • Git (For adding the git repo in SCM).

But, I am still not able to get past this error.