Hi Rahul , everything seems to be working fine.
but got failure message
- Seems like you
Test
stage is incorrect in ‘deploy-job’ pipeline job
Hi Rahul , everything seems to be working fine.
but got failure message
Test
stage is incorrect in ‘deploy-job’ pipeline jobmay i know your mail Id to send the video
i have sent the videos and pipeline to you
Hi @lavanya
Test
stage in your pipeline script is invalid. The Test
stage is supposed to test and confirm if you have deployed the correct changes on the servers but your test stage is just simply running the curl command without any logic to test and make sure if correct changes are deployed. So in any case your Test
stage will pass, even if you deploy the incorrect changes its going to pass which is logically incorrect and that’s the reason your task failed.
I hope it clears your doubts, please let us know if you still have any questions.
HI Inderpreet
so I need to check the index.html code which I have deployed in the deploy stage in Test stage . Is that
I supposed to do along with curl. But do I need to check only for ’ Welcome to the Xfusion Industries ’
pls make my task pending I will try again
I am using below declarative script for multstage pipeline. My stage one is success and i am trying to check the status in post condition but i am getting error. Kindly let me know what mistake i am doing.
def res = ‘false’
pipeline {
agent { label ‘ststor01’ }
stages {
stage(‘Deploy’) {
steps {
sh ‘echo Bl@kW | cp /home/sarah/web/* /data/’
}
post {
success {
sh res = ‘true’
}
}
}
stage(‘Test’) {
steps {
script {
if (res == “true”) {
sh ‘echo Deployment Success’
} else {
sh ‘exit 1’
}
}
}
}
}
}
Please find the scrip i used. I am unable to record using loom.
def tes = ‘false’
pipeline {
agent { label ‘ststor01’ }
stages {
stage(‘Deploy’) {
steps {
sh ‘echo Bl@kW | cp /home/sarah/web/* /data/’
sh ‘echo ${tes}’
}
post {
success {
tes = “true”
sh ‘echo ${tes}’
}
}
}
stage(‘Test’) {
steps {
script {
if(tes == ‘true’) {
sh ‘http://stlb01:80’
sh ‘echo Deployment Success’
} else {
sh ‘Deployment failed’
sh ‘exit 1’
}
}
}
}
}
}
Hi @nithyaks
There seems to be multiple issues with your pipeline script .
In the Deploy
stage steps you are echoing sudo password but you haven’t used sudo
with the cp command also the wildcard i.e * might not work there, you may need to use script
instead.
In the Test
stage under else section seems like you missed to use echo
in the first command i.e sh ‘Deployment failed’
@Inderpreet
Thanks for the suggestion. I have modified the script. wildcard working. Issue is with post check. After adding script it worked. After struggling for 10 days i got my task success. Thanks again.
yes Rahul .It was 10 days back. probably you didn’t check the msg that time. Thanks for responding.
There’s a Jenkins course on KodeKloud?