是否可以将包含jenkinsfile的存储库与包含代码的存储库分开

lf5gs5x2  于 2022-12-03  发布在  Jenkins
关注(0)|答案(1)|浏览(247)

我在Blue Ocean的帮助下创建了以下jenkinsfile

pipeline {
  agent any
  stages {
    stage('git') {
      steps {
        git(url: 'git-url-to-code', branch: 'master', credentialsId: 'gitjenkins')
        
      }
    }
    stage('Deploy') {
      steps {
        sshagent(credentials: ['cert']) {
          sh 'ssh -tt -o StrictHostKeyChecking=no user@machine ls -trl'
          sh 'ssh -o StrictHostKeyChecking=no user@machine rm -rf /apps/shiny/spielMA/ '
          sh 'scp -rp  ./. user@machine:/apps/shiny/spielMA/'
        }
      }
    }
  }
}

但它不工作。更准确地说,我的jenkins代码在repositoryJund der Code in repoC中,如果我在masterC中推送新代码,它无法触发管道!有没有可能用不在代码库中的jenkinscode触发管道?

相关问题