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!
