hazem
#1
Jenkins Auto Deployment Task – Validation Failed (Need Help)
Task Objective
The goal of this task was to configure a Jenkins job to automatically deploy an application when changes are pushed to a Git repository.
Requirements:
-
Ensure httpd is running on App Server 1 (port 8080).
-
Create a Jenkins job:
- Name:
nautilus-app-deployment
- Trigger: automatic deployment on push to
master branch
-
Deploy application to:
/var/www/html
-
Ensure ownership of /var/www/html is set to user sarah.
-
Modify index.html with:
Welcome to the xFusionCorp Industries
-
Push changes → Jenkins should trigger automatically → deploy code.
-
Application should be accessible via:
http://stlb01:8091
What I Implemented
Jenkins Configuration
-
Job type: Freestyle
-
SCM: Git
- Repo:
sarah/web
- Branch:
*/master
-
Trigger:
- Webhook (
GitHub hook trigger for GITScm polling)
-
Node:
-
Build Step:
sudo chown -R sarah:sarah /var/www/html
sudo rm -rf /var/www/html/*
sudo cp -r index.html /var/www/html/
sudo systemctl restart httpd
Webhook
/github-webhook/
- Jenkins receives push events and triggers job successfully.
Verification
After pushing changes:
curl http://localhost:8080
curl http://stlb01:8091
Output:
Welcome to the xFusionCorp Industries
Jenkins build log:
Started by remote host
Finished: SUCCESS
Issue Faced
Despite everything working correctly, validation fails with:
Validation file not on LB. Check webhook triggers the job and job deploys to /var/www/html.
Root Cause (Identified)
My deployment command was:
sudo cp -r index.html /var/www/html/
This copies only index.html.
However, during validation, the system pushes an additional file (validation file) to the repository.
Since my job copies only one file, the validator file is not deployed, causing failure.
Fix Applied
Updated build script to deploy entire repository:
sudo chown -R sarah:sarah /var/www/html
sudo rm -rf /var/www/html/*
sudo cp -r * /var/www/html/
sudo systemctl restart httpd
Current Status
- Jenkins triggers automatically on push
- Deployment works
- Application accessible via Load Balancer
- Still waiting to confirm validator passes after fix
Question
Is there anything else required by the validator besides:
- Deploying full repository content
- Using webhook trigger
- Serving from
/var/www/html
Or is the issue only due to copying a single file earlier?
Hi @hazem
There is a solution for this task, have you checked it before?