尽管skipDefaultCheckout为true,Jenkins仍在克隆存储库

时间:2019-10-31 16:38:54

标签: jenkins groovy jenkins-pipeline devops

尽管使用skipDefaultCheckout true,它仍然会克隆git repo。 我的目标只是寻找更改,然后执行某些脚本。  我的想法已经用完了。我尝试过此How to use SkipDefaultCheckout in a scripted pipeline,但我怀疑它不起作用吗?

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

      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

看起来您的选项语法错误。您已经:

  options {
    skipDefaultCheckout true
  }

应该是

  options {
    skipDefaultCheckout()
  }

Pipeline Syntax