-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JENKINS-36780 Pipeline support #5
base: master
Are you sure you want to change the base?
Conversation
… use latest version of workflow-job plugin
… both AbstractProject and WorkflowJob. Propagate the necessary changes to make it compile (there are still some references to AbtractProject that have to be replaced)
…roject on the class with Job
…eas jenkins.version is also set in parent, and inline with other plugins inheriting same parent (there's a profile in there to use 1.580.3)
… handled elsewhere
2.- EzMatchers.java: use Job instead of AbstractProject, rename HasImplmentations to HasImplementations 3.- BehaviourTest.java: impl_finds_known_templates needs to call descriptor.isApplicable, so doFillTemplateJobNameItems() knows which types of jobs to look for
…ethod so the check is done every time. 2.- make the code non-dependent of workflow plugin. In order to avoid cluttering the code, use a new method at EzReflectionUtils to handle the isAssignable calls
…*all* changes from upstream master 2.- EzMatchers.java: use Job instead of AbstractProject, rename HasImplmentations to HasImplementations 3.- BehaviourTest.java: impl_finds_known_templates needs to call descriptor.isApplicable, so doFillTemplateJobNameItems() knows which types of jobs to look for 4.- PromotedBuildsTemplateUtils: move original method to private mergePromotions, and also make use of EzReflectionUtils.isAssignable instead of direct class.isAssignable so this kind of call is always done the same way
… to run normally if the workflow-job plugin isn't installed. Added more methods at EzReflectionUtils so the JobsFacade code isn't cluttered with reflection code
Conflicts: pom.xml src/main/java/com/joelj/jenkins/eztemplates/exclusion/AssignedLabelExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/DescriptionExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/DisabledExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/Exclusions.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/EzTemplatesExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/HardCodedExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/JobParametersExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/JobPropertyExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/MatrixAxisExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/ScmExclusion.java src/main/java/com/joelj/jenkins/eztemplates/exclusion/TriggersExclusion.java src/main/java/com/joelj/jenkins/eztemplates/promotedbuilds/PromotedBuildsTemplateUtils.java src/main/java/com/joelj/jenkins/eztemplates/utils/ProjectUtils.java src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java src/main/resources/com/joelj/jenkins/eztemplates/AbstractTemplateImplementationProperty/config-details.jelly src/test/java/com/joelj/jenkins/eztemplates/BehaviourTest.java src/test/java/com/joelj/jenkins/eztemplates/exclusion/ExclusionUtilTest.java
Still not perfect but reduces the number of classes in each package. Also added BackwardsCompatiblity for pre-existing config.xmls that contain the old class-names
In 2.32.2, SaveableListener allowed much better templating by making use of BulkChange class to suppress events before "commit". We now baseline beyond this change so will assume it.
Avoid classloading errors if pipeline is not installed
As an example, a pipeline with parameters as below will set pipeline {
agent any
parameters {
booleanParam(defaultValue: true, description: '', name: 'userFlag')
}
stages {
stage("foo") {
steps {
echo "flag: ${params.userFlag}"
}
}
}
} <hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.BooleanParameterDefinition>
<name>userFlag</name>
<description></description>
<defaultValue>true</defaultValue>
</hudson.model.BooleanParameterDefinition> The interaction with EZT merging |
@juanpablo-santos @jxramos You had opinions on this previously, can you tell me a little about how you think this 'works' |
Hi @drekbour, apologies for the late response, Christmas caught up with me :-) Haven't been able to look at the code yet but, said that, pipelines from templated jobs shouldn't define parameters themselves, but use those defined at the job level: parameters defined at pipeline level cannot be templated, whereas those defined at job level can, being that the main use for EZT for pipeline jobs. None of our pipelines defines parameters, so we haven't come across the EZT should somehow omit doing anything if the parameter is defined on a pipeline (the parameter wouldn't be "templatable"), and that would also fix the issue with the plugin doing something on pipeline runs. More precisely, it would be ok for me if the plugin ends up triggered by pipeline runs (because of Jenkins internals or whatever), but the plugin is able to detect this situation, or that the property comes from a pipeline, and do nothing. Allow me a couple of weeks to take a look at this, and I'll update with whatever I come up with. br, |
Complete rework of #3. This adds the technical ability to apply templating to pipeline jobs (WorkflowJob) with a distinct set exclusions from the the classic project (AbstractProject) mode.
It does not answer much about the impact of doing this so will sit as a WIP even if integrated into
master
until we're a bit more certain of the end-to-end flow.