Thank you very much for your reply, Mark. Unfortunately, that is also not working for me. Can you please provide some samples? I can see from the Plugin documentation that it is excluding some files. However, I would like to exclude folders / directories. Say for example, if I have a GitHub repository like below.
https://github.com/org-name/project-name.git The App project is at the root level and has a Jenkinsfile and an associated multibranch pipeline job in Jenkins. I have a db directory at project-name/db path. Here also, I have a Jenkinsfile and an associated multibranch pipeline job in Jenkins. I tried with the following path combinations in the App build multibranch pipeline configuration (cancel build excluded regions strategy) to exclude any changes in the db folder / directory from triggering an App build. project-name/db project-name/db/.* project-name/db/**/* project-name/db/**/.* db db/.* db/**/* db/**/.* None of the above works. Please help. Regards, Venkatesh On Mon, Feb 15, 2021 at 9:10 PM Mark Waite <[email protected]> wrote: > The git plugin provides some capabilities that are used in Freestyle > projects but are not usable or are not the best choice when using a > multibranch pipeline. Path restrictions is one of those capabilities. > Rather than using the path restrictions from inside the checkout step in > the Jenkinsfile, you'll need to use the Pipeline: Multibranch build > strategy plugin > <https://plugins.jenkins.io/multibranch-build-strategy-extension/>. > > If you need to ignore changes by specific authors, you'll need to use the > Ignore > committer strategy plugin > <https://plugins.jenkins.io/ignore-committer-strategy/> rather than using > the git plugin facility that is similar. > > Those strategies provide a higher level implementation for multibranch > pipelines. The higher level implementation can work for multiple SCM > providers. > > Mark Waite > > On Mon, Feb 15, 2021 at 5:02 AM Ven H <[email protected]> wrote: > >> I have a GitHub repository and a multi-branch pipeline job. I am trying >> to exclude some paths from triggering builds, but can't get it to work. Any >> help would be appreciated. Here are the details. >> >> GitHub URL: https://github.com/<my-org>/<project-name>.git >> >> The project has App, DB and Config. DB and Config folders are inside the >> App. App is at the root level. There are 3 multibranch jobs and 3 >> Jenkinsfile at the following paths. >> >> <project-name>/Jenkinsfile >> <project-name>/db/Jenkinsfile >> <project-name>/config/Jenkinsfile >> >> Requirement is to ensure that a change in a file inside DB directory >> shouldn't trigger a build for App. PFB the checkout step in the App >> Jenkinsfile. >> >> checkout([ >> $class: 'GitSCM', >> branches: [[name: "*/${BRANCH_NAME}"]], >> doGenerateSubmoduleConfigurations: false, >> extensions: [[$class: 'DisableRemotePoll'],[$class: 'PathRestriction', >> excludedRegions: '<project-name>/db/.*', includedRegions: ''], >> [$class: 'RelativeTargetDirectory', relativeTargetDir: "<my-folder-path>" >> ] >> ], >> gitTool: "<my-git-portable>", >> submoduleCfg: [], >> userRemoteConfigs: [ >> [ >> credentialsId: "<my-creds>", >> url: "https://github.com/<my-org>/<project-name>.git" >> ] >> ] >> ]) >> >> I have tried various combinations for excludedRegions like below. I tried >> generating the above syntax using the Pipeline Syntax with the option >> "Polling ignores commits in certain paths" >> >> 1. <project-name>/db/.* >> 2. <project-name>/db/**/* >> 3. db/.* >> 4. db/**/* >> 5. With and without "includedRegions" >> 6. With and without DisableRemotePoll (Force Polling using Workspace) >> >> None of the above seems to be working. Can anyone please help me with >> this? >> >> Regards, >> Venkatesh >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/CAPp28eoqYt2Z2VptVZG2Pi0qF%2BT01e7XeHWfDh5eXAeTiFMcyg%40mail.gmail.com >> <https://groups.google.com/d/msgid/jenkinsci-users/CAPp28eoqYt2Z2VptVZG2Pi0qF%2BT01e7XeHWfDh5eXAeTiFMcyg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF-jii9qmm8b6E9Cst19WRix7ntOtQdGBZozcHqwVHXxQ%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF-jii9qmm8b6E9Cst19WRix7ntOtQdGBZozcHqwVHXxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPp28epBRpthniQVP1mH2o8xYWhvPAOgfSr9g6raWQb1NFkqOQ%40mail.gmail.com.
