Pipeline Team project customize settings

67 views
Skip to first unread message

Kesav Kumar Kolla

unread,
Apr 25, 2016, 12:06:11 PM4/25/16
to Jenkins Users
I've created a team project with Bitbucket branch source.  On the team project I configured Discard old Items.  This setting is not honored by the individual projects that's been created for each of my project.

Is there any way to specify these project level settings in Jenkinsfile?

Thanks in advance,
-Kesav

Daniel Beck

unread,
Apr 25, 2016, 12:16:28 PM4/25/16
to jenkins...@googlegroups.com

> On 25.04.2016, at 18:06, Kesav Kumar Kolla <kesav...@gmail.com> wrote:
>
> On the team project I configured Discard old Items. This setting is not honored by the individual projects that's been created for each of my project.
>
> Is there any way to specify these project level settings in Jenkinsfile?

The folder level 'discard old items' is about deleting per-branch/per-repo _projects_ when their branch/repo no longer exists.

To configure _build_ deletion for individual projects, use a snippet generator for 'properties: Set job properties' for your pipeline. It will look something like this:

properties [[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10']]]

Some documentation for this is here:
https://jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties

Kesav Kumar Kolla

unread,
Apr 25, 2016, 12:49:19 PM4/25/16
to Jenkins Users, m...@beckweb.net
Thanks a lot for the pointer.

Kesav Kumar Kolla

unread,
Apr 25, 2016, 3:26:24 PM4/25/16
to Jenkins Users, m...@beckweb.net
After I add

properties [[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5']]]

In Jenkinsfile I'm getting the following exception:

groovy.lang.MissingPropertyException: No such property: properties for class: groovy.lang.Binding
        at groovy
.lang.Binding.getVariable(Binding.java:62)
        at org
.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:210)
        at org
.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
        at org
.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
        at org
.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
        at com
.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:23)
        at com
.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17)
        at
WorkflowScript.run(WorkflowScript:2)
        at ___cps
.transform___(Native Method)
        at com
.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62)
        at com
.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
        at com
.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)
        at sun
.reflect.GeneratedMethodAccessor322.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at com
.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
        at com
.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
        at com
.cloudbees.groovy.cps.Next.step(Next.java:58)
        at com
.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
        at org
.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
        at org
.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
        at org
.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
        at org
.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:106)
        at org
.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
        at org
.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:277)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
        at org
.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at hudson
.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
        at jenkins
.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at java
.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java
.lang.Thread.run(Thread.java:745)


Reply all
Reply to author
Forward
0 new messages