Commit Graph

42 Commits

Author SHA1 Message Date
Vsevolod Fedorov f4d64f9f66 Move tests to pytest
Pytest makes each scenario into individual selectable test.
To be able to run each scenario separately is very useful for development.

Change-Id: I4b1c990a1fd839ce327cd7faa27159a9b9632fed
2022-12-20 10:44:43 +03:00
Artem Nikitin 289b5c55ad Fix uno-choice parameter macro processing
Jinja2 formatter wasn't applied in case of macro parameter
without arguments, due to `ModuleRegistry.dispatch`
couldn't find the parameter definition in the registry.

On other hand, project properties weren't applied for
uno-choice parameter macro with arguments, so it makes
impossible to use these parameters with macros.

Change-Id: Idaff9307dff30567a80b917f6e5ac0717100c349
2022-02-14 07:10:25 +00:00
Artem Nikitin 7f803887ee Fix uno-choice pluggin parameter macro usage
If the parameter is used in a macro, special fields from the
job layer (`_project-name`, `_project-full-name`) were not initialized.

Change-Id: Ie70f592c8ee71c3b8e1cfc3c2ba578e814af0a29
2021-07-12 10:47:14 +03:00
Pawel Piatek b8f0e75d34 Add git submodule threads
Signed-off-by: Pawel Piatek <xj@wp.pl>
Change-Id: I3dbc0e710460a5f55d4146cb1dd70e1ac3560e68
2021-03-18 12:39:34 +01:00
Artem Nikitin 30a73e5301 Fix conditional step issue
If there is the only one macro step in the conditional-step builders
with more than one build steps in the macro, it translated into the
SingleConditionalBuilder Jenkins XML tag, instead of ConditionalBuilder.
It leads to an invalid Jenkins configuration in that case.

Change-Id: Ib9866d93e4ee9fa2823dfb1b5d15870ff56ab9f8
2021-01-18 12:25:30 +03:00
Igor Lakhtenkov 2eb74a15cd Added trim option for String parameter.
Task: #22637
Change-Id: Ic2722aac586d3911e3ff5ab4c2d3c5a7a03fa14e
2020-05-22 17:04:49 +03:00
Thanh Ha 4d90c187a9 Auto-generated output from python-black
Please review the following patch containing the code changes in
the repo. This patch is a transition patch and is the auto-generated
output of the python-black tool.

Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
2019-09-09 19:23:24 +01:00
Imran Malik 4167cc5dbd Add depth option to git shallow-clone
- Use convert xml for shallow-clone and depth

Change-Id: I92d4bd2ded6db66bb608aed480e873e29e7b9474
2018-06-14 22:07:35 -04:00
Thanh Ha 5579395bc3
Add support for PostBuildScript 2.x
Updates the PostBuildScript plugin to support the 2.x version which
had a major overhaul of the XML output for the plugin.

Change-Id: I9ff3161bc50be236013e32f3ca9ad81b38004dc8
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2018-02-13 10:35:46 -05:00
Wayne Warren c1da0b15fb Add tests for inner macro expansion.
Change-Id: I535f3f0627c0948b951074977e15be04920790cd
2018-01-01 10:54:13 -06:00
Azat Khuzhin 9e51beb804 scm: introduce parent-credentials for git submodules
Jenkins Git plugin does not use your configured credentials for cloning
submodules, but you can told it to use credentials from parent
repository, by checking "Use credentials from default remote of parent
repository", and this "parent-credentials" will set that option.

So without this option jenkins git plugin will not be able to clone
submodules, if they are not public available.

The default value is "false", like in jenkins git plugin.

See-also: https://issues.jenkins-ci.org/browse/JENKINS-20941
Change-Id: I1cfb3f45bb082f538eff1a9e64a03be27f759a5f
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
2017-04-04 14:00:16 +03:00
Simon Kuhnle 3607646fac Prevent creation of empty parameters for Repo
Only manifest-url is required for the Repo plugin, all other parameters
are optional, or should at least not generate empty tags, because the
actual 'repo' tool will be called with empty parameters, leading to
a failed execution.

This was introduced with a34bd67ef7.
Before that change, empty strings did not generate XML entries.

Change-Id: Ia66845cb71b01c8e26285ed2eabb1ef32622e3e1
Story: 2000727
2017-01-26 10:59:38 +01:00
Darragh Bailey 4573b3a25d Refactor base test classes inheritance for reuse
Refactor base test class inheritance to allow for BaseTest class to be
reused without needing to also import the TestCase class everywhere in
order to avoid having the common test function executed on base classes.

This makes it easier to build base testing classes and then simplifies
the subclassing of these for actual tests.

Change-Id: I89809e8082469f814f245db4a9ab7658aac8a405
2016-09-14 14:58:57 +01:00
Kien Ha a34bd67ef7 Update Repo plugin to use convert_mapping_to_xml
- Update doc options to have default values
- Update mapping to use single quote syntax

Change-Id: I6d06f7120eaec81c785230dd524de0178be88c00
Signed-off-by: Kien Ha <kienha9922@gmail.com>
2016-07-19 23:40:43 -04:00
Jenkins 276e519395 Merge "SCM repo: add ignore-projects option" 2016-07-19 17:06:50 +00:00
Jenkins 8f33a3f087 Merge "Update Git SCM so that extensions are configured correctly." 2016-06-15 14:25:39 +00:00
Lucas Dutra Nunes 0791f9724a SCM repo: add ignore-projects option
Change-Id: I4468b699fa86d0790dbb01457d2e67e276740940
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-06-14 14:06:48 -03:00
Jeff Grafton cdfeb7bf66 Update Git SCM so that extensions are configured correctly.
Many configuration options have been extensions for at least 2 years, so
update the generated XML to actually configure these options.

Change-Id: Ic22ca4a6b8d61c977979a5eb63a2e884dc4391bd
2016-06-06 13:35:04 -07:00
Ryo Tagami c28ac736be Fix Multiple SCMs Plugin child XML format
Current implementation of Multiple SCMs Plugin seems to be broken.  Test
with following combination of Jenkins and Multiple SCMs Plugin

* Jenkins 2.2 (latest) + multiple-scms 0.6 (latest)
* Jenkins 1.651.1 (latest LTS) + multiple-scms 0.6 (latest)
* Jenkins 1.409.1 (oldest LTS) + multiple-scms 0.1 (oldest)
* Jenkins 1.396 (oldest) + multiple-scms 0.1 (oldest)

all emitted XML with following format (apart from `plugin=` here and
there):

```
  <scm class="org.jenkinsci.plugins.multiplescms.MultiSCM">
    <scms>
      <hudson.scm.SubversionSCM>
        :
      </hudson.scm.SubversionSCM>
      <hudson.scm.CVSSCM>
        :
      </hudson.scm.CVSSCM>
    </scms>
  </scm>
```

whereas current Jenkins Job Builder implementation emits XML with
following format:

```
  <scm class="org.jenkinsci.plugins.multiplescms.MultiSCM">
    <scms>
      <scm class="hudson.scm.SubversionSCM">
        :
      </scm>
      <scm class="hudson.scm.CVSSCM">
        :
      </scm>
    </scms>
  </scm>
```

This commit will fix this problem by modifying child `scm` node to a
correct format before adding to the parent `scm` node.

Change-Id: I0b9115c156a06a7fbdf529341dfc6100edf225aa
Signed-off-by: Ryo Tagami <rtagami@airstrip.jp>
2016-05-11 14:19:07 +09:00
Jenkins e3c5203bc1 Merge "add reference-repo option to scm git submodule" 2016-02-25 19:30:09 +00:00
Jenkins ef50e8c20f Merge "SCM repo: add show-all-changes option" 2016-02-25 19:01:44 +00:00
Jenkins 44dcbbe802 Merge "SCM repo: add trace option" 2016-02-25 19:01:29 +00:00
Jenkins 57898442bc Merge "SCM repo: add no-tags option" 2016-02-25 19:01:03 +00:00
Jenkins 64bd51dcd6 Merge "SCM repo: add reset-first option" 2016-02-25 19:00:16 +00:00
Jenkins eee063d4b2 Merge "SCM repo: add depth option" 2016-02-25 18:59:18 +00:00
Jenkins 3954224c78 Merge "SCM repo: add force-sync option" 2016-02-25 18:58:53 +00:00
Lucas Dutra Nunes 48e34564da SCM repo: add show-all-changes option
Change-Id: I6260808fe1c845aaed500712e97cd72f5b6c8fa3
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-18 16:22:03 -02:00
Lucas Dutra Nunes c0cf8b2b90 SCM repo: add trace option
Change-Id: Ie347f453dd3b677c343d3682b8e1f5c87cf93c27
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-18 16:22:03 -02:00
Lucas Dutra Nunes 856fc9b354 SCM repo: add no-tags option
Change-Id: I5c448776277afa4acbec71fa0a6f38286fe3401b
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-18 16:22:03 -02:00
Lucas Dutra Nunes 993e82a409 SCM repo: add reset-first option
Change-Id: Iafb79bb98ac3863f996027caa9136725cc59e973
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-18 16:22:03 -02:00
Lucas Dutra Nunes e5d291b79b SCM repo: add depth option
Change-Id: I056ca2e6eedfb6915338e654597ae562d89a6295
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-18 16:21:57 -02:00
Lucas Dutra Nunes ee3c59775d SCM repo: add force-sync option
Change-Id: I232d45f4066c0ac2b3cddce9ca99a9a02903813a
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
2016-02-15 13:28:17 -02:00
Christian Rodemeyer 66b7f4d907 add reference-repo option to scm git submodule
For the Git Plugin you can specify a reference repository to speed
up cloning. This is already implemented on the top level and this
commit adds it to the submodule extension.

Change-Id: Ic1d19d7c31ec7ecb5578a0ebad5bd936756c7582
2016-02-14 10:30:56 +01:00
Darragh Bailey 8805a34c0f Reorder imports to match hacking guidelines
Ensure that the imports follow the standard OpenStack hacking
guidelines.

Change-Id: Iaa4326aef118ddfd807dd006934f1d9ca80a1cfa
2015-12-23 15:23:42 -08:00
Justin Stoller bf88fe32c1 Allow deep formatting of macro parameters
Prior to this patch macros serialized into a yaml document, a simple string
substitution was applied and then they were re-loaded into python. This
created several problems:
 - newlines are lost because the yaml loading was not respecting the
   newline settings of the original strings (Story: 1387060)
 - {obj:} notation was not working for macro parameters (Story: 2000254)
 - multiline strings passed into scripts will create a yaml syntax error
   when being re-loaded (unticketed)

This patch resolves these problems by replacing the previous interpolation
code with the more robust `deep_format` method. A side effect of this patch
is that there are now fewer disparate code paths for interpolating variables.

Change-Id: Ia06c98286537a50dc52c6e5e000b32ebc9e8ede2
Signed-off-by: Justin Stoller <justin.stoller@gmail.com>
2015-11-13 10:57:36 -08:00
Darragh Bailey 9bfbffa559 Capture logs with FakeLogging Fixture
Capture logs to attach them on exceptions to simplify the debugging of
errors in tests when they occur.

Change-Id: I5c1b5c306aba37789a8d41eabf65e0ac628af838
2015-09-30 16:25:22 +01:00
Khai Do d5cc4f3394 Change test folder name to 'fixture' for consistency
All of the other tests that contain xml and yaml files are in
a 'fixture' folder.  Change the name in this instance to be more
consistent.

Change-Id: I5d899c83e868b8f8ff80eb121884285718bc2db2
2015-02-17 10:58:44 -08:00
Thanh Ha 7d44c58aa2 Update SCM Git Clean configuration to use new extensions style
Use the extensions style configuration for setting the SCM Git clean
configuration. With this format we deprecate the older (clean: bool)
configuration format and replace it with this format:

clean:
    after: bool
    before: bool

The older configuration is still supported so users who did not update
their YAML files can upgrade without updating all their YAML files first.

Change-Id: I1cfc0e2951c2b4de5e67bcb8abdf0b8c070e7fc6
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2015-02-03 21:52:20 -05:00
Thanh Ha d7c37c89a8 Update SCM Wipe workspace to use extensions style
Use the newer extensions style configuration for the SCM Wipe workspace
option. This change simply changes the output style of this
configuration leaving the original YAML configuration values in tact so
it is backwards compatible with the old style configuration for
wipe-workspace setting.

While this patch still sets the old <wipeOutWorkspace> value long with
the new extensions value. Jenkins appears to be happy with both values
present and prefers the extensions format if it exists. This should
allow the older Jenkins that only supports the older config format to
continue to work.

Change-Id: Ib5b1809d19a35f83f524ee84b18f0c58b851c70b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
2015-02-03 21:49:57 -05:00
Kyle Rockman 009b362968 add support to git for changelog against branch
added support for another extension type, and fix how extensions are populated to xml

Change-Id: Ic9cf21a268d4ee3fb9b9efdee65c3d49e0cdb31e
Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
2014-11-21 08:14:37 -06:00
Christian Hofstaedtler 8999a87c13 Add support for 'ignore-notify' in git SCM
This option is named "Don't trigger a build on commit notifications"
in the Jenkins Web UI.

Change-Id: I338af61f8bfdef1545d1ea206e6874cda38957cd
2014-07-27 00:41:04 +02:00
Lukas Bednar 34ea32ba80 scms: MultiSCM is generated for scms hidden in macro
This patch fixes problem with generating MultiSCM in case that scms are
encapsulated in macro.
This patch includes simple tests to cover if-branches for this change.

Example:

- scm:
  name: xxx
  scm:
    - git: ...

- scm:
  name: yyy
  scm:
    - git: ...

- scm:
  name: xxx-and-yyy
  scm:
    - xxx
    - yyy

- job:
  name: my-job
  scm:
    - xxx-and-yyy

Change-Id: If3e7b3d19e51545a5623ee060fb7673a7a989233
Signed-off-by: Lukas Bednar <lbednar@redhat.com>
Closes-bug: #1285515
2014-05-26 17:49:04 +02:00