excludedUsers - SCM - Git

135 views
Skip to first unread message

Logan Hendricks

unread,
Apr 5, 2017, 5:11:09 PM4/5/17
to job-dsl-plugin


Hello Everyone,

I'm running into a current situation where I am attempting to exclude a specific user from Git Polling, and discovering that while the class excludedUsers exists on the Subversion options, the class is yet to exist for Git.

I would assume the final syntax would be as 
scm {
   
git {
     
remote {
         
url("${GlobalConfig.git_base_url}${name}")
     
}
     
branch("*/${BRANCH}")
     
extensions {
         
localBranch("${BRANCH}")
         
excludedUsers("userToExclude")
     
}
   
}
}

I would almost consider this a new feature or a bug in the program.  What would be the best way to make a request?

Thanks,

Logan

Victor Martinez

unread,
Apr 5, 2017, 5:46:28 PM4/5/17
to job-dsl-plugin
Hi Logan,

You don't need to do anything but following one of the below approaches to accomplish your requirement:
job('example-1') {
    scm
{
        git
{
            remote
{
                name
('remoteB')
                url
('git@server:account/repo1.git')
           
}
            extensions
{
                userExclusion
{
                      // If set, and Jenkins is set to poll for changes, Jenkins will ignore any revisions committed by users in this list when determining if a build needs to be triggered.
                     excludedUsers('userToExclude')
               }
           
}
        }
   
}
}

Further details: your_jenkins_url/plugin/job-dsl/api-viewer/index.html#path/javaposse.jobdsl.dsl.helpers.ScmContext.git-extensions-userExclusion


Cheers

Logan Hendricks

unread,
Apr 6, 2017, 7:17:59 PM4/6/17
to job-dsl-plugin
Victor,

My first response was to also turn to the configure closure.  I was unable to configure that particular closure to work properly within my current project.  But with the docs you submitted, I will review my efforts and see if I can prove more fruitful on that.  

However, what looks more promising is the posted snippet you gave on that extension of userExclusion. that seems exactly what I wanted it to accomplish.  I will be glad to review that some more as well.

Logan
Reply all
Reply to author
Forward
0 new messages