jenkins dsl с плагином scriptler в блоке конфигурации не работает

Я могу создать задание, используя игровую площадку jenkins здесь http://job-dsl.herokuapp.com/, где xml точно такой же, как config.xml созданного вручную задания, но когда я запускаю начальное число для задания, задание в приведенном ниже сценарии создается, но мой блок конфигурации полностью игнорируется. Необходимый плагин установлен, я могу настроить его вручную, но я не могу настроить его с помощью DSL.

вот мой скрипт dsl.

def disabledAll = false;

def projects = [
    [name: 'test-job', description: 'Test Job', branch: 'develop', disabled: disabledAll]]

projects.each { project ->
    job(project.name) {
        disabled(project.disabled)


    description(project.description)
    keepDependencies(false)

    properties {

    }

authorization {
    permission('hudson.model.Item.Read:test')
    permission('hudson.model.Item.Workspace:test')
    permission('hudson.model.Item.Build:test')
}

parameters {
    stringParam('TAG', null, null)
}

steps() {
    shell('export BUILD_VERSION=\${BUILD_VERSION} \nexport TAG=\${TAG} \n #run grunt build \ncd /var/lib/jenkins/buildcode/ \n#grunt distribute --verbose --build=\${BUILD_VERSION} --branch=\${TAG} \ngrunt distribute --build=\${BUILD_VERSION} --branch=\${TAG}')
}


configure { 
    it / 'properties' / 'hudson.model.ParametersDefinitionProperty' / 'parametersDefinitions' << 'com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerStringParameterDefinition' {
        name('BUILD_VERSION')
        description('Overall Build version')
        __uuid('1515be93-8945-4247-b0dc-798452187a2b')
        __remote(false)
        __scriptlerScriptId('lat_build_values.groovy')
    }

}


}

}

вывод xml:

<project>
    <actions></actions>
    <description>Test Job</description>
    <keepDependencies>false</keepDependencies>
    <properties>
        <hudson.security.AuthorizationMatrixProperty>
            <blocksInheritance>false</blocksInheritance>
            <permission>hudson.model.Item.Read:test</permission>
            <permission>hudson.model.Item.Workspace:test</permission>
            <permission>hudson.model.Item.Build:test</permission>
        </hudson.security.AuthorizationMatrixProperty>
        <hudson.model.ParametersDefinitionProperty>
            <parameterDefinitions>
                <hudson.model.StringParameterDefinition>
                    <name>TAG</name>
                    <defaultValue></defaultValue>
                </hudson.model.StringParameterDefinition>
            </parameterDefinitions>
            <parametersDefinitions>
                <com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerStringParameterDefinition>
                    <name>BUILD_VERSION</name>
                    <description>Overall Build version seen in the Business Manager</description>
                    <__uuid>1515be93-8945-4247-b0dc-798452187a2b</__uuid>
                    <__remote>false</__remote>
                    <__scriptlerScriptId>lat_build_values.groovy</__scriptlerScriptId>
                </com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerStringParameterDefinition>
            </parametersDefinitions>
        </hudson.model.ParametersDefinitionProperty>
    </properties>
    <scm class='hudson.scm.NullSCM'></scm>
    <canRoam>true</canRoam>
    <disabled>false</disabled>
    <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
    <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
    <triggers class='vector'></triggers>
    <concurrentBuild>false</concurrentBuild>
    <builders>
        <hudson.tasks.Shell>
            <command>export BUILD_VERSION=${BUILD_VERSION} 
export TAG=${TAG} 
 #run grunt build 
cd /var/lib/jenkins/buildcode/ 
#grunt distribute --verbose --build=${BUILD_VERSION} --branch=${TAG} 
grunt distribute --build=${BUILD_VERSION} --branch=${TAG}</command>
        </hudson.tasks.Shell>
    </builders>
    <publishers></publishers>
    <buildWrappers></buildWrappers>
</project>

Любая идея, что мне нужно сделать для этого, чтобы фактически создать конфигурацию в задании?


person Steven McDermott    schedule 20.05.2016    source источник


Ответы (1)


В названии элемента опечатка. Это parameterDefinitions, а не parametersDefinitions.

Это должно работать:

job('example') {
  configure { 
    it / 'properties' / 'hudson.model.ParametersDefinitionProperty' / 'parameterDefinitions' << 'com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerStringParameterDefinition' {
      name('BUILD_VERSION')
      description('Overall Build version')
      __uuid('1515be93-8945-4247-b0dc-798452187a2b')
      __remote(false)
      __scriptlerScriptId('lat_build_values.groovy')
    }
  }
}
person daspilker    schedule 20.05.2016