Jenkins Pipeline failing because Gitea repository content is being changed automatically by validation checker

Post Content

Lab: Jenkins Pipeline Deployment with Deploy and Test Stages

Issue: My Jenkins pipeline keeps failing even though everything seems to be configured correctly.

What I have done:

1. Created Jenkins agent node (App Server 1) with:
   - Label: stapp01
   - Remote root: /home/sarah/jenkins_agent
   - SSH credentials for user sarah

2. Installed Java 17 on App Server 1

3. Created pipeline job named "deploy-job" with two stages:
   - Deploy: pulls code from Gitea to /var/www/html
   - Test: checks if website is accessible

4. My pipeline script:

pipeline {
agent { label ā€˜stapp01’ }

   stages {
       stage('Deploy') {
           steps {
               sh """
                   cd /var/www/html
                   git pull http://sarah:Sarah_pass123@gitea:3000/sarah/web.git master
               """
           }
       }
       
       stage('Test') {
           steps {
               sh """
                   curl -s http://stlb01:8091 | grep -q "xFusionCorp"
               """
           }
       }
   }

}


5. When I manually run the pipeline, the Deploy stage shows "Already up to date" and the content is correct.

6. However, when the lab validation checker runs automatically, the content in both Gitea and /var/www/html/index.html changes to random strings like "6s09hcf9a4gu" or "1ve9pk2q52ac", causing the Test stage to fail.

Screenshots attached showing:
- Gitea content changing automatically
- /var/www/html/index.html content changing without my action
- Pipeline console output showing failure

What am I missing? Is the lab validation checker supposed to change the repository content? How can I make my pipeline pass consistently?

Thank you for your help!

Hi @rubenhtun

Please share the course level and task name.

1 Like

Sorry i forgot to mention the lab title.

That is Day 81 Lab ā€œJenkins Multistage Pipelineā€ from 100 Days of DevOps series.

Hi @rubenhtun

Please refer to the solution here and try again https://github.com/imShakil/100-Days-Of-DevOps-Challenge-KodeKloud/blob/main/days/081.md

1 Like

Thank you, brother Raymond!!!

Now, I have successfully completed it.

1 Like