Day 78: Jenkins Conditional Pipeline : Validation file not found on App Server

Hi,

I’m stuck wih this one as I don’t understand the error I’m receiving when checking this task.

I think I have successfully answer the requirements :

  • create the slave node (sarah ssh credential, update jdk version)
  • install the missing jenkins plugins
  • create a pipeline actually working under specifications (with BRANCH parameter added)
pipeline {
    agent { label 'stapp01' }
    stages {
        stage('Deploy') {
            steps {
                dir('/var/www/html') {
                    git url: 'https://3000-port-xj2roisszsserjzu.labs.kodekloud.com/sarah/web_app.git', branch: "$BRANCH"
                }
            }
        }
    }
}

When testing with parameter ‘master’ then ‘feature’ then again ‘master’ I can confirm that the branch under /var/www/html on stapp01 is changing and that the website is responding with the correct html.

But … “Validation file not found on App Server”

Try referring to the script used in the solution recorded here and see if it helps.

Hi, I already see that solution but I think it doesn’t apply here because it seems to be an old version of the task : clone the repo under ststor01 then copy it to stapp01

Now the task is just on the stapp01 server.

I think the ‘git’ command is maybe the culprit here but don’t know why as it operates the requirements (as far as I understand !)

Try referring to this solution. You might have to refer the solution for day 77 if required.

It works ! (with the script provided…)

My observations :

  • I treated parameters as in freestyle project (with $BRANCH) whereas I needed to use the parameters block in the pipeline script and the ‘params.BRANCH’ notation
  • I don’t know if the git command I was using is wrong in that case, I need to test it again

Thank you anyway :wink: