[Build] Read parameters from Jenkins-files #3370
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When creating a pipeline-job the Jenkins JobDSL, by default, doesn't consider the parameters defined within the pipeline-job's Jenkinsfile. Therefore parameters defined only within the Jenkinsfile are only added to the job's definition when the pipeline is executed first (and updated on subsequent executions, if changes are applied). In order to make parameters available even on the first run, instead they have to be defined in the groovy-file that uses the Jenkins Job-DSL to define the pipeline-job.
This is an long standing, known, yet unsolved issue in Jenkins:
The current solution to define parameters in the job-definition has the consequence that an important part of the pipeline is defined in another file, which makes maintenance more difficult.
This implements an enhanced work-around, allowing to define the parameters within a pipeline's Jenkinsfile again:
During the definition of a pipeline-job, it's Jenkinsfile file is parsed and its AST is searched for parameter definitions. All encountered parameters are translated dynamically into corresponding parameters of the job definition.
With this new possibility all parameters have their definition moved into their pipeline's Jenkinsfile.
Furthermore this adds a JenkinsFile for the
seedJob
of the RelEng JIPP, which was previously manually defined as a free-style job.That
seedJob
pipeline also dynamically created jobs from all pipeline files in the corresponding folders. It's therefore sufficient to just add aJenkinsFile
and not necessary anymore to explicitly add a corresponding pipeline job definition anywhere.