# pipeline - Jenkinsfile
从一个简单的示例开始:
pipeline {
agent any
stages {
stage('Example') {
steps {
echo 'Hello World'
}
}
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 常用选项说明
pipeline {
agent any
environment { // 全局变量
CC = 'clang'
}
stages {
stage('Example') {
environment {
AN_ACCESS_KEY = credentials('my-prefined-secret-text') // 局部变量
}
steps {
sh 'printenv'
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 参考链接
- groovy documentation: http://groovy-lang.org/semantics.html
- pipeline syntax: https://www.jenkins.io/zh/doc/book/pipeline/syntax/