add jenkinsfile

master
dustoair 3 years ago
parent 19996cc2df
commit 1a8d3572be

33
Jenkinsfile vendored

@ -0,0 +1,33 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo "Hello World"'
// sh 'CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o exporter main.go'
}
}
stage('Test') {
steps {
/* `make check` returns non-zero on test failures,
* using `true` to allow the Pipeline to continue nonetheless
*/
sh 'ls'
}
}
stage('Deploy') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
//访问该currentBuild.result变量允许Pipeline确定是否有任何测试失败。在这种情况下值将是 UNSTABLE。
}
}
steps {
sh 'echo ok'
}
}
//部署可能意味着各种步骤具体取决于项目或组织的要求并且可能是从构建的工件发送到Artifactory服务器将代码推送到生产系统的任何步骤。
//在Pipeline示例的这个阶段“构建”和“测试”阶段都已成功执行。实际上“部署”阶段只能在上一阶段成功完成否则Pipeline将早退。
}
}
Loading…
Cancel
Save