Devops 100 days challenge Day 81: Jenkins Multistage Pipeline

i have done every step correctly , build was also successfull .

but task verfication , index.html getting changed as below and task’s status shows as “BUILD :failler”

Please help on this .used below pipeline script

pipeline {
agent { label ‘stapp01’ }

environment {
    GIT_REPO = 'https://3000-port-konf7j4sgwnl62eq.labs.kodekloud.com/sarah/web.git'
    REMOTE_HOST = 'stapp01'
    REMOTE_PATH = '/var/www/html'
    LB_URL = 'http://stlb01:8091'
}

stages {
    stage('Deploy') {
        steps {
            script {
                withCredentials([usernamePassword(credentialsId: 'stapp01', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
                    sh """
                        echo "Deploying to App Server..."
                        sshpass -p "\$PASS" ssh -o StrictHostKeyChecking=no \$USER@\$REMOTE_HOST "
                            cd \$REMOTE_PATH && 
                            git pull origin master
                        "
                        echo "Deployment complete."
                    """
                }
            }
        }
    }

    stage('Test') {
        steps {
            script {
                sh """
                    echo "Testing website accessibility..."
                    response=\$(curl -s -o /dev/null -w "%{http_code}" \$LB_URL)

                    if [ \$response -eq 200 ]; then
                        echo "Website is accessible. HTTP Status: \$response"

                        echo "Verifying content..."
                        curl -s \$LB_URL | grep -q "Welcome to xFusionCorp Industries"

                        if [ \$? -eq 0 ]; then
                            echo "Content verification successful!"
                        else
                            echo "Content verification failed!"
                            exit 1
                        fi
                    else
                        echo "Website is not accessible. HTTP Status: \$response"
                        exit 1
                    fi
                """
            }
        }
    }
}

post {
    success {
        echo 'Deployment and testing completed successfully!'
    }
    failure {
        echo 'Deployment or testing failed. Check the logs above.'
    }
}

}

The biggest problem with your script is that you are supposed to use stapp01 as the agent, and you are not doing that. If you are running with that agent, you would be running as user sarah, and would not need to supply credentials during the pipeline, since you would already be running as user sarah.