我正在观察执行下一个阶段时正在调用上一个阶段,不确定我的jenkinsfile在这里出了什么问题
遵循此文档:
https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline
pipeline {
agent none
options {
gitLabConnection('MY_CONNECTION')
}
stages {
stage('scm_checkout') {
agent {
label 'win_64'
}
steps{
deleteDir()
checkout([$class: 'GitSCM',branches:[[name: '*/master']]
bat 'python -u repo/Jenkins_Scripts/createZip.py'
}
}
stage('scm_build') {
agent {
label 'win_64'
}
steps{
bat 'python -u repo/Jenkins_Scripts/build.py'
}
}
} // end of stages
}
输出
[Pipeline] stage
[Pipeline] { (scm_checkout)
[Pipeline] node
Running on xxxxxx in C:\jennew\workspace\PCQG-Pipeline
[Pipeline] {
[Pipeline] checkout
> git rev-parse --is-inside-work-tree # timeout=10
[Pipeline] withEnv
[Pipeline] {
[Pipeline] deleteDir
[Pipeline] checkout
Cloning the remote Git repository
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (scm_build)
[Pipeline] node
Running on xxxxxx in C:\jennew\workspace\PCQG-Pipeline
[Pipeline] {
[Pipeline] checkout
Cloning the remote Git repository
同样,此操作在每个阶段都一次又一次地克隆存储库。不确定我在哪里犯错。
答案 0 :(得分:1)
我认为您在这里所做的工作有点令人困惑。这是Jenkinsfile
对吗?因此,代理默认情况下会自行结帐。这些阶段并没有相互调用。
要关闭此功能,您需要将其添加到代理部分:
options { skipDefaultCheckout() }