尽管skipDefaultCheckout true J​​enkins仍然克隆存储库

Who*_*AmI 1 groovy jenkins devops jenkins-pipeline

尽管使用了skipDefaultCheckout true,它仍然克隆了git repo。我的目标只是寻找更改然后执行某些脚本。我已经没有主意了。我尝试了如何在脚本化管道中使用 SkipDefaultCheckout,但我想它不起作用?

pipeline {
  agent any
  options {
    skipDefaultCheckout true
  }
   environment {
       branch = 'test'
   }
  stages {
    stage('commit_stage') {
      steps {
        script {
          properties([pipelineTriggers([pollSCM('*/5 * * * *')])])
          git branch: "${branch}", credentialsId: 'test', url: 'https://gitlab.test.net/core/test.git'
          sh '''
          branch=${branch}
          ssh bamboo@app-test.synchr.net "cd /opt/${branch}-8*/ && ./startup.sh status"
             '''
                }
          //define scm connection for polling

      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

Ind*_*ity 5

看起来您刚刚的选项语法错误。你有:

  options {
    skipDefaultCheckout true
  }
Run Code Online (Sandbox Code Playgroud)

它应该是

  options {
    skipDefaultCheckout()
  }
Run Code Online (Sandbox Code Playgroud)

管道语法