mig82 / folder-properties-plugin

A Jenkins plugin for defining properties at folder level which can then be inherited by the jobs contained inside it.
5 stars 10 forks source link

How to set Folder properties in Groovy script? #4

Closed vidolch closed 4 years ago

vidolch commented 4 years ago

I am developing a script which creates a folder with sub-projects that should contain predefined set of properties. I cannot wrap my head around how to do this and never saw it documented...

mig82 commented 4 years ago

Hi @vidolch. I believe you're referring to Job DSL. Then this is how:

folder('my folder') {
    properties {
        folderProperties {
            properties {
                stringProperty {
                    key('FOO')
                    value('foo1')
                }
            }
        }
    }
}

It's documented here: https://plugins.jenkins.io/folder-properties/#FolderPropertiesPlugin-JobDSL