summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jenkins_jobs/__main__.py4
-rw-r--r--jenkins_jobs/cli/entry.py17
-rw-r--r--jenkins_jobs/modules/builders.py147
-rw-r--r--jenkins_jobs/modules/helpers.py1
-rw-r--r--jenkins_jobs/modules/parameters.py47
-rw-r--r--jenkins_jobs/modules/project_multibranch.py50
-rw-r--r--jenkins_jobs/modules/project_pipeline.py5
-rw-r--r--jenkins_jobs/modules/properties.py2
-rw-r--r--jenkins_jobs/modules/publishers.py67
-rw-r--r--jenkins_jobs/modules/scm.py59
-rw-r--r--jenkins_jobs/modules/triggers.py27
-rw-r--r--jenkins_jobs/modules/wrappers.py3
-rw-r--r--jenkins_jobs/xml_config.py83
-rw-r--r--requirements.txt2
-rw-r--r--tests/base.py4
-rw-r--r--tests/builders/fixtures/config-file-provider01.xml1
-rw-r--r--tests/builders/fixtures/config-file-provider01.yaml1
-rw-r--r--tests/builders/fixtures/xunit-full.xml48
-rw-r--r--tests/builders/fixtures/xunit-full.yaml30
-rw-r--r--tests/builders/fixtures/xunit-minimal.xml21
-rw-r--r--tests/builders/fixtures/xunit-minimal.yaml5
l---------[-rw-r--r--]tests/hipchat/fixtures/hipchat001.conf6
-rw-r--r--tests/hipchat/fixtures/hipchat001.plugins_info.yaml2
-rw-r--r--tests/hipchat/fixtures/hipchat001.xml7
-rw-r--r--tests/hipchat/fixtures/hipchat001.yaml4
-rw-r--r--tests/hipchat/fixtures/hipchat_room001.conf5
-rw-r--r--tests/hipchat/fixtures/hipchat_room001.plugins_info.yaml (renamed from tests/hipchat/fixtures/hipchat_rooms-list001.plugins_info.yaml)2
-rw-r--r--tests/hipchat/fixtures/hipchat_room001.xml (renamed from tests/hipchat/fixtures/hipchat_rooms-list001.xml)7
-rw-r--r--tests/hipchat/fixtures/hipchat_room001.yaml (renamed from tests/hipchat/fixtures/hipchat_rooms-list001.yaml)6
l---------tests/hipchat/fixtures/hipchat_rooms-list001.conf1
-rw-r--r--tests/multibranch/fixtures/multi_scm_full.xml2
-rw-r--r--tests/multibranch/fixtures/multi_scm_full.yaml1
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_full.xml12
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_full.yaml6
-rw-r--r--tests/multibranch/fixtures/scm_gerrit_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_gerrit_full.yaml1
-rw-r--r--tests/multibranch/fixtures/scm_git_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_git_full.yaml1
-rw-r--r--tests/multibranch/fixtures/scm_github_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_github_full.yaml1
-rw-r--r--tests/parameters/fixtures/extended-choice-param-full.xml3
-rw-r--r--tests/parameters/fixtures/extended-choice-param-minimal-groovy.xml1
-rw-r--r--tests/parameters/fixtures/extended-choice-param-minimal.xml1
-rw-r--r--tests/parameters/fixtures/node-label001.xml17
-rw-r--r--tests/parameters/fixtures/node-label001.yaml6
-rw-r--r--tests/parameters/fixtures/node-label002.xml17
-rw-r--r--tests/parameters/fixtures/node-label002.yaml6
-rw-r--r--tests/parameters/fixtures/node-label003.xml17
-rw-r--r--tests/parameters/fixtures/node-label003.yaml6
-rw-r--r--tests/parameters/fixtures/node-label004.xml17
-rw-r--r--tests/parameters/fixtures/node-label004.yaml4
-rw-r--r--tests/properties/fixtures/priority_sorter002.plugins_info.yaml2
-rw-r--r--tests/publishers/fixtures/gitlab-message-full.xml16
-rw-r--r--tests/publishers/fixtures/gitlab-message-full.yaml11
-rw-r--r--tests/publishers/fixtures/gitlab-message-minimal.xml16
-rw-r--r--tests/publishers/fixtures/gitlab-message-minimal.yaml2
-rw-r--r--tests/publishers/fixtures/gitlab-vote.xml6
-rw-r--r--tests/publishers/fixtures/gitlab-vote.yaml2
-rw-r--r--tests/scm/fixtures/accurev001.xml18
-rw-r--r--tests/scm/fixtures/accurev001.yaml15
-rw-r--r--tests/triggers/fixtures/build-result-full.xml30
-rw-r--r--tests/triggers/fixtures/build-result-full.yaml12
-rw-r--r--tests/triggers/fixtures/build-result-minimal.xml19
-rw-r--r--tests/triggers/fixtures/build-result-minimal.yaml6
-rw-r--r--tests/wrappers/fixtures/config-file-provider001.xml1
-rw-r--r--tests/wrappers/fixtures/config-file-provider001.yaml1
-rw-r--r--tests/wrappers/fixtures/config-file-provider002.xml1
-rw-r--r--tests/wrappers/fixtures/config-file-provider003.xml2
-rw-r--r--tests/wrappers/fixtures/config-file-provider003.yaml1
-rw-r--r--tests/xml_config/test_xml_config.py4
l---------[-rw-r--r--]tests/yamlparser/fixtures/folders001.xml16
-rw-r--r--tests/yamlparser/fixtures/project_pipeline_template006.xml21
-rw-r--r--tests/yamlparser/fixtures/project_pipeline_template006.yaml18
-rwxr-xr-xtools/test-commands.sh8
-rw-r--r--tox.ini2
75 files changed, 891 insertions, 128 deletions
diff --git a/jenkins_jobs/__main__.py b/jenkins_jobs/__main__.py
new file mode 100644
index 00000000..8171c614
--- /dev/null
+++ b/jenkins_jobs/__main__.py
@@ -0,0 +1,4 @@
+from jenkins_jobs.cli.entry import main
+
+if __name__ == "__main__":
+ main()
diff --git a/jenkins_jobs/cli/entry.py b/jenkins_jobs/cli/entry.py
index 484b7a3d..888c21c1 100644
--- a/jenkins_jobs/cli/entry.py
+++ b/jenkins_jobs/cli/entry.py
@@ -17,7 +17,6 @@ import io
import os
import logging
import platform
-import sys
from stevedore import extension
import yaml
@@ -27,9 +26,6 @@ from jenkins_jobs.config import JJBConfig
from jenkins_jobs import utils
from jenkins_jobs import version
-if sys.version_info[0] != 2:
- from importlib import reload
-
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
@@ -147,14 +143,15 @@ def main():
# utf-8 workaround for avoiding unicode errors in stdout/stderr
# see https://stackoverflow.com/a/2001767/99834
- import codecs
import sys
- reload(sys)
- sys.setdefaultencoding('utf-8')
- sys.stdout = codecs.getwriter('utf8')(sys.stdout)
- sys.stderr = codecs.getwriter('utf8')(sys.stderr)
- # end of workaround
+ if sys.version_info[0] == 2:
+ import codecs
+ reload(sys) # noqa
+ sys.setdefaultencoding('utf-8')
+ sys.stdout = codecs.getwriter('utf8')(sys.stdout)
+ sys.stderr = codecs.getwriter('utf8')(sys.stderr)
+ # end of workaround
argv = sys.argv[1:]
jjb = JenkinsJobs(argv)
diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py
index f2b2fe00..f0c37af8 100644
--- a/jenkins_jobs/modules/builders.py
+++ b/jenkins_jobs/modules/builders.py
@@ -2063,6 +2063,9 @@ def config_file_provider(registry, xml_parent, data):
(default '')
* **variable** (`str`) -- Define an environment variable to be
used (default '')
+ * **replace-tokens** (`bool`) -- Replace tokens in config file. For
+ example "password: ${PYPI_JENKINS_PASS}" will be replaced with
+ the global variable configured in Jenkins.
Example:
@@ -4167,3 +4170,147 @@ def nodejs(parser, xml_parent, data):
convert_mapping_to_xml(nodejs, data, mapping, fail_required=True)
convert_mapping_to_xml(nodejs, data, mapping_opt, fail_required=False)
+
+
+def xunit(registry, xml_parent, data):
+ """yaml: xunit
+ Process tests results. Requires the Jenkins :jenkins-wiki:`xUnit Plugin
+ <xUnit+Plugin>`.
+
+ :arg str thresholdmode: Whether thresholds represents an absolute number
+ of tests or a percentage. Either 'number' or 'percent'. (default
+ 'number')
+ :arg list thresholds: Thresholds for both 'failed' and 'skipped' tests.
+
+ :threshold (`dict`): Threshold values to set, where missing, xUnit
+ should default to an internal value of 0. Each test threshold
+ should contain the following:
+
+ * **unstable** (`int`)
+ * **unstablenew** (`int`)
+ * **failure** (`int`)
+ * **failurenew** (`int`)
+
+ :arg int test-time-margin: Give the report time margin value in ms, before
+ to fail if not new unless the option **requireupdate** is set for the
+ configured framework. (default 3000)
+ :arg list types: Frameworks to configure, and options. Supports the
+ following: ``aunit``, ``boosttest``, ``checktype``, ``cpptest``,
+ ``cppunit``, ``ctest``, ``dotnettest``, ``embunit``, ``fpcunit``,
+ ``gtest``, ``junit``, ``mstest``, ``nunit``, ``phpunit``, ``tusar``,
+ ``unittest``, and ``valgrind``.
+
+ The 'custom' type is not supported.
+
+ :type (`dict`): each type can be configured using the following:
+
+ * **pattern** (`str`): An Ant pattern to look for Junit result
+ files, relative to the workspace root (default '')
+ * **requireupdate** (`bool`): fail the build whenever fresh tests
+ results have not been found (default true).
+ * **deleteoutput** (`bool`): delete temporary JUnit files
+ (default true).
+ * **skip-if-no-test-files** (`bool`): Skip parsing this xUnit type
+ report if there are no test reports files (default false).
+ * **stoponerror** (`bool`): Fail the build whenever an error occur
+ during a result file processing (default true).
+
+ Minimal Example:
+
+ .. literalinclude::
+ /../../tests/builders/fixtures/xunit-minimal.yaml
+ :language: yaml
+
+ Full Example:
+
+ .. literalinclude::
+ /../../tests/builders/fixtures/xunit-full.yaml
+ :language: yaml
+
+ """
+ logger = logging.getLogger(__name__)
+ xunit = XML.SubElement(xml_parent,
+ 'org.jenkinsci.plugins.xunit.XUnitBuilder')
+ xunit.set('plugin', 'xunit')
+
+ # Map our internal types to the XML element names used by Jenkins plugin
+ types_to_plugin_types = {
+ 'aunit': 'AUnitJunitHudsonTestType',
+ 'boosttest': 'BoostTestJunitHudsonTestType',
+ 'checktype': 'CheckType',
+ 'cpptest': 'CppTestJunitHudsonTestType',
+ 'cppunit': 'CppUnitJunitHudsonTestType',
+ 'ctest': 'CTestType',
+ 'dotnettest': 'XUnitDotNetTestType', # since plugin v1.93
+ 'embunit': 'EmbUnitType', # since plugin v1.84
+ 'fpcunit': 'FPCUnitJunitHudsonTestType',
+ 'gtest': 'GoogleTestType',
+ 'junit': 'JUnitType',
+ 'mstest': 'MSTestJunitHudsonTestType',
+ 'nunit': 'NUnitJunitHudsonTestType',
+ 'phpunit': 'PHPUnitJunitHudsonTestType',
+ 'tusar': 'TUSARJunitHudsonTestType',
+ 'unittest': 'UnitTestJunitHudsonTestType',
+ 'valgrind': 'ValgrindJunitHudsonTestType',
+ # FIXME should implement the 'custom' type
+ }
+ implemented_types = types_to_plugin_types.keys() # shortcut
+
+ # Unit framework we are going to generate xml for
+ supported_types = []
+
+ for configured_type in data['types']:
+ type_name = next(iter(configured_type.keys()))
+ if type_name not in implemented_types:
+ logger.warning("Requested xUnit type '%s' is not yet supported",
+ type_name)
+ else:
+ # Append for generation
+ supported_types.append(configured_type)
+
+ # Generate XML for each of the supported framework types
+ xmltypes = XML.SubElement(xunit, 'types')
+ mappings = [
+ ('pattern', 'pattern', ''),
+ ('requireupdate', 'failIfNotNew', True),
+ ('deleteoutput', 'deleteOutputFiles', True),
+ ('skip-if-no-test-files', 'skipNoTestFiles', False),
+ ('stoponerror', 'stopProcessingIfError', True),
+ ]
+ for supported_type in supported_types:
+ framework_name = next(iter(supported_type.keys()))
+ xmlframework = XML.SubElement(xmltypes,
+ types_to_plugin_types[framework_name])
+
+ helpers.convert_mapping_to_xml(xmlframework,
+ supported_type[framework_name],
+ mappings,
+ fail_required=True)
+
+ xmlthresholds = XML.SubElement(xunit, 'thresholds')
+ for t in data.get('thresholds', []):
+ if not ('failed' in t or 'skipped' in t):
+ logger.warning(
+ "Unrecognized threshold, should be 'failed' or 'skipped'")
+ continue
+ elname = ("org.jenkinsci.plugins.xunit.threshold.%sThreshold" %
+ next(iter(t.keys())).title())
+ el = XML.SubElement(xmlthresholds, elname)
+ for threshold_name, threshold_value in next(iter(t.values())).items():
+ # Normalize and craft the element name for this threshold
+ elname = "%sThreshold" % threshold_name.lower().replace(
+ 'new', 'New')
+ XML.SubElement(el, elname).text = str(threshold_value)
+
+ # Whether to use percent of exact number of tests.
+ # Thresholdmode is either:
+ # - 1 : absolute (number of tests), default.
+ # - 2 : relative (percentage of tests)
+ thresholdmode = '1'
+ if 'percent' == data.get('thresholdmode', 'number'):
+ thresholdmode = '2'
+ XML.SubElement(xunit, 'thresholdMode').text = thresholdmode
+
+ extra_config = XML.SubElement(xunit, 'extraConfiguration')
+ XML.SubElement(extra_config, 'testTimeMargin').text = str(
+ data.get('test-time-margin', '3000'))
diff --git a/jenkins_jobs/modules/helpers.py b/jenkins_jobs/modules/helpers.py
index 964fb469..7c003b1d 100644
--- a/jenkins_jobs/modules/helpers.py
+++ b/jenkins_jobs/modules/helpers.py
@@ -101,6 +101,7 @@ def config_file_provider_builder(xml_parent, data):
('file-id', 'fileId', None),
('target', 'targetLocation', ''),
('variable', 'variable', ''),
+ ('replace-tokens', 'replaceTokens', False),
]
convert_mapping_to_xml(xml_file, file, mapping, fail_required=True)
diff --git a/jenkins_jobs/modules/parameters.py b/jenkins_jobs/modules/parameters.py
index f475546b..bad86d52 100644
--- a/jenkins_jobs/modules/parameters.py
+++ b/jenkins_jobs/modules/parameters.py
@@ -191,19 +191,49 @@ def label_param(registry, xml_parent, data):
:arg str name: the name of the parameter
:arg str default: the default value of the parameter (optional)
:arg str description: a description of the parameter (optional)
+ :arg str matching-label: to run all nodes matching label
+ 'success', 'unstable' or 'allCases' (optional)
+ :arg str node-eligibility: all nodes, ignore temporary nodes or
+ ignore temporary offline nodes (optional, default all nodes)
- Example::
+ Example:
+
+ .. literalinclude:: /../../tests/parameters/fixtures/node-label001.yaml
+ :language: yaml
- parameters:
- - label:
- name: node
- default: precise
- description: "The node on which to run the job"
"""
- base_param(registry, xml_parent, data, True,
+
+ pdef = base_param(registry, xml_parent, data, True,
'org.jvnet.jenkins.plugins.nodelabelparameter.'
'LabelParameterDefinition')
+ XML.SubElement(pdef, 'allNodesMatchingLabel').text = "true"
+
+ valid_types = ['allCases', 'success', 'unstable']
+ mapping = [
+ ('matching-label', 'triggerIfResult', 'allCases', valid_types)
+ ]
+ convert_mapping_to_xml(pdef, data, mapping, fail_required=True)
+
+ eligibility_label = data.get('node-eligibility', 'all').lower()
+ eligibility_label_dict = {
+ 'all': 'org.jvnet.jenkins.plugins.'
+ 'nodelabelparameter.node.'
+ 'AllNodeEligibility',
+ 'ignore-offline': 'org.jvnet.jenkins.plugins.'
+ 'nodelabelparameter.node.'
+ 'IgnoreOfflineNodeEligibility',
+ 'ignore-temp-offline': 'org.jvnet.jenkins.plugins.'
+ 'nodelabelparameter.node.'
+ 'IgnoreTempOfflineNodeEligibility',
+ }
+ if eligibility_label not in eligibility_label_dict:
+ raise InvalidAttributeError(eligibility_label, eligibility_label,
+ eligibility_label_dict.keys())
+
+ XML.SubElement(pdef, 'nodeEligibility').set(
+ "class", eligibility_label_dict[eligibility_label])
+
def node_param(registry, xml_parent, data):
"""yaml: node
@@ -396,6 +426,8 @@ def extended_choice_param(registry, xml_parent, data):
:arg str multi-select-delimiter: value between selections when the
parameter is a multi-select (optional, default ',')
:arg str groovy-script: the groovy script contents (optional, default ',')
+ :arg str groovy-script-file: location of groovy script file to generate
+ parameters (optional, default '')
:arg str classpath: the classpath for the groovy script
(optional, default ',')
:arg str default-groovy-script: the default groovy
@@ -450,6 +482,7 @@ def extended_choice_param(registry, xml_parent, data):
('description-property-file', 'descriptionPropertyFile', ''),
('description-property-key', 'descriptionPropertyKey', ''),
('groovy-script', 'groovyScript', ''),
+ ('groovy-script-file', 'groovyScriptFile', ''),
('classpath', 'groovyClasspath', ''),
('default-groovy-script', 'defaultGroovyScript', ''),
('default-groovy-classpath', 'defaultGroovyClasspath', ''),
diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py
index d6447cb8..eaf19d46 100644
--- a/jenkins_jobs/modules/project_multibranch.py
+++ b/jenkins_jobs/modules/project_multibranch.py
@@ -55,6 +55,8 @@ Plugins required:
(default '-1, all')
* **days-to-keep** (`int`): For how many days should a build be kept.
(default '-1, forever')
+ * **script-path** (`str`): Path to Jenkinsfile, relative to workspace.
+ (default 'Jenkinsfile')
Job examples:
@@ -270,7 +272,8 @@ class WorkflowMultiBranch(jenkins_jobs.modules.base.Base):
'class': self.jenkins_class,
'reference': '../..'
})
- XML.SubElement(factory, 'scriptPath').text = 'Jenkinsfile'
+ XML.SubElement(factory, 'scriptPath').text = data.get(
+ 'script-path', 'Jenkinsfile')
return xml_parent
@@ -298,6 +301,17 @@ def bitbucket_scm(xml_parent, data):
:arg bool discover-tags: Discovers tags on the repository.
(default false)
+ :arg str server-url: The address of the bitbucket server. (optional)
+ :arg str head-filter-regex: A regular expression for filtering
+ discovered source branches. Requires the :jenkins-wiki:`SCM API Plugin
+ <SCM+API+Plugin>`.
+ :arg str discovery-branch: Discovers branches on the repository.
+ Valid options: ex-pr, only-pr, all.
+ Value is not specified by default.
+ :arg str discover-pr-origin: Discovers pull requests where the origin
+ repository is the same as the target repository.
+ Valid options: mergeOnly, headOnly, mergeAndHead.
+ Value is not specified by default.
Minimal Example:
@@ -323,6 +337,7 @@ def bitbucket_scm(xml_parent, data):
mapping_optional = [
('credentials-id', 'credentialsId', None),
+ ('server-url', 'serverUrl', None),
]
helpers.convert_mapping_to_xml(
source, data, mapping_optional, fail_required=False)
@@ -331,6 +346,39 @@ def bitbucket_scm(xml_parent, data):
if data.get('discover-tags', False):
XML.SubElement(traits,
'com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait')
+ if data.get('head-filter-regex', None):
+ rshf = XML.SubElement(traits,
+ 'jenkins.scm.impl.trait.RegexSCMHeadFilterTrait')
+ XML.SubElement(rshf, 'regex').text = data.get('head-filter-regex')
+
+ if data.get('discover-pr-origin', None):
+ dpro = XML.SubElement(traits,
+ 'com.cloudbees.jenkins.plugins.bitbucket'
+ '.OriginPullRequestDiscoveryTrait')
+ dpro_strategies = {
+ 'mergeOnly': '1',
+ 'headOnly': '2',
+ 'mergeAndHead': '3'
+ }
+ dpro_mapping = [
+ ('discover-pr-origin', 'strategyId', None, dpro_strategies)
+ ]
+ helpers.convert_mapping_to_xml(
+ dpro, data, dpro_mapping, fail_required=True)
+
+ if data.get('discover-branch', None):
+ dbr = XML.SubElement(traits,
+ 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait')
+ dbr_strategies = {
+ 'ex-pr': '1',
+ 'only-pr': '2',
+ 'all': '3'
+ }
+ dbr_mapping = [
+ ('discover-branch', 'strategyId', None, dbr_strategies)
+ ]
+ helpers.convert_mapping_to_xml(
+ dbr, data, dbr_mapping, fail_required=True)
def gerrit_scm(xml_parent, data):
diff --git a/jenkins_jobs/modules/project_pipeline.py b/jenkins_jobs/modules/project_pipeline.py
index 2b945cc0..6b90860a 100644
--- a/jenkins_jobs/modules/project_pipeline.py
+++ b/jenkins_jobs/modules/project_pipeline.py
@@ -66,6 +66,11 @@ Inline DSL job template example:
.. literalinclude::
/../../tests/yamlparser/fixtures/project_pipeline_template005.yaml
+"Pipeline as nested stage" example :
+
+ .. literalinclude::
+ /../../tests/yamlparser/fixtures/project_pipeline_template006.yaml
+
.. _Pipeline as code: https://jenkins.io/solutions/pipeline/
"""
diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py
index 3efe1037..98f1d645 100644
--- a/jenkins_jobs/modules/properties.py
+++ b/jenkins_jobs/modules/properties.py
@@ -507,7 +507,7 @@ def priority_sorter(registry, xml_parent, data):
/../../tests/properties/fixtures/priority_sorter002.yaml
:language: yaml
"""
- plugin_info = registry.get_plugin_info('Priority Sorter Plugin')
+ plugin_info = registry.get_plugin_info('PrioritySorter')
version = pkg_resources.parse_version(plugin_info.get('version', '0'))
if version >= pkg_resources.parse_version("2.0"):
diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py
index 1da0e095..e3d371a0 100644
--- a/jenkins_jobs/modules/publishers.py
+++ b/jenkins_jobs/modules/publishers.py
@@ -4843,6 +4843,73 @@ def gitlab_notifier(registry, xml_parent, data):
helpers.convert_mapping_to_xml(top, data, mappings, fail_required=True)
+def gitlab_vote(registry, xml_parent, data):
+ """yaml: gitlab-vote
+ Set vote for build status on GitLab merge request.
+ Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
+
+ Example:
+
+ .. literalinclude::
+ ../../tests/publishers/fixtures/gitlab-vote.yaml
+ :language: yaml
+ """
+ XML.SubElement(
+ xml_parent,
+ 'com.dabsquared.gitlabjenkins.publisher.GitLabVotePublisher')
+
+
+def gitlab_message(registry, xml_parent, data):
+ """yaml: gitlab-message
+ Add note with build status on GitLab merge request.
+ Requires the Jenkins :jenkins-wiki:`GitLab Plugin <GitLab+Plugin>`.
+
+ :arg bool failure-only: make a comment only on failure (default false)
+ :arg bool success-note: make a comment on GitLab Merge Request
+ if build succeeds (default false)
+ :arg bool failure-note: make a comment on GitLab Merge Request
+ if build failed (default false)
+ :arg bool abort-note: make a comment on GitLab Merge Request
+ if build aborted (default false)
+ :arg bool unstable-note: make a comment on GitLab Merge Request
+ if build unstable (default false)
+
+ :arg str success-note-text: text of comment on success build (default '')
+ :arg str failure-note-text: text of comment on failed build (default '')
+ :arg str abort-note-text: text of comment on aborted build (default '')
+ :arg str unstable-note-text: text of comment on unstable build (default '')
+
+ Minimal Example:
+
+ .. literalinclude::
+ /../../tests/publishers/fixtures/gitlab-message-minimal.yaml
+ :language: yaml
+
+ Full Example:
+
+ .. literalinclude::
+ /../../tests/publishers/fixtures/gitlab-message-full.yaml
+ :language: yaml
+ """
+ gitlab = XML.SubElement(
+ xml_parent,
+ 'com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher'
+ )
+ gitlab.set('plugin', 'gitlab-plugin')
+
+ mapping = [('failure-only', 'onlyForFailure', False),
+ ('success-note', 'replaceSuccessNote', False),
+ ('failure-note', 'replaceFailureNote', False),
+ ('abort-note', 'replaceAbortNote', False),
+ ('unstable-note', 'replaceUnstableNote', False),
+ ('success-note-text', 'successNoteText', ''),
+ ('failure-note-text', 'failureNoteText', ''),
+ ('abort-note-text', 'abortNoteText', ''),
+ ('unstable-note-text', 'unstableNoteText', '')]
+
+ helpers.convert_mapping_to_xml(gitlab, data, mapping, fail_required=True)
+
+
def zulip(registry, xml_parent, data):
"""yaml: zulip
Set build status on zulip.
diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py
index 904d3c3f..54b597c6 100644
--- a/jenkins_jobs/modules/scm.py
+++ b/jenkins_jobs/modules/scm.py
@@ -1375,6 +1375,65 @@ def dimensions(registry, xml_parent, data):
convert_mapping_to_xml(scm, data, optional_mapping, fail_required=False)
+def accurev(registry, xml_parent, data):
+ """yaml: accurev
+ Specifies the AccuRev SCM repository for this job.
+ Requires the Jenkins :jenkins-wiki:`AccuRev Plugin <AccuRev+Plugin>`.
+
+ :arg str depot: Depot you want to use for the current job (optional)
+ :arg str stream: Stream where the build will be generated from (optional)
+ :arg str server-name: AccuRev server you are using
+ for your builds (required)
+ :arg bool ignore-parent-changes: Ignore possibility
+ of changes in the parent stream (default false)
+ :arg bool clean-reference-tree: Deletes any external files
+ in reference tree (default false)
+ :arg bool build-from-snapshot: Creates snapshot
+ of the target stream, then populates and
+ builds from that snapshot (default false)
+ :arg bool do-not-pop-content: If checkbox is on, elements
+ are not populating vice versa (default false)
+ :arg str workspace: Name of existing workspace (optional)
+ :arg str reference-tree: Name of the reference tree (optional)
+ :arg str directory-offset: Relative directory path from
+ the default Jenkins workspace location
+ where the files from the stream, workspace,
+ or reference tree should be retrieved from. (optional)
+ :arg str sub-path: Makes a "best effort" to ensure
+ that only the sub-path is populated (optional)
+ :arg str filter-poll-scm: Specify directories or
+ files you want Jenkins to check before starting a build (optional)
+ :arg str snapshot-name-format: Naming conventions
+ for the snapshot in this field (optional)
+
+ Example:
+
+ .. literalinclude:: /../../tests/scm/fixtures/accurev001.yaml
+ """
+ scm = XML.SubElement(xml_parent,
+ 'scm', {'class': 'hudson.plugins.accurev.AccurevSCM'})
+ mapping = [
+ ('depot', 'depot', None),
+ ('stream', 'stream', None),
+ ('server-name', 'serverName', None),
+ ('ignore-parent-changes', 'ignoreStreamParent', False),
+ ('clean-reference-tree', 'cleanreftree', False),
+ ('build-from-snapshot', 'useSnapshot', False),
+ ('do-not-pop-content', 'dontPopContent', False),
+ ]
+ convert_mapping_to_xml(scm, data, mapping, fail_required=True)
+
+ additional_mapping = [
+ ('workspace', 'workspace', None),
+ ('reference-tree', 'reftree', None),
+ ('directory-offset', 'directoryOffset', None),
+ ('sub-path', 'subPath', None),
+ ('filter-poll-scm', 'filterForPollSCM', None),
+ ('snapshot-name-format', 'snapshotNameFormat', None),
+ ]
+ convert_mapping_to_xml(scm, data, additional_mapping, fail_required=False)
+
+
class SCM(jenkins_jobs.modules.base.Base):
sequence = 30
diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py
index 1fd24e6e..cf7db989 100644
--- a/jenkins_jobs/modules/triggers.py
+++ b/jenkins_jobs/modules/triggers.py
@@ -1406,26 +1406,21 @@ def build_result(registry, xml_parent, data):
:arg str cron: The cron syntax with which to poll the jobs for the
supplied result (default '')
- Example::
+ Full Example:
- triggers:
- - build-result:
- combine: true
- cron: '* * * * *'
- groups:
- - jobs:
- - foo
- - example
- results:
- - unstable
- - jobs:
- - foo2
- results:
- - not-built
- - aborted
+ .. literalinclude::
+ /../../tests/triggers/fixtures/build-result-full.yaml
+ :language: yaml
+
+ Minimal Example:
+
+ .. literalinclude::
+ /../../tests/triggers/fixtures/build-result-minimal.yaml
+ :language: yaml
"""
brt = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.'
'buildresulttrigger.BuildResultTrigger')
+ brt.set('plugin', 'buildresult-trigger')
mapping = [
('cron', 'spec', ''),
('combine', 'combinedJobs', False),
diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py
index 4185fe01..d2b261ea 100644
--- a/jenkins_jobs/modules/wrappers.py
+++ b/jenkins_jobs/modules/wrappers.py
@@ -200,6 +200,9 @@ def config_file_provider(registry, xml_parent, data):
(default '')
* **variable** (`str`) -- Define an environment variable to be
used (default '')
+ * **replace-tokens** (`bool`) -- Replace tokens in config file.
+ For example "password: ${PYPI_JENKINS_PASS}" will be replaced
+ with the global variable configured in Jenkins.
Example:
diff --git a/jenkins_jobs/xml_config.py b/jenkins_jobs/xml_config.py
index 52c37f3c..c9aa7c0b 100644
--- a/jenkins_jobs/xml_config.py
+++ b/jenkins_jobs/xml_config.py
@@ -63,34 +63,43 @@ class XmlJob(object):
return out.toprettyxml(indent=' ', encoding='utf-8')
-class XmlJobGenerator(object):
- """ This class is responsible for generating Jenkins Configuration XML from
- a compatible intermediate representation of Jenkins Jobs.
+class XmlGenerator(object):
+ """A super-class to capture common XML generation logic.
+
+ Sub-classes should define three attribute: ``entry_point_group``,
+ ``kind_attribute`` and ``kind_default``. The value of ``kind_attribute``
+ in the given data dictionary (or ``kind_default`` if it isn't present)
+ will be used to filter the entry points in ``entry_point_group``; the
+ module so found will be used to generate the XML object.
"""
def __init__(self, registry):
self.registry = registry
- def generateXML(self, jobdict_list):
- xml_jobs = []
- for job in jobdict_list:
- xml_jobs.append(self._getXMLForJob(job))
- return xml_jobs
+ def generateXML(self, data_list):
+ xml_objs = []
+ for data in data_list:
+ xml_objs.append(self._getXMLForData(data))
+ return xml_objs
- def _getXMLForJob(self, data):
- kind = data.get('project-type', 'freestyle')
+ def _getXMLForData(self, data):
+ kind = data.get(self.kind_attribute, self.kind_default)
for ep in pkg_resources.iter_entry_points(
- group='jenkins_jobs.projects', name=kind):
+ group=self.entry_point_group, name=kind):
Mod = ep.load()
mod = Mod(self.registry)
xml = mod.root_xml(data)
self._gen_xml(xml, data)
- job = XmlJob(xml, data['name'])
- return job
+ obj = XmlJob(xml, data['name'])
+ return obj
- raise errors.JenkinsJobsException("Unrecognized project type: '%s'"
- % kind)
+ names = [
+ ep.name for ep in pkg_resources.iter_entry_points(
+ group=self.entry_point_group)]
+ raise errors.JenkinsJobsException(
+ 'Unrecognized {}: {} (supported types are: {})'.format(
+ self.kind_attribute, kind, ', '.join(names)))
def _gen_xml(self, xml, data):
for module in self.registry.modules:
@@ -98,39 +107,19 @@ class XmlJobGenerator(object):
module.gen_xml(xml, data)
-class XmlViewGenerator(object):
+class XmlJobGenerator(XmlGenerator):
""" This class is responsible for generating Jenkins Configuration XML from
- a compatible intermediate representation of Jenkins Views.
+ a compatible intermediate representation of Jenkins Jobs.
"""
+ entry_point_group = 'jenkins_jobs.projects'
+ kind_attribute = 'project-type'
+ kind_default = 'freestyle'
- def __init__(self, registry):
- self.registry = registry
-
- def generateXML(self, viewdict_list):
- xml_views = []
- for view in viewdict_list:
- xml_views.append(self._getXMLForView(view))
- return xml_views
-
- def _getXMLForView(self, data):
- kind = data.get('view-type', 'list')
- for ep in pkg_resources.iter_entry_points(
- group='jenkins_jobs.views', name=kind):
- Mod = ep.load()
- mod = Mod(self.registry)
- xml = mod.root_xml(data)
- self._gen_xml(xml, data)
- view = XmlJob(xml, data['name'])
- return view
- names = [
- ep.name for ep in pkg_resources.iter_entry_points(
- group='jenkins_jobs.views')]
- raise errors.JenkinsJobsException(
- 'Unrecognized view type: {} (supported types are: {})'.format(
- kind, ', '.join(names)))
-
- def _gen_xml(self, xml, data):
- for module in self.registry.modules:
- if hasattr(module, 'gen_xml'):
- module.gen_xml(xml, data)
+class XmlViewGenerator(XmlGenerator):
+ """ This class is responsible for generating Jenkins Configuration XML from
+ a compatible intermediate representation of Jenkins Views.
+ """
+ entry_point_group = 'jenkins_jobs.views'
+ kind_attribute = 'view-type'
+ kind_default = 'list'
diff --git a/requirements.txt b/requirements.txt
index 2b009652..b7a0ae27 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
six>=1.9.0 # MIT
-PyYAML>=3.10.0 # MIT
+PyYAML>=3.10.0,<4 # MIT
pbr>=1.8 # Apache-2.0
stevedore>=1.17.1 # Apache-2.0
python-jenkins>=0.4.15
diff --git a/tests/base.py b/tests/base.py
index 855f2e75..740e2239 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -246,7 +246,7 @@ class SingleJobTestCase(BaseScenariosTestCase):
def test_yaml_snippet(self):
config = self._get_config()
- expected_xml = self._read_utf8_content()
+ expected_xml = self._read_utf8_content().strip()
parser = YamlParser(config)
parser.parse(self.in_filename)
@@ -290,7 +290,7 @@ class SingleJobTestCase(BaseScenariosTestCase):
# Prettify generated XML
pretty_xml = u"\n".join(job.output().decode('utf-8')
- for job in xml_jobs)
+ for job in xml_jobs).strip()
self.assertThat(
pretty_xml,
diff --git a/tests/builders/fixtures/config-file-provider01.xml b/tests/builders/fixtures/config-file-provider01.xml
index 3d1b3a92..9e8ecad1 100644
--- a/tests/builders/fixtures/config-file-provider01.xml
+++ b/tests/builders/fixtures/config-file-provider01.xml
@@ -7,6 +7,7 @@
<fileId>org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012</fileId>
<targetLocation>target</targetLocation>
<variable>variable</variable>
+ <replaceTokens>true</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
diff --git a/tests/builders/fixtures/config-file-provider01.yaml b/tests/builders/fixtures/config-file-provider01.yaml
index 4166e9c0..aa404270 100644
--- a/tests/builders/fixtures/config-file-provider01.yaml
+++ b/tests/builders/fixtures/config-file-provider01.yaml
@@ -4,3 +4,4 @@ builders:
- file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
target: target
variable: variable
+ replace-tokens: true
diff --git a/tests/builders/fixtures/xunit-full.xml b/tests/builders/fixtures/xunit-full.xml
new file mode 100644
index 00000000..d56ca025
--- /dev/null
+++ b/tests/builders/fixtures/xunit-full.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <builders>
+ <org.jenkinsci.plugins.xunit.XUnitBuilder plugin="xunit">
+ <types>
+ <PHPUnitJunitHudsonTestType>
+ <pattern>phpunit.log</pattern>
+ <failIfNotNew>true</failIfNotNew>
+ <deleteOutputFiles>true</deleteOutputFiles>
+ <skipNoTestFiles>false</skipNoTestFiles>
+ <stopProcessingIfError>true</stopProcessingIfError>
+ </PHPUnitJunitHudsonTestType>
+ <CppUnitJunitHudsonTestType>
+ <pattern>cppunit.log</pattern>
+ <failIfNotNew>false</failIfNotNew>
+ <deleteOutputFiles>false</deleteOutputFiles>
+ <skipNoTestFiles>true</skipNoTestFiles>
+ <stopProcessingIfError>false</stopProcessingIfError>
+ </CppUnitJunitHudsonTestType>
+ <GoogleTestType>
+ <pattern>gtest.log</pattern>
+ <failIfNotNew>true</failIfNotNew>
+ <deleteOutputFiles>true</deleteOutputFiles>
+ <skipNoTestFiles>false</skipNoTestFiles>
+ <stopProcessingIfError>true</stopProcessingIfError>
+ </GoogleTestType>
+ </types>
+ <thresholds>
+ <org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
+ <unstableThreshold>0</unstableThreshold>
+ <unstableNewThreshold>0</unstableNewThreshold>
+ <failureThreshold>0</failureThreshold>
+ <failureNewThreshold>0</failureNewThreshold>
+ </org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
+ <org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
+ <unstableThreshold>0</unstableThreshold>
+ <unstableNewThreshold>0</unstableNewThreshold>
+ <failureThreshold>0</failureThreshold>
+ <failureNewThreshold>0</failureNewThreshold>
+ </org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
+ </thresholds>
+ <thresholdMode>2</thresholdMode>
+ <extraConfiguration>
+ <testTimeMargin>5000</testTimeMargin>
+ </extraConfiguration>
+ </org.jenkinsci.plugins.xunit.XUnitBuilder>
+ </builders>
+</project>
diff --git a/tests/builders/fixtures/xunit-full.yaml b/tests/builders/fixtures/xunit-full.yaml
new file mode 100644
index 00000000..6f95e23b
--- /dev/null
+++ b/tests/builders/fixtures/xunit-full.yaml
@@ -0,0 +1,30 @@
+builders:
+ - xunit:
+ thresholdmode: 'percent'
+ thresholds:
+ - failed:
+ unstable: 0
+ unstablenew: 0
+ failure: 0
+ failurenew: 0
+ - skipped:
+ unstable: 0
+ unstablenew: 0
+ failure: 0
+ failurenew: 0
+ test-time-margin: 5000
+ types:
+ - phpunit:
+ pattern: "phpunit.log"
+ requireupdate: true
+ deleteoutput: true
+ skip-if-no-test-files: false
+ stoponerror: true
+ - cppunit:
+ pattern: "cppunit.log"
+ requireupdate: false
+ deleteoutput: false
+ skip-if-no-test-files: true
+ stoponerror: false
+ - gtest:
+ pattern: "gtest.log"
diff --git a/tests/builders/fixtures/xunit-minimal.xml b/tests/builders/fixtures/xunit-minimal.xml
new file mode 100644
index 00000000..e479dbfb
--- /dev/null
+++ b/tests/builders/fixtures/xunit-minimal.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <builders>
+ <org.jenkinsci.plugins.xunit.XUnitBuilder plugin="xunit">
+ <types>
+ <JUnitType>
+ <pattern>junit.xml</pattern>
+ <failIfNotNew>true</failIfNotNew>
+ <deleteOutputFiles>true</deleteOutputFiles>
+ <skipNoTestFiles>false</skipNoTestFiles>
+ <stopProcessingIfError>true</stopProcessingIfError>
+ </JUnitType>
+ </types>
+ <thresholds/>
+ <thresholdMode>1</thresholdMode>
+ <extraConfiguration>
+ <testTimeMargin>3000</testTimeMargin>
+ </extraConfiguration>
+ </org.jenkinsci.plugins.xunit.XUnitBuilder>
+ </builders>
+</project>
diff --git a/tests/builders/fixtures/xunit-minimal.yaml b/tests/builders/fixtures/xunit-minimal.yaml
new file mode 100644
index 00000000..01c4f964
--- /dev/null
+++ b/tests/builders/fixtures/xunit-minimal.yaml
@@ -0,0 +1,5 @@
+builders:
+ - xunit:
+ types:
+ - junit:
+ pattern: "junit.xml"
diff --git a/tests/hipchat/fixtures/hipchat001.conf b/tests/hipchat/fixtures/hipchat001.conf
index 93ee35f6..9cae12f7 100644..120000
--- a/tests/hipchat/fixtures/hipchat001.conf
+++ b/tests/hipchat/fixtures/hipchat001.conf
@@ -1,5 +1 @@
-[hipchat]
-authtoken=blue
-send-as=Jenkins
-[jenkins]
-url=green
+hipchat004.conf \ No newline at end of file
diff --git a/tests/hipchat/fixtures/hipchat001.plugins_info.yaml b/tests/hipchat/fixtures/hipchat001.plugins_info.yaml
index 1d6fb048..c7d0f5dd 100644
--- a/tests/hipchat/fixtures/hipchat001.plugins_info.yaml
+++ b/tests/hipchat/fixtures/hipchat001.plugins_info.yaml
@@ -1,6 +1,6 @@
- longName: 'Jenkins HipChat Plugin'
shortName: 'hipchat'
- version: "0.1.5"
+ version: "0.1.8"
- longName: 'Derp HipChat Plugin'
shortName: 'hipchat'
version: "0.1.0"
diff --git a/tests/hipchat/fixtures/hipchat001.xml b/tests/hipchat/fixtures/hipchat001.xml
index 0c06d33f..947f4626 100644
--- a/tests/hipchat/fixtures/hipchat001.xml
+++ b/tests/hipchat/fixtures/hipchat001.xml
@@ -2,7 +2,7 @@
<project>
<properties>
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
- <room>My Room</room>
+ <room>My Room,Your Room</room>
<startNotification>true</startNotification>
<notifySuccess>true</notifySuccess>
<notifyAborted>true</notifyAborted>
@@ -14,8 +14,9 @@
</properties>
<publishers>
<jenkins.plugins.hipchat.HipChatNotifier>
- <jenkinsUrl>green</jenkinsUrl>
- <authToken>blue</authToken>
+ <buildServerUrl>http://localhost:8080/</buildServerUrl>
+ <sendAs>Jenkins</sendAs>
+ <authToken>dummy</authToken>
<room/>
</jenkins.plugins.hipchat.HipChatNotifier>
</publishers>
diff --git a/tests/hipchat/fixtures/hipchat001.yaml b/tests/hipchat/fixtures/hipchat001.yaml
index a781a458..d8185ef2 100644
--- a/tests/hipchat/fixtures/hipchat001.yaml
+++ b/tests/hipchat/fixtures/hipchat001.yaml
@@ -1,6 +1,8 @@
hipchat:
enabled: true
- room: My Room
+ rooms:
+ - My Room
+ - Your Room
notify-start: true
notify-success: true
notify-aborted: true
diff --git a/tests/hipchat/fixtures/hipchat_room001.conf b/tests/hipchat/fixtures/hipchat_room001.conf
new file mode 100644
index 00000000..93ee35f6
--- /dev/null
+++ b/tests/hipchat/fixtures/hipchat_room001.conf
@@ -0,0 +1,5 @@
+[hipchat]
+authtoken=blue
+send-as=Jenkins
+[jenkins]
+url=green
diff --git a/tests/hipchat/fixtures/hipchat_rooms-list001.plugins_info.yaml b/tests/hipchat/fixtures/hipchat_room001.plugins_info.yaml
index c7d0f5dd..1d6fb048 100644
--- a/tests/hipchat/fixtures/hipchat_rooms-list001.plugins_info.yaml
+++ b/tests/hipchat/fixtures/hipchat_room001.plugins_info.yaml
@@ -1,6 +1,6 @@
- longName: 'Jenkins HipChat Plugin'
shortName: 'hipchat'
- version: "0.1.8"
+ version: "0.1.5"
- longName: 'Derp HipChat Plugin'
shortName: 'hipchat'
version: "0.1.0"
diff --git a/tests/hipchat/fixtures/hipchat_rooms-list001.xml b/tests/hipchat/fixtures/hipchat_room001.xml
index 947f4626..0c06d33f 100644
--- a/tests/hipchat/fixtures/hipchat_rooms-list001.xml
+++ b/tests/hipchat/fixtures/hipchat_room001.xml
@@ -2,7 +2,7 @@
<project>
<properties>
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
- <room>My Room,Your Room</room>
+ <room>My Room</room>
<startNotification>true</startNotification>
<notifySuccess>true</notifySuccess>
<notifyAborted>true</notifyAborted>
@@ -14,9 +14,8 @@
</properties>
<publishers>
<jenkins.plugins.hipchat.HipChatNotifier>
- <buildServerUrl>http://localhost:8080/</buildServerUrl>
- <sendAs>Jenkins</sendAs>
- <authToken>dummy</authToken>
+ <jenkinsUrl>green</jenkinsUrl>
+ <authToken>blue</authToken>
<room/>
</jenkins.plugins.hipchat.HipChatNotifier>
</publishers>
diff --git a/tests/hipchat/fixtures/hipchat_rooms-list001.yaml b/tests/hipchat/fixtures/hipchat_room001.yaml
index 47d23cba..47ce7c82 100644
--- a/tests/hipchat/fixtures/hipchat_rooms-list001.yaml
+++ b/tests/hipchat/fixtures/hipchat_room001.yaml
@@ -1,9 +1,7 @@
hipchat:
enabled: true
- rooms:
- - My Room
- - Your Room
- start-notify: true
+ room: My Room # Cover the deprecated room parameter
+ start-notify: true # Cover the deprecated start-notify parameter
notify-success: true
notify-aborted: true
notify-not-built: true
diff --git a/tests/hipchat/fixtures/hipchat_rooms-list001.conf b/tests/hipchat/fixtures/hipchat_rooms-list001.conf
deleted file mode 120000
index 9cae12f7..00000000
--- a/tests/hipchat/fixtures/hipchat_rooms-list001.conf
+++ /dev/null
@@ -1 +0,0 @@
-hipchat004.conf \ No newline at end of file
diff --git a/tests/multibranch/fixtures/multi_scm_full.xml b/tests/multibranch/fixtures/multi_scm_full.xml
index c54a4c5e..a2dfb18f 100644
--- a/tests/multibranch/fixtures/multi_scm_full.xml
+++ b/tests/multibranch/fixtures/multi_scm_full.xml
@@ -79,6 +79,6 @@
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
- <scriptPath>Jenkinsfile</scriptPath>
+ <scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
diff --git a/tests/multibranch/fixtures/multi_scm_full.yaml b/tests/multibranch/fixtures/multi_scm_full.yaml
index f7739c4f..f9978c32 100644
--- a/tests/multibranch/fixtures/multi_scm_full.yaml
+++ b/tests/multibranch/fixtures/multi_scm_full.yaml
@@ -7,6 +7,7 @@ periodic-folder-trigger: 1d
prune-dead-branches: True
number-to-keep: '10'
days-to-keep: '10'
+script-path: 'some.Jenkinsfile'
scm:
- bitbucket:
repo-owner: 'SANDBOX'
diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml
index 9a4b78a9..b59e64ae 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_full.xml
+++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml
@@ -36,8 +36,18 @@
<repoOwner>SANDBOX</repoOwner>
<repository>test</repository>
<credentialsId>secret</credentialsId>
+ <serverUrl>https://bitbucket.example.com:8080</serverUrl>
<traits>
<com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait/>
+ <jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
+ <regex>master|\d+\.\d+</regex>
+ </jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
+ <com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
+ <strategyId>2</strategyId>
+ </com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
+ <com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
+ <strategyId>3</strategyId>
+ </com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
</traits>
</source>
</jenkins.branch.BranchSource>
@@ -46,6 +56,6 @@
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
- <scriptPath>Jenkinsfile</scriptPath>
+ <scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.yaml b/tests/multibranch/fixtures/scm_bitbucket_full.yaml
index 50138255..effee2c9 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_full.yaml
+++ b/tests/multibranch/fixtures/scm_bitbucket_full.yaml
@@ -1,8 +1,14 @@
name: 'demo-multibranch-bitbucket-min'
project-type: multibranch
+script-path: 'some.Jenkinsfile'
scm:
- bitbucket:
credentials-id: 'secret'
repo-owner: 'SANDBOX'
repo: 'test'
+ server-url: https://bitbucket.example.com:8080
discover-tags: true
+ head-filter-regex: 'master|\d+\.\d+'
+ discover-pr-origin: headOnly
+ discover-branch: all
+
diff --git a/tests/multibranch/fixtures/scm_gerrit_full.xml b/tests/multibranch/fixtures/scm_gerrit_full.xml
index e14588ae..92124e3f 100644
--- a/tests/multibranch/fixtures/scm_gerrit_full.xml
+++ b/tests/multibranch/fixtures/scm_gerrit_full.xml
@@ -55,6 +55,6 @@
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
- <scriptPath>Jenkinsfile</scriptPath>
+ <scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
diff --git a/tests/multibranch/fixtures/scm_gerrit_full.yaml b/tests/multibranch/fixtures/scm_gerrit_full.yaml
index 373bffca..6c6c6071 100644
--- a/tests/multibranch/fixtures/scm_gerrit_full.yaml
+++ b/tests/multibranch/fixtures/scm_gerrit_full.yaml
@@ -1,5 +1,6 @@
name: 'demo-multibranch-gerrit-min'
project-type: multibranch
+script-path: some.Jenkinsfile
scm:
- gerrit:
url: 'https://review.gerrithub.io/johndoe/foo'
diff --git a/tests/multibranch/fixtures/scm_git_full.xml b/tests/multibranch/fixtures/scm_git_full.xml
index 0a125a10..d7096791 100644
--- a/tests/multibranch/fixtures/scm_git_full.xml
+++ b/tests/multibranch/fixtures/scm_git_full.xml
@@ -46,6 +46,6 @@
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
- <scriptPath>Jenkinsfile</scriptPath>
+ <scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
diff --git a/tests/multibranch/fixtures/scm_git_full.yaml b/tests/multibranch/fixtures/scm_git_full.yaml
index 13735c96..01e52f42 100644
--- a/tests/multibranch/fixtures/scm_git_full.yaml
+++ b/tests/multibranch/fixtures/scm_git_full.yaml
@@ -1,5 +1,6 @@
name: 'demo-multibranch-git-min'
project-type: multibranch
+script-path: some.Jenkinsfile
scm:
- git:
url: 'https://example.com/jonhndoe/keep-frontend.git'
diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml
index 67296737..389c1b55 100644
--- a/tests/multibranch/fixtures/scm_github_full.xml
+++ b/tests/multibranch/fixtures/scm_github_full.xml
@@ -57,6 +57,6 @@
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
- <scriptPath>Jenkinsfile</scriptPath>
+ <scriptPath>some.Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml
index c35ca97c..197c0dfc 100644
--- a/tests/multibranch/fixtures/scm_github_full.yaml
+++ b/tests/multibranch/fixtures/scm_github_full.yaml
@@ -1,5 +1,6 @@
name: scm-github-full
project-type: multibranch
+script-path: some.Jenkinsfile
scm:
- github:
api-uri: http://example.org/github
diff --git a/tests/parameters/fixtures/extended-choice-param-full.xml b/tests/parameters/fixtures/extended-choice-param-full.xml
index 7de58f63..eae56edc 100644
--- a/tests/parameters/fixtures/extended-choice-param-full.xml
+++ b/tests/parameters/fixtures/extended-choice-param-full.xml
@@ -20,6 +20,7 @@
<descriptionPropertyFile/>
<descriptionPropertyKey/>
<groovyScript/>
+ <groovyScriptFile/>
<groovyClasspath/>
<defaultGroovyScript/>
<defaultGroovyClasspath/>
@@ -43,6 +44,7 @@
<descriptionPropertyFile/>
<descriptionPropertyKey/>
<groovyScript/>
+ <groovyScriptFile/>
<groovyClasspath/>
<defaultGroovyScript/>
<defaultGroovyClasspath/>
@@ -66,6 +68,7 @@
<descriptionPropertyFile/>
<descriptionPropertyKey/>
<groovyScript/>
+ <groovyScriptFile/>
<groovyClasspath/>
<defaultGroovyScript/>
<defaultGroovyClasspath/>
diff --git a/tests/parameters/fixtures/extended-choice-param-minimal-groovy.xml b/tests/parameters/fixtures/extended-choice-param-minimal-groovy.xml
index 96b5157a..62719288 100644
--- a/tests/parameters/fixtures/extended-choice-param-minimal-groovy.xml
+++ b/tests/parameters/fixtures/extended-choice-param-minimal-groovy.xml
@@ -20,6 +20,7 @@
<descriptionPropertyFile/>
<descriptionPropertyKey/>
<groovyScript>return 'value1, value2, value3'</groovyScript>
+ <groovyScriptFile/>
<groovyClasspath/>
<defaultGroovyScript/>
<defaultGroovyClasspath/>
diff --git a/tests/parameters/fixtures/extended-choice-param-minimal.xml b/tests/parameters/fixtures/extended-choice-param-minimal.xml
index dca2aaf5..294f3973 100644
--- a/tests/parameters/fixtures/extended-choice-param-minimal.xml
+++ b/tests/parameters/fixtures/extended-choice-param-minimal.xml
@@ -20,6 +20,7 @@
<descriptionPropertyFile/>
<descriptionPropertyKey/>
<groovyScript/>
+ <groovyScriptFile/>
<groovyClasspath/>
<defaultGroovyScript/>
<defaultGroovyClasspath/>
diff --git a/tests/parameters/fixtures/node-label001.xml b/tests/parameters/fixtures/node-label001.xml
new file mode 100644
index 00000000..9157ccc6
--- /dev/null
+++ b/tests/parameters/fixtures/node-label001.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ <name>EXAMPLE LABEL 1</name>
+ <description>EXAMPLE LABEL DESCRIPTION 1</description>
+ <defaultValue/>
+ <allNodesMatchingLabel>true</allNodesMatchingLabel>
+ <triggerIfResult>success</triggerIfResult>
+ <nodeEligibility class="org.jvnet.jenkins.plugins.nodelabelparameter.node.AllNodeEligibility"/>
+ </org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+</project>
diff --git a/tests/parameters/fixtures/node-label001.yaml b/tests/parameters/fixtures/node-label001.yaml
new file mode 100644
index 00000000..3028d1a4
--- /dev/null
+++ b/tests/parameters/fixtures/node-label001.yaml
@@ -0,0 +1,6 @@
+parameters:
+ - label:
+ name: EXAMPLE LABEL 1
+ description: "EXAMPLE LABEL DESCRIPTION 1"
+ matching-label: "success"
+ node-eligibility: "all" \ No newline at end of file
diff --git a/tests/parameters/fixtures/node-label002.xml b/tests/parameters/fixtures/node-label002.xml
new file mode 100644
index 00000000..4416dc8e
--- /dev/null
+++ b/tests/parameters/fixtures/node-label002.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ <name>EXAMPLE LABEL 2</name>
+ <description>EXAMPLE LABEL DESCRIPTION 2</description>
+ <defaultValue/>
+ <allNodesMatchingLabel>true</allNodesMatchingLabel>
+ <triggerIfResult>unstable</triggerIfResult>
+ <nodeEligibility class="org.jvnet.jenkins.plugins.nodelabelparameter.node.IgnoreOfflineNodeEligibility"/>
+ </org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+</project>
diff --git a/tests/parameters/fixtures/node-label002.yaml b/tests/parameters/fixtures/node-label002.yaml
new file mode 100644
index 00000000..4b61f8f3
--- /dev/null
+++ b/tests/parameters/fixtures/node-label002.yaml
@@ -0,0 +1,6 @@
+parameters:
+ - label:
+ name: EXAMPLE LABEL 2
+ description: "EXAMPLE LABEL DESCRIPTION 2"
+ matching-label: "unstable"
+ node-eligibility: "ignore-offline" \ No newline at end of file
diff --git a/tests/parameters/fixtures/node-label003.xml b/tests/parameters/fixtures/node-label003.xml
new file mode 100644
index 00000000..9a2b493d
--- /dev/null
+++ b/tests/parameters/fixtures/node-label003.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ <name>EXAMPLE LABEL 3</name>
+ <description>EXAMPLE LABEL DESCRIPTION 3</description>
+ <defaultValue/>
+ <allNodesMatchingLabel>true</allNodesMatchingLabel>
+ <triggerIfResult>allCases</triggerIfResult>
+ <nodeEligibility class="org.jvnet.jenkins.plugins.nodelabelparameter.node.IgnoreTempOfflineNodeEligibility"/>
+ </org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+</project>
diff --git a/tests/parameters/fixtures/node-label003.yaml b/tests/parameters/fixtures/node-label003.yaml
new file mode 100644
index 00000000..93d6f4c9
--- /dev/null
+++ b/tests/parameters/fixtures/node-label003.yaml
@@ -0,0 +1,6 @@
+parameters:
+ - label:
+ name: EXAMPLE LABEL 3
+ description: "EXAMPLE LABEL DESCRIPTION 3"
+ matching-label: "allCases"
+ node-eligibility: "ignore-temp-offline" \ No newline at end of file
diff --git a/tests/parameters/fixtures/node-label004.xml b/tests/parameters/fixtures/node-label004.xml
new file mode 100644
index 00000000..788e2742
--- /dev/null
+++ b/tests/parameters/fixtures/node-label004.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ <name>EXAMPLE LABEL 4</name>
+ <description>EXAMPLE LABEL DESCRIPTION 4</description>
+ <defaultValue/>
+ <allNodesMatchingLabel>true</allNodesMatchingLabel>
+ <triggerIfResult>allCases</triggerIfResult>
+ <nodeEligibility class="org.jvnet.jenkins.plugins.nodelabelparameter.node.AllNodeEligibility"/>
+ </org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+</project>
diff --git a/tests/parameters/fixtures/node-label004.yaml b/tests/parameters/fixtures/node-label004.yaml
new file mode 100644
index 00000000..f6610b66
--- /dev/null
+++ b/tests/parameters/fixtures/node-label004.yaml
@@ -0,0 +1,4 @@
+parameters:
+ - label:
+ name: EXAMPLE LABEL 4
+ description: "EXAMPLE LABEL DESCRIPTION 4"
diff --git a/tests/properties/fixtures/priority_sorter002.plugins_info.yaml b/tests/properties/fixtures/priority_sorter002.plugins_info.yaml
index d4045458..ce2e9d93 100644
--- a/tests/properties/fixtures/priority_sorter002.plugins_info.yaml
+++ b/tests/properties/fixtures/priority_sorter002.plugins_info.yaml
@@ -1,3 +1,3 @@
-- longName: 'Priority Sorter Plugin'
+- longName: 'Jenkins Priority Sorter Plugin'
shortName: 'PrioritySorter'
version: '2.0'
diff --git a/tests/publishers/fixtures/gitlab-message-full.xml b/tests/publishers/fixtures/gitlab-message-full.xml
new file mode 100644
index 00000000..c6ca51fe
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-message-full.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <publishers>
+ <com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher plugin="gitlab-plugin">
+ <onlyForFailure>true</onlyForFailure>
+ <replaceSuccessNote>true</replaceSuccessNote>
+ <replaceFailureNote>true</replaceFailureNote>
+ <replaceAbortNote>true</replaceAbortNote>
+ <replaceUnstableNote>true</replaceUnstableNote>
+ <successNoteText>SUCCESS</successNoteText>
+ <failureNoteText>Build was failed. See log on Jenkins</failureNoteText>
+ <abortNoteText>Build was aborted</abortNoteText>
+ <unstableNoteText>The build is unstable</unstableNoteText>
+ </com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher>
+ </publishers>
+</project>
diff --git a/tests/publishers/fixtures/gitlab-message-full.yaml b/tests/publishers/fixtures/gitlab-message-full.yaml
new file mode 100644
index 00000000..14dbc469
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-message-full.yaml
@@ -0,0 +1,11 @@
+publishers:
+ - gitlab-message:
+ failure-only: true
+ success-note: true
+ success-note-text: "SUCCESS"
+ failure-note: true
+ failure-note-text: "Build was failed. See log on Jenkins"
+ abort-note: true
+ abort-note-text: "Build was aborted"
+ unstable-note: true
+ unstable-note-text: "The build is unstable"
diff --git a/tests/publishers/fixtures/gitlab-message-minimal.xml b/tests/publishers/fixtures/gitlab-message-minimal.xml
new file mode 100644
index 00000000..d2f5b2ea
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-message-minimal.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <publishers>
+ <com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher plugin="gitlab-plugin">
+ <onlyForFailure>false</onlyForFailure>
+ <replaceSuccessNote>false</replaceSuccessNote>
+ <replaceFailureNote>false</replaceFailureNote>
+ <replaceAbortNote>false</replaceAbortNote>
+ <replaceUnstableNote>false</replaceUnstableNote>
+ <successNoteText/>
+ <failureNoteText/>
+ <abortNoteText/>
+ <unstableNoteText/>
+ </com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher>
+ </publishers>
+</project>
diff --git a/tests/publishers/fixtures/gitlab-message-minimal.yaml b/tests/publishers/fixtures/gitlab-message-minimal.yaml
new file mode 100644
index 00000000..46f49c8f
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-message-minimal.yaml
@@ -0,0 +1,2 @@
+publishers:
+ - gitlab-message
diff --git a/tests/publishers/fixtures/gitlab-vote.xml b/tests/publishers/fixtures/gitlab-vote.xml
new file mode 100644
index 00000000..4798dec0
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-vote.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <publishers>
+ <com.dabsquared.gitlabjenkins.publisher.GitLabVotePublisher/>
+ </publishers>
+</project>
diff --git a/tests/publishers/fixtures/gitlab-vote.yaml b/tests/publishers/fixtures/gitlab-vote.yaml
new file mode 100644
index 00000000..ba03ef9b
--- /dev/null
+++ b/tests/publishers/fixtures/gitlab-vote.yaml
@@ -0,0 +1,2 @@
+publishers:
+ - gitlab-vote
diff --git a/tests/scm/fixtures/accurev001.xml b/tests/scm/fixtures/accurev001.xml
new file mode 100644
index 00000000..296b7307
--- /dev/null
+++ b/tests/scm/fixtures/accurev001.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <scm class="hudson.plugins.accurev.AccurevSCM">
+ <depot>Test depot</depot>
+ <stream>Test stream</stream>
+ <serverName>Test server name</serverName>
+ <ignoreStreamParent>true</ignoreStreamParent>
+ <cleanreftree>true</cleanreftree>
+ <useSnapshot>true</useSnapshot>
+ <dontPopContent>true</dontPopContent>
+ <workspace>Test workspace</workspace>
+ <reftree>Test reference tree</reftree>
+ <directoryOffset>Test directory offset</directoryOffset>
+ <subPath>Test sub path</subPath>
+ <filterForPollSCM>Test filter</filterForPollSCM>
+ <snapshotNameFormat>Test snapshot name format</snapshotNameFormat>
+ </scm>
+</project>
diff --git a/tests/scm/fixtures/accurev001.yaml b/tests/scm/fixtures/accurev001.yaml
new file mode 100644
index 00000000..25413933
--- /dev/null
+++ b/tests/scm/fixtures/accurev001.yaml
@@ -0,0 +1,15 @@
+scm:
+ - accurev:
+ depot: Test depot
+ stream: Test stream
+ server-name: Test server name
+ ignore-parent-changes: true
+ clean-reference-tree: true
+ build-from-snapshot: true
+ do-not-pop-content: true
+ workspace: Test workspace
+ reference-tree: Test reference tree
+ directory-offset: Test directory offset
+ sub-path: Test sub path
+ filter-poll-scm: Test filter
+ snapshot-name-format: Test snapshot name format
diff --git a/tests/triggers/fixtures/build-result-full.xml b/tests/triggers/fixtures/build-result-full.xml
new file mode 100644
index 00000000..e904a070
--- /dev/null
+++ b/tests/triggers/fixtures/build-result-full.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <triggers class="vector">
+ <org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger plugin="buildresult-trigger">
+ <spec>H/15 * * * *</spec>
+ <combinedJobs>true</combinedJobs>
+ <jobsInfo>
+ <org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ <jobNames>t,e,s,t,,, ,t,e,s,t,2</jobNames>
+ <checkedResults>
+ <org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ <checked>SUCCESS</checked>
+ </org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ <org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ <checked>NOT_BUILT</checked>
+ </org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ </checkedResults>
+ </org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ <org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ <jobNames>t,e,s,t,3</jobNames>
+ <checkedResults>
+ <org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ <checked>UNSTABLE</checked>
+ </org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ </checkedResults>
+ </org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ </jobsInfo>
+ </org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger>
+ </triggers>
+</project>
diff --git a/tests/triggers/fixtures/build-result-full.yaml b/tests/triggers/fixtures/build-result-full.yaml
new file mode 100644
index 00000000..dc06bef4
--- /dev/null
+++ b/tests/triggers/fixtures/build-result-full.yaml
@@ -0,0 +1,12 @@
+triggers:
+ - build-result:
+ cron: H/15 * * * *
+ combine: true
+ groups:
+ - jobs: test, test2
+ results:
+ - success
+ - not-built
+ - jobs: test3
+ results:
+ - unstable
diff --git a/tests/triggers/fixtures/build-result-minimal.xml b/tests/triggers/fixtures/build-result-minimal.xml
new file mode 100644
index 00000000..4209b901
--- /dev/null
+++ b/tests/triggers/fixtures/build-result-minimal.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <triggers class="vector">
+ <org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger plugin="buildresult-trigger">
+ <spec/>
+ <combinedJobs>false</combinedJobs>
+ <jobsInfo>
+ <org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ <jobNames>t,e,s,t</jobNames>
+ <checkedResults>
+ <org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ <checked>ABORTED</checked>
+ </org.jenkinsci.plugins.buildresulttrigger.model.CheckedResult>
+ </checkedResults>
+ </org.jenkinsci.plugins.buildresulttrigger.model.BuildResultTriggerInfo>
+ </jobsInfo>
+ </org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger>
+ </triggers>
+</project>
diff --git a/tests/triggers/fixtures/build-result-minimal.yaml b/tests/triggers/fixtures/build-result-minimal.yaml
new file mode 100644
index 00000000..1f6ebd00
--- /dev/null
+++ b/tests/triggers/fixtures/build-result-minimal.yaml
@@ -0,0 +1,6 @@
+triggers:
+ - build-result:
+ groups:
+ - jobs: test
+ results:
+ - aborted
diff --git a/tests/wrappers/fixtures/config-file-provider001.xml b/tests/wrappers/fixtures/config-file-provider001.xml
index b0cb6726..09d77291 100644
--- a/tests/wrappers/fixtures/config-file-provider001.xml
+++ b/tests/wrappers/fixtures/config-file-provider001.xml
@@ -7,6 +7,7 @@
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722</fileId>
<targetLocation>tmp/bar.txt</targetLocation>
<variable>varname</variable>
+ <replaceTokens>true</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
diff --git a/tests/wrappers/fixtures/config-file-provider001.yaml b/tests/wrappers/fixtures/config-file-provider001.yaml
index d8da6bf3..f02c3142 100644
--- a/tests/wrappers/fixtures/config-file-provider001.yaml
+++ b/tests/wrappers/fixtures/config-file-provider001.yaml
@@ -4,3 +4,4 @@ wrappers:
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722
target: tmp/bar.txt
variable: varname
+ replace-tokens: true
diff --git a/tests/wrappers/fixtures/config-file-provider002.xml b/tests/wrappers/fixtures/config-file-provider002.xml
index cfbf86b7..d10b964a 100644
--- a/tests/wrappers/fixtures/config-file-provider002.xml
+++ b/tests/wrappers/fixtures/config-file-provider002.xml
@@ -7,6 +7,7 @@
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1234</fileId>
<targetLocation/>
<variable/>
+ <replaceTokens>false</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
diff --git a/tests/wrappers/fixtures/config-file-provider003.xml b/tests/wrappers/fixtures/config-file-provider003.xml
index ad265d78..d8f9a0a5 100644
--- a/tests/wrappers/fixtures/config-file-provider003.xml
+++ b/tests/wrappers/fixtures/config-file-provider003.xml
@@ -7,11 +7,13 @@
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1234</fileId>
<targetLocation/>
<variable/>
+ <replaceTokens>false</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig5678</fileId>
<targetLocation>/foo.txt</targetLocation>
<variable>varName</variable>
+ <replaceTokens>true</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
diff --git a/tests/wrappers/fixtures/config-file-provider003.yaml b/tests/wrappers/fixtures/config-file-provider003.yaml
index dba4d333..6f65ab56 100644
--- a/tests/wrappers/fixtures/config-file-provider003.yaml
+++ b/tests/wrappers/fixtures/config-file-provider003.yaml
@@ -5,3 +5,4 @@ wrappers:
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig5678
target: /foo.txt
variable: varName
+ replace-tokens: true
diff --git a/tests/xml_config/test_xml_config.py b/tests/xml_config/test_xml_config.py
index d64890d0..76858db2 100644
--- a/tests/xml_config/test_xml_config.py
+++ b/tests/xml_config/test_xml_config.py
@@ -40,7 +40,7 @@ class TestXmlJobGeneratorExceptions(base.BaseTestCase):
xml_generator = xml_config.XmlJobGenerator(reg)
e = self.assertRaises(errors.JenkinsJobsException,
xml_generator.generateXML, job_data)
- self.assertIn("Unrecognized project type:", str(e))
+ self.assertIn("Unrecognized project-type:", str(e))
def test_invalid_view(self):
self.conf_filename = None
@@ -56,7 +56,7 @@ class TestXmlJobGeneratorExceptions(base.BaseTestCase):
xml_generator = xml_config.XmlViewGenerator(reg)
e = self.assertRaises(errors.JenkinsJobsException,
xml_generator.generateXML, view_data)
- self.assertIn("Unrecognized view type:", str(e))
+ self.assertIn("Unrecognized view-type:", str(e))
def test_incorrect_template_params(self):
self.conf_filename = None
diff --git a/tests/yamlparser/fixtures/folders001.xml b/tests/yamlparser/fixtures/folders001.xml
index 0570e10a..e5f89183 100644..120000
--- a/tests/yamlparser/fixtures/folders001.xml
+++ b/tests/yamlparser/fixtures/folders001.xml
@@ -1,15 +1 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project>
- <actions/>
- <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
- <keepDependencies>false</keepDependencies>
- <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
- <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
- <concurrentBuild>false</concurrentBuild>
- <canRoam>true</canRoam>
- <properties/>
- <scm class="hudson.scm.NullSCM"/>
- <builders/>
- <publishers/>
- <buildWrappers/>
-</project>
+folders/folders001.xml \ No newline at end of file
diff --git a/tests/yamlparser/fixtures/project_pipeline_template006.xml b/tests/yamlparser/fixtures/project_pipeline_template006.xml
new file mode 100644
index 00000000..6fdc6522
--- /dev/null
+++ b/tests/yamlparser/fixtures/project_pipeline_template006.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<flow-definition plugin="workflow-job">
+ <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps">
+ <script>stage('Build another job') {
+ build(job: &quot;hello&quot;)
+}
+</script>
+ <sandbox>false</sandbox>
+ </definition>
+ <actions/>
+ <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <canRoam>true</canRoam>
+ <properties/>
+ <scm class="hudson.scm.NullSCM"/>
+ <publishers/>
+ <buildWrappers/>
+</flow-definition>
diff --git a/tests/yamlparser/fixtures/project_pipeline_template006.yaml b/tests/yamlparser/fixtures/project_pipeline_template006.yaml
new file mode 100644
index 00000000..84d3b88b
--- /dev/null
+++ b/tests/yamlparser/fixtures/project_pipeline_template006.yaml
@@ -0,0 +1,18 @@
+- job-template:
+ name: '{name}-unit-tests'
+ project-type: pipeline
+ dsl: |
+ stage('Build another job') {{
+ build(job: "{isay}")
+ }}
+
+- job-group:
+ name: '{name}-tests'
+ jobs:
+ - '{name}-unit-tests':
+ isay: 'hello'
+
+- project:
+ name: project-name
+ jobs:
+ - '{name}-tests'
diff --git a/tools/test-commands.sh b/tools/test-commands.sh
new file mode 100755
index 00000000..f44c46b0
--- /dev/null
+++ b/tools/test-commands.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -exou pipefail
+
+VAL1=$(jenkins-jobs --version 2>&1) || exit 1
+VAL2=$(python -m jenkins_jobs --version 2>&1) || exit 2
+
+# we assure that both calling methods to get the same output
+[ "${VAL1}" == "${VAL2}" ] || exit 3
diff --git a/tox.ini b/tox.ini
index 3b72fc14..7631bcf3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,6 +18,8 @@ deps = -r{toxinidir}/test-requirements.txt
commands =
- find . -type f -name "*.pyc" -delete
- find . -type d -name "__pycache__" -delete
+ # test that we can call jjb using both variants with same results
+ bash {toxinidir}/tools/test-commands.sh
stestr run --slowest {posargs}
whitelist_externals =
bash