Day 78: Jenkins Conditional Pipelin

Hi everyone,

I’m working on the Jenkins Pipeline Deployment task (deploying the web_app repository to the Nautilus App Server) and my pipeline runs successfully, but the lab validator still fails with the error:

“Validation file not found on App Server.”

Here is what I configured:

  • Created a Jenkins pipeline job named devops-webapp-job (not a multibranch pipeline).
  • Added a string parameter BRANCH.
  • Added a Jenkins agent named App Server 1 with label stapp01 and remote root directory /home/sarah/jenkins_agent.
  • The repository already exists on the server at /var/www/html.
  • Apache is running on port 8080.

My pipeline script:

pipeline {
    agent { label 'stapp01' }

    parameters {
        string(name: 'BRANCH', defaultValue: 'master', description: 'Branch to deploy')
    }

    stages {
        stage('Deploy') {
            steps {
                sh """
                cd /var/www/html
                git reset --hard
                git clean -fd
                git fetch origin
                git checkout ${params.BRANCH}
                git pull origin ${params.BRANCH}
                """
            }
        }
    }
}

Pipeline output shows SUCCESS, and when I check the server:

cd /var/www/html
git branch

I can switch between master and feature, and the files (index.html, feature.html) are present.

Despite this, the lab still returns “Validation file not found on App Server.”

Could someone please help confirm if I missed any requirement (job name, pipeline configuration, or deployment step)?

Thanks!

Please try referring to this solution in the thread, and see if it helps.

I’m still having the same issue

Did the agent actually get started and work? There’s a java version clash between the jenkins server and the App Server. Did you handle this?

Yes, the agent was able to start and run jobs successfully. Initially I had an issue starting the Jenkins agent because Java was not properly set up on the App Server (stapp01) . I installed OpenJDK 17 on the server and verified it with java -version . After that, Jenkins was able to launch the agent and run the pipeline without errors. I also fixed the permissions for /home/sarah/jenkins_agent and /var/www/html so the Jenkins user (tony ) could execute Git commands and deploy the code. After these fixes, the node connected successfully and the pipeline ran on App Server 1 (label: stapp01) , switching branches and deploying the code to /var/www/html .