what exactly is need as per task , i am unable to get requirement & solve error.
I do not why i am failing because i have done around 30+ times but i could not where i am failing . below are things & attaching screenshots.
IN stapp01 i have excuted below
yum install java-17-openjdk -y
sudo chmod 755 /home/sarah
sudo chown -R tony:tony /home/sarah/jenkins_agent
sudo chown -R tony:tony /var/www/html
script :pipeline {
agent {
label ‘stapp01’
}
parameters {
string(name: 'BRANCH', defaultValue: 'master', description: 'Enter master or feature')
}
stages {
stage('Deploy') {
steps {
script {
if (params.BRANCH == 'master') {
sh '''
cd /var/www/html
git fetch --all
git checkout master
git pull origin master
'''
} else if (params.BRANCH == 'feature') {
sh '''
cd /var/www/html
git fetch --all
git checkout feature
git pull origin feature
'''
} else {
error("Invalid BRANCH value: ${params.BRANCH}")
}
}
}
}
}
}

