Rename fixtures directory to job_fixtures to prepare for adding view_fixtures
directory in the following commits.
Change-Id: Ic20997cae020b542ddc22bf444fa6b92fbcae064
The changes between plugin version 2.30.0-2.32.0 have been
implemented. Current test cases are updated, and also new
test cases are added in order to verify old version XML
output has not been altered.
Documentation uses gerrit004.yaml as an exampple, therefore,
`build-cancellation-policy` have also been implemented to
show as example.
Signed-off-by: Eren Atas <eatas.contractor@libertyglobal.com>
Change-Id: I55fb6f8dd722d50cff369a6fba0e11c96b0c08aa
Add a missing extension to git scm which enables the option to do
"Git LFS pull after checkout"
Add lfs-pull fixtures
Change-Id: Ie8b98877f3f282ac0b32dbeb089e6d0d9ccc25c8
Due to the fact how dispatching works the 'authorization' property
handler was not always invoked through Properties.gen_xml(), leading to
a bug and an invalid test case: project-with-auth-properties.(yaml/xml)
This change pushes the logic for determining if the object is a
folder/multi-branch project from Properties.gen_xml() to the
authorization() function itself. For that to work the authorization()
function needed access to the top-level job object, which is now
conditionally passed to each dispatched function as a keyword argument,
if the function takes 'job_data' argument. Note that taking this
argument is completely optional so no changes were required in other
handlers. In the future the same approach could be taken to eliminate
the hacks for 'uno-choice' in Parameters.gen_xml().
Additionally ModuleRegistry.dispatch() now merges the top-level job
object with any template data before deep-formatting, so that job-level
properties are now available in Jinja templates. A very nice use case
is in project-with-auth-j2-yaml.yaml test case.
Change-Id: I9a49de74055cd9acfdc87dbad1fc454548643e8f
The properties of 'project' objects are deepcopied in
YamlParser._expandYamlForTemplateJob(), including any Jinja2YamlLoader
objects produced by !j2-yaml tag. Because of the missing __deepcopy__()
definition in Jinja2YamlLoader, the parent class' implementation was
used, causing the deepcopied object be of Jinja2Loader type.
Consequently the rendered value was always a string, not an instance of
LateYamlLoader as it supposed to be.
This change fixes the issue in Jinja2YamlLoader and potentially in
LateYamlLoader, however the latter is currently not deepcopied anywhere
so no test could be written to cover it.
Change-Id: I24fda368a4af0e9aac7b78c478ac7b4eddf27b9b
Following parameters have been implemented in JJB:
- Active Choices Parameter
- Active Choices Reactive Reference Parameter
Test cases also have been written.
Change-Id: I6e953aa26114fde9ff293ed17cc17d5972df9af3
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
The tag provides Jinja templating capabilities for generating parts of
YAML structures. Two potential use cases are provided as test cases and
are linked in the documentation.
The new tag should also help address some use cases people were asking
about, like here:
https://groups.google.com/g/jenkins-job-builder/c/HkVZVuBDlKM.
Change-Id: I96392e42c3c79a9be0a8f736506908701251dd62
Added also a test case for version specific changes
Change-Id: I5213dccffc441037c63ee7c042aee4a8a84d9732
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
Updated test cases as well, The tag has been introduced after 2.35.2
therefore the parameter is also >=2.35.2
Change-Id: Ie0801108a16969b420b341e2deaa6ba62deb116c
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
Up until now <inheritanceStrategy> tag was only added to jobs-in-a-folder
and folder configs. In JJB the tag's class is always set to
"InheritParentStrategy" which according to the docs means the "item will
inherit its parent items permissions". Apparently <inheritanceStrategy>
tag needs to be present on top-level jobs also. For top-level jobs
setting the tag's class value to "InheritParentStrategy" means the job
"will inherit the global security security settings" and this is the
default behavior.
The code has simplified a bit - if it's a folder then we use a different
property name for authorization matrix property, other than that the
code is the same for all three "variants": folder, job-in-a-folder and
job-outside-a-folder (top-level job).
Also this change fixes the missing <inheritanceStrategy> tag for
job-in-a-folder, where the folder name was specified as part of the
"name" key instead of the standalone "folder" key. With this change we
no longer check if a job is in a folder or not, so it's implicitly
fixed. Added a test case to catch potential regressions in the future.
The copyright notice reflects this and the previous contribution in this
module.
Change-Id: I84b22c09c8a107aab2b4eca20feffc9b61675a92
In the current implementation, jjb creates an empty
combinationFilter tag whenever there is `executionStrategy`.
This empty tag should not appear.
Change-Id: I2bf25ae58d12904ce0a00e0a5cfefbf27d9451ad
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
Implemented the following tags that have been missing:
- displayBuildErrorsOnDownstreamBuilds
- blackListCommitAuthor
- GhprbCommentFile
- GhprbNoCommitStatus
Following tags are printed when the value of the key is empty:
- whiteListTargetBranches
- blackListTargetBranches
- buildDescTemplate
- triggeredStatus
- startedStatus
- statusUrl
- addTestResults
Also updated tests
Change-Id: I1e19841d88728af9ac6aa9e1c78f89fe962a583f
Signed-off-by: Eren ATAS <eatas.contractor@libertyglobal.com>
The changes include:
- deprecated the following options and made support for them dependent
on the Gerrit Trigger plugin version:
- 'no-name-and-email'
- 'readable-message'
- 'trigger-for-unreviewed-patches'
- added a set of new options:
- 'name-and-email-parameter-mode' (replaced 'no-name-and-email')
- 'commit-message-parameter-mode' (replaced 'readable-message')
- 'change-subject-parameter-mode'
- 'comment-text-parameter-mode'
all these options can have one of the following values:
- NONE
- PLAIN
- BASE64
the default value for the first two options is taken from the
respective options they replaced, if they exist in the input YAML
file, so the overall change should be backward compatible
- fixed the value generated for <dynamicTriggerConfiguration> element
it should be "true"/"false" instead of "True"/"False"
- added an empty <dynamicGerritProjects> element when dynamic trigger
functionality is disabled to match what the plugin does
With the above changes the markup generated by JJB is fully aligned with
Gerrit Trigger plugin v2.30.x. Tested on Gerrit Trigger plugin v2.30.0.
Task: 39871
Story: 2007722
Change-Id: I25800874f51a93a351926a9a1be255cce80b88bd
The changes include:
- <concurrentBuild> should now be represented as
<org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty/>
property
- <triggers> should now be localed inside
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
property, in <properties> section
- unsupported XML elements got removed:
- <blockBuildWhenDownstreamBuilding>
- <blockBuildWhenUpstreamBuilding>
- <assignedNode>
- <canRoam>
- <customWorkspace>
- got rid of publishers from project_pipeline_template005.{xml,yaml} as
these are not supported in Pipeline jobs
The above changes align the produced XMLs with the ones from Jenkins 2.190.1
and Pipeline plugin v2.6.
Task: 39836
Story: 2007708
Change-Id: I650ef2ee60e872cce8f93de5f391933d68ec81f0
Without the fix:
> 2020-05-11 10:56:12.238+0000 [id=29522] WARNING
> o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost/job/someFolder/createItem
> java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty cannot be cast to hudson.model.JobProperty
It turns out com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty
should only be applied to Folders, not Jobs. The latter should use
hudson.security.AuthorizationMatrixProperty.
Task: 39760
Story: 2007666
Change-Id: I64907265b214fb1e489e1e657a30c90d6ee08c3f
The change fixes a XML generating error (KeyError: '_use_folder_perms')
for project, which isn't contained in a folder and has got authorization
properties.
Task: 38110
Story: 2007087
Change-Id: I2e0ec6e524d07a935333b35e10eb4204af9256f7
Ensure that we can resolve any lazily loaded templates that might be
dictionary keys in yaml. For more informmation please see the added test
case in tests/yamlparser/fixtures/jinja-string04.yaml.
Change-Id: I67fbca422f2165729af15e4d039278ad66f6240b
Story: 2006431
Task: 36338
Jinja templates are not deep-copyable so they cannot be used in
"defautls" sections or to pick defualts for job groups or projects.
This works around the issue by waiting until we render the template to
construct the template itself.
Story: 2006431
Task: 36337
Change-Id: Ief31fdaac06bb14d0aaba71c8c0e658a7f861671
This outputs the correct XML schema for authorization properties for
both a folder, and a job inside a folder.
Story: 2006493
Story: 2006611
Change-Id: I14662855613ce146f74b85f5978a0ed828f4439b
This also adds support for using custom loaders in job definitions
not just job-templates and builders. I have also added unit tests for include-jinja2-as-yaml custom loader.
Example usage:
- axis:
type: user-defined
name: VERSIONS
values:
!include-jinja2-as-yaml: versions.j2.yaml.inc
Where versions.j2.yaml.inc is
{% for possible_versions in configuration["possible_versions"] %}
- {{ possible_versions["versions"] }}
{% endfor -%}
Change-Id: I15a431d5a86b29d704efda8576965ade2b7dcd2f
The problem with `if default:` is that it evaluates int 0 to be
equivalent to False. If a user is passing in a int 0 then they
should be expected to receive int 0 in the case of defaults.
Change-Id: Ida1f4c68b6f9d1af5b98d633b552f038c57654cc
Signed-off-by: Thanh Ha <zxiiro@linux.com>
The code assumes that the value of cancel-builds-on-update is a boolean.
This fails when specifying the value of the param in a variable because when
deep_formatter formats the data, booleans turn into strings.
Also added tests for such case.
Change-Id: Ib1ec3d5545091be550bfe023e49c7982372d5b55
Signed-off-by: Daniel Belenky <daniel.belenky@gmail.com>
Preparatory move for adopting pre-commit hooks.
Shoudl only remove newlines and spaces at end of files.
Change-Id: Ia33679467c533722b9308f7e7b74be395c926428
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Update trigger-parameterized-job arguments, to include
trigger from child projects.
Closes-Bug: story/2002157
Change-Id: Iae0610ee942dd2cad95e3fcaa8b70b16f42b3c50
Negative values can't be set as default values
currently, for example:
num-to-keep: '{num_to_keep|-1}'
It will return an exception saying: 'parameter missing
to format'.
This should also allow other patterns as long they do
not contain the closing curly bracket.
Change-Id: I26dafb80b120f2c071dda6d9a27319d533b0f874
Adds a yaml application tag '!join:' to support defining data as a list
while having the resulting contents automatically joined together with
the specified delimiter and passed as a string into the resulting object
returned by yaml for JJB to process.
This allows users to store long lists of data that is combined together
for use with Jenkins plugins that expect a delimited string of arguments
instead of needing each module in JJB to provide individual support.
Change-Id: I745181ade3926d5c29708963189ae499a0378ece
This allows the use of the {% include %} tag[0] within Jinja2 templates,
with the same search path used for looking up other templates (i.e. the
one which LocalLoader is instantiated with).
[0] http://jinja.pocoo.org/docs/2.9/templates/#include
Change-Id: I0403c385ee317e1460a80a9bf717aa4712f37e2f
As Jinja2 provides functionality other than interpolation, it's entirely
feasible to use it outside of a context where there are template
variables. This change ensures that we always deep format Jinja2
templates, even when we wouldn't normally interpolate a regular JJB
template.
Change-Id: Ia3f86dd2073d48594eaf791fa2277db7e5ebf0ab