目录
前言
- 本篇继续学习Pipeline Basic Steps插件中的isUnix、retry、sleep三个方法
isUnix
- 如果节点在类Unix 系统(例如 Linux 或 Mac OS X)上运行,则返回 true,如果是 Windows,则返回 false。
println env.JOB_NAME
println env.BUILD_NUMBER
pipeline{
agent any
stages{
stage("fileExists") {
steps{
script {
if(isUnix() == true) {
echo("this jenkins job running on a linux-like system")
}else {
echo("the jenkins job running on a windows system")
}
}
}
}
}
}
retry
- 重试次数
sleep
- 暂停流水线
println env.JOB_NAME
println env.BUILD_NUMBER
pipeline{
agent any
stages{
stage("retry and sleep") {
steps{
script{
try {