Have a lot of jobs created with jenkins-jobs-builder that it is proving difficult to maintain.
Looking to move to dsl and possibly pipeline-dsl.
Most of jobs have the following logic:
- ability to build debug and/or release builds
- manually invoked or scm triggered
- ability to select whether to promote or not, which I use to store artifacts to package repository or a ssh-server depending on job
- users want build artifacts for each build
- users may not want those artifacts to be used by dependent jobs OR promoted to package repository.
For every job, there are 2 sub-jobs to handle the release and debug builds
- actual builds are performed in a docker container
- there is a shared id (patch number) between the release and debug builds, but again user can disable one or both via build parameter.
I can't quite figure out how to do everything in dsl yet and pipeline-dsl even less.
First, thing. I have a set of parameters for each job, 1 that is using PersistentParameter plugin. This is needed for manually triggered usage where user can set a value and it is remembered the next time. Looking at the dsl-plugin api viewer, I can see the plugin, but can not make it work.
import com.gem.persistentparameter.*
job('ci') {
description 'Build and test the app.'
parameters {
stringParam('p1','master','my des')
persistentStringParameterDefinition('p2','t123',false, 'help')
}
scm {
github 'sheehan/job-dsl-playground'
}
steps {
gradle 'test'
}
publishers {
archiveJunit 'build/test-results/**/*.xml'
}
}
javaposse.jobdsl.dsl.DslScriptException: (script, line 7) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.persistentStringParameterDefinition() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.Boolean, java.lang.String) values: [p2, t123, false, help]
How can I achieve this?
However, I can port my yaml/logic to dsl and clean things up and hopefully simplified, and I can use gradle to load jobs into jenkins.
For pipeline-dsl, I am less sure. Loading Jenkinsfile from scm doesn't fit my situation, but possibly a dsl seedjob to handle it can work. The pipeline-dsl has less features so I will probably be face with similar issues as above. How would I handle? To really clean my jobs up, ideally, would want my parameters moved up to pipeline parameters.
Thanks in advance,
Doug