I have attempted this task more than 7 times. My jenkins job builds successfully, the website is deployed. And I can access the site. However on checking the lab, it fails with the error “LB did not serve deployed file.” Please help.
Can you please give me a bit more detail as to what you tried? What does your Jenkins job look like? Please post it in a
code block
like this to prevent your code from getting corrupted by Discourse’s edit widget.
Hello Rob,
Thanks for responding.
Here are the steps I performed for the task:
- Jenkins Node Configuration
- Created a slave node named App Server 1
- Label: stapp01
- Remote root directory: /home/sarah/jenkins_agent
- Node status shows in sync
- Repository Setup
I cloned the repository web_app on App Server 1 under: /var/www/html/web_app
Ownership:
Changed ownership using the command below:
sudo chown -R sarah:sarah /var/www/html/web_app
- Enabled Passwordless sudo for user sarah
- sudo visudo
- sarah ALL=(ALL) NOPASSWD: ALL
- Jenkins Pipeline Job
Created a pipeline job named xfusion-webapp-job(not multibranch).
Pipeline script is attached
pipeline {
agent { label 'stapp01' }
stages {
stage('Deploy') {
steps {
sh '''
sudo cp -r /var/www/html/web_app/* /var/www/html/
'''
}
}
}
}
- Build Result
The build completes successfully:
Finished: SUCCESS
- Verification
- Accessing the App button loads the website successfully.
- The page displays:
Welcome to xFusionCorp Industries!
- Issue
Despite successful deployment and the website being accessible through the Load Balancer URL, the lab validation fails with:
LB did not serve deployed file
I have repeated the task multiple times with the same result.
Please let me know if there is any specific validation requirement I might be missing.
Thank you.
You probably should not be using sudo, since that would (1) require a password, and (2) be unnecessary since the agent is running as user sarah if you set up correctly.
Note the following on App Server 1:
[tony@stapp01 ~]$ sudo -i
[root@stapp01 ~]# ls -l /home/sarah/
total 4
drwxr-xr-x 2 sarah sarah 4096 Mar 31 19:33 jenkins_agent
[root@stapp01 ~]# ls -l /var/www/
total 8
drwxr-xr-x 2 root root 4096 Feb 12 19:09 cgi-bin
drwxr-xr-x 1 sarah sarah 4096 Mar 31 19:33 html
[root@stapp01 ~]# ls -l /var/www/html/
total 4
-rw-r--r-- 1 sarah sarah 35 Mar 31 19:33 index.html
[root@stapp01 ~]# su - sarah
Last login: Tue Mar 31 19:33:17 UTC 2026
[sarah@stapp01 ~]$ cd /var/www/html/
[sarah@stapp01 html]$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
[sarah@stapp01 html]$ git remote -v
origin http://sarah:Sarah_pass123@gitea:3000/sarah/web_app.git (fetch)
origin http://sarah:Sarah_pass123@gitea:3000/sarah/web_app.git (push)
[sarah@stapp01 html]$ git pull origin master
From http://gitea:3000/sarah/web_app
* branch master -> FETCH_HEAD
Already up to date.
And the pipeline script:
pipeline {
agent { label 'stapp01' }
stages {
stage('Deploy') {
steps {
script {
sh '''
cd /var/www/html
git pull origin master
'''
}
}
}
}
}