简体   繁体   中英

Jenkins declarative pipeline with repo

I'm using Jenkins with declarative pipeline and I need to create a job triggered by any modification on a repo repository and all dependent projects inside the manifest.

Actually I've to do the following fetch and trigger all my dependencies:

pipeline {
  agent any
  stages {
    stage('fetch') {
      steps {
        sh 'repo init -u ${MY_REPO_URL}'
        sh 'repo sync'
      }
    }
  }
}

In a Freestyle project with repo plugin , I only need to add:

在此输入图像描述

But there is no "Source Code Management" in a pipeline job

What can I do ?

Thanks

Ok, what I wasn't understanding is that pollSCM autodetect repo project. So with scheduled trigger, all repositories are checked.

Also, with the pipeline syntax generator I've found this pretty way for init and sync my repository:

    checkout changelog: true, poll: false, scm: [$class: 'RepoScm', currentBranch: true, \
        forceSync: true, jobs: 4, manifestBranch: manifestRev, \
        manifestRepositoryUrl: manifestRepo, \
        quiet: false, resetFirst: fullClean, resetFirst: fullReset]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM