Error - Lab. Jenkins - level 4 - Jenkins Deployment Job

I’m having trouble with the lab setup, as even though it meets the specifications, I’m getting an error when validating it.
Jenkins - Level 4 - Jenkins Deployment Job
A screenshot of the configuration is attached.

7

I look forward to your reply, thank you.

Hi @fsialercloud

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

Let me know if you still not able to pass the task.

Hi @raymond.baoly
I checked the link you sent and implemented it, but the error still persists.

Here’s what I tried for the task as it is now:

  1. Log into “ssh jenkins@jenkins”, and create an ssh key with “ssh-keygen”.

  2. Copy it over to sarah@stapp01 with “ssh-copy-id”.

  3. Create an api-token for the jenkins admin user, and save the token.

  4. Under the manage jenkins / system, add the details for the gitea server adding the needed credentials to access it. Select the “define hook” option.

  5. Log into gitea as sarah, and create a webhook using the general pattern:

    https://admin:api-token@jenkins-url/job/nautilus-app-deployment/build?token=kodekloud

    where “api-token” is the token you just created, “jenkins-url” points to your jenkins server, and where “nautilus-app-deployment” is whatever name the task asks you to create for the job name.

  6. Now create the job using the correct name. It should:
    a. Link to the gitea repo.
    b. Be a triggered task that calls a script.
    c. Run the command

    ssh sarah@stapp01 “cd /var/www/html; git checkout master; git pull origin master”

  7. Test editing and pushing the web/index.html file and make sure when you push it that the script is executed by the webhook.

This worked for me.

Hi @rob_kodekloud
Thanks for your input, but even after following the written instructions and checking the steps I took before, the same problem persists.

Validation file not on LB. Check webhook triggers the job and job deploys to /var/www/html.

As you can see in the attached screenshots, the process is the same except for the command. The goal is for the upload to execute the job via a webhook, but I’m getting an error related to the Load Balancer, and I don’t understand why.

I’m referring to the Jenkins lab - level 4 - Jenkins Deployment Job. It’s not the 100 Days of DevOps lab.

No, I’m doing the KKE Level 4 task. So at this point, you can be sure that’s NOT the issue.

Let’s concentrate on getting the webhook to execute. If you set up the webhook correctly, then as soon as you push index.html with git, Jenkins will wake up and start to process the job. If it does not, you’ve done something wrong, and that’s where to concentrate your efforts. If you look in the Jenkins logs, you will likely see an error, which may or may not be helpful. If you don’t see an error, then you really need to look carefully at how the webhook is set up in gitea.