
8

申明式流水线
source link: https://linuxsuren.github.io/blog/devops/jenkins/pipeline/declarative/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

申明式流水线
申明式流水线
流水线插件从 2.5
版本开始支持申明式流水线。
申明式流水线(Declarative Pipeline)的语法结构更加清晰,而且兼容脚本式流水线。下面给出一个例子:
codes/jenkinsfile/declarative.groovy
pipeline {
agent {
label 'master'
}
stages {
stage('one') {
when {
branch 'master'
}
steps {
echo 'Hello World'
}
}
}
post {
always {
echo 'I will always say Hello again!'
}
}
}
原文件
如果您对 Jenkins 的流水线功能感兴趣,可以点击这里查看对应的插件介绍。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK