Option in Pipeline Scipt
https://www.jenkins.io/doc/book/pipeline/syntax/#options
option – retry – steps – error
pipeline{
agent any
stages{
stage("Build"){
options{
retry(3)
}
steps{
echo "before error statement"
error "Error statement just get executed"
echo "after error statement"
}
}
}
}


option – retry – not work with currentBuild.result = “FAILURE”
pipeline{
agent any
stages{
steps("Build"){
options{
retry(3)
}
steps{
echo "before setting current build to FAILURE"
script{
currentBuild.result = "FAILURE"
}
echo "after setting current build to FAILURE"
}
}
}
}

currentBuild.result = “FAILURE”
option – timeout – steps – sleep
pipeline{
agent any
stages{
stage("Build"){
options{
timeout(time: 1, unit: "SECONDS")
}
steps{
echo "Hello"
sleep 2
}
}
}
}

nếu build đã bị Aborted
option – timestamp() – Invalid option type “timestamps”
Invalid



https://issues.jenkins.io/browse/JENKINS-48556
resolve above problem
Anh em biết cách fix chỉ mình nhé.
options-skipdefaultcheckout




https://github.com/mrnim94/pipeline-stage-options-skipdefaultcheckout.git


skip default checkout

Sau đó save và sem có điều j sảy ra

thấy jenkins ko có bước checkout code
don’t skip default checkout


Bạn phần skip checkout bạn có thể đặt ở chỗ mình gọi:
– global pipeline: effect toàn pipeline
– stages: effect từng pipeline
Agent of agent



Jenkins permanent mình cài trên k8s theo cách này:




