diff options
45 files changed, 317 insertions, 60 deletions
@@ -1,4 +1,4 @@ [gerrit] -host=review.openstack.org +host=review.opendev.org port=29418 -project=openstack-infra/jenkins-job-builder.git +project=jjb/jenkins-job-builder.git @@ -3,8 +3,8 @@ description: Tests compatibility with master branch of python-jenkins parent: tox-py27 required-projects: - - openstack/python-jenkins - - openstack-infra/jenkins-job-builder + - jjb/python-jenkins + - jjb/jenkins-job-builder voting: true - project: diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index 5d7bbe34..32c0c39b 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -181,7 +181,7 @@ class JenkinsManager(object): def is_managed(self, job_name): xml = self.jenkins.get_job_config(job_name) try: - out = XML.fromstring(xml) + out = XML.fromstring(xml.encode('utf-8')) description = out.find(".//description").text return description.endswith(MAGIC_MANAGE_STRING) except (TypeError, AttributeError): diff --git a/jenkins_jobs/config.py b/jenkins_jobs/config.py index 9a650101..2252392b 100644 --- a/jenkins_jobs/config.py +++ b/jenkins_jobs/config.py @@ -141,6 +141,9 @@ class JJBConfig(object): self._setup() self._handle_deprecated_hipchat_config() + if config_fp is not None: + config_fp.close() + def _init_defaults(self): """ Initialize default configuration values using DEFAULT_CONF """ @@ -360,18 +363,5 @@ class JJBConfig(object): return result def get_plugin_config(self, plugin, key, default=None): - value = self.get_module_config('plugin "{}"'.format(plugin), key, - default) - - # Backwards compatibility for users who have not switched to the new - # plugin configuration format in their config. This code should be - # removed in future versions of JJB after 2.0. - if value is default: - old_value = self.get_module_config(plugin, key, _NOTSET) - # only log warning if detected a plugin config setting. - if old_value is not _NOTSET: - value = old_value - logger.warning( - DEPRECATED_PLUGIN_CONFIG_SECTION_MESSAGE.format( - plugin=plugin)) - return value + return self.get_module_config('plugin "{}"'.format(plugin), key, + default) diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py index 207594f0..cfb27165 100644 --- a/jenkins_jobs/modules/project_multibranch.py +++ b/jenkins_jobs/modules/project_multibranch.py @@ -308,7 +308,7 @@ def bitbucket_scm(xml_parent, data): :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. + :arg str discover-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 @@ -796,6 +796,10 @@ def github_scm(xml_parent, data): discovered initially or a change from the previous revision has been detected. (optional) Refer to :func:`~build_strategies <build_strategies>`. + :arg str notification-context: Change the default GitHub check notification + context from "continuous-integration/jenkins/SUFFIX" to a custom text, + Requires the :jenkins-wiki:`Github Custom Notification Context SCM + Behaviour <Github+Custom+Notification+Context+SCM+Behaviour+Plugin>`. :arg dict property-strategies: Provides control over how to build a branch (like to disable SCM triggering or to override the pipeline durability) (optional) @@ -980,6 +984,14 @@ def github_scm(xml_parent, data): if data.get('build-strategies', None): build_strategies(xml_parent, data) + if data.get('notification-context', None): + rshf = XML.SubElement(traits, + 'org.jenkinsci.plugins.githubScmTraitNotificationContext.' + 'NotificationContextTrait') + XML.SubElement(rshf, 'contextLabel').text = data.get( + 'notification-context') + XML.SubElement(rshf, 'typeSuffix').text = 'true' + # handle the default git extensions like: # - clean # - shallow-clone @@ -1025,6 +1037,8 @@ def build_strategies(xml_parent, data): (optional, default false) * **regular-branches** (bool): Builds regular branches whenever a change is detected. (optional, default None) + * **skip-initial-build** (bool): Skip initial build on first branch + indexing. (optional, default None) * **named-branches** (list): Builds named branches whenever a change is detected. @@ -1079,6 +1093,12 @@ def build_strategies(xml_parent, data): 'plugin': 'basic-branch-build-strategies', }) + if bbs_list.get('skip-initial-build', False): + XML.SubElement(bbs, ''.join([basic_build_strategies, + '.SkipInitialBuildOnFirstBranchIndexing']), { + 'plugin': 'basic-branch-build-strategies', + }) + if 'change-request' in bbs_list: cr = bbs_list['change-request'] cr_elem = XML.SubElement(bbs, ''.join([basic_build_strategies, diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index 1898a051..2907ec4f 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -1227,6 +1227,41 @@ def disable_resume(registry, xml_parent, data): 'DisableResumeJobProperty') +def cachet_gating(registry, xml_parent, data): + """yaml: cachet-gating + The Cachet Gating Plugin provides a gating mechanism + based on the availability of resources. + + Requires the Jenkins: :jenkins-wiki:`Cachet Gate Plugin + <Cachet+Gate+Plugin>`. + + :arg bool required-resources: Confirm availability of listed + resources before building. Requires the list of resources to + also be defined. (default true) + :arg list resources: which resources to gate + + Example: + + .. literalinclude:: /../../tests/properties/fixtures/cachet-gating.yaml + :language: yaml + """ + cachet = XML.SubElement( + xml_parent, 'com.redhat.jenkins.plugins.cachet.CachetJobProperty') + cachet.set('plugin', 'cachet-gating') + + mapping = [ + ('required-resources', 'requiredResources', True), + ] + helpers.convert_mapping_to_xml( + cachet, data, mapping, fail_required=True) + + resources_data = data.get('resources', []) + if resources_data: + resources = XML.SubElement(cachet, 'resources') + for resource in resources_data: + XML.SubElement(resources, 'string').text = str(resource) + + class Properties(jenkins_jobs.modules.base.Base): sequence = 20 diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 8c348476..c165d7d4 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -1107,6 +1107,8 @@ def jacoco(registry, xml_parent, data): to locate class files (default ``**/classes``) :arg str source-pattern: This is a file name pattern that can be used to locate source files (default ``**/src/main/java``) + :arg str source-inclusion-pattern: This is a file name pattern that can + be used to include certain source files (default ``**/*.java``) :arg bool update-build-status: Update the build according to the results (default false) :arg str inclusion-pattern: This is a file name pattern that can be used @@ -1139,6 +1141,7 @@ def jacoco(registry, xml_parent, data): ('exec-pattern', 'execPattern', '**/**.exec'), ('class-pattern', 'classPattern', '**/classes'), ('source-pattern', 'sourcePattern', '**/src/main/java'), + ('source-inclusion-pattern', 'sourceInclusionPattern', '**/*.java'), ('update-build-status', 'changeBuildStatus', False), ('inclusion-pattern', 'inclusionPattern', ''), ('exclusion-pattern', 'exclusionPattern', ''), @@ -1416,6 +1419,76 @@ def rocket(registry, xml_parent, data): data.get('custom-message', '') +def hp_alm(registry, xml_parent, data): + """yaml: hp-alm + Publish test results to HP-ALM. + + Requires the Jenkins :jenkins-wiki:`Micro Focus Application Automation + Tools <Micro+Focus+Application+Automation+Tools)>`. + + :arg str server-name: The name of the ALM Server. (required) + :arg str credentials-id: credentials-id of the user (default '') + :arg str domaine: The Domain of the project to be used. (required) + :arg str client-type: Client type is required for some ALM above 12.60 + in authentication.(default '') + :arg str project: The project to be used. (required) + :arg str testing-framework: The testing framework that is used when + generate the testing result file. (default Junit) + :arg str testing-tool: The testing tool that is used when generate + the testing result file. (default '') + :arg str folder: The path of the test folder that will contain + the uploaded test. + The path doesn't include the Root test folder (Subject). + For example, sampletestfolder/subfolder means, the tests will be + uploaded to test folder named 'subfolder', which is under + the test folder named 'sampletestfolder', and 'sampletestfolder' + is under the root test folder 'Subject'. (required) + :arg str set-folder: The path of the testset folder that will contain + the uploaded testset. The path doesn't include the Root testset folder. + For example, sampletestsetfolder/subfolder means, the testsets will be + uploaded to testset folder named 'subfolder', which is under + the testset folder named 'sampletestsetfolder', + and 'sampletestsetfolder' is under the root testset folder 'Root'. + (required) + :arg str testing-result-file: The condition to find the testing + result file, start from the root path of the job. + For example, ``**/junitResult.xml`` to find testing result file + for Junit Plugin, ``**/testng-results.xml`` to find + testing result file for TestNG plugin. (required) + :arg str jenkins-server-url: The HTTP URL of the Jenkins Server, + form example, http://myjenkinsserver.test.com:8080 . (optional) + + Minimal example using defaults: + + .. literalinclude:: /../../tests/publishers/fixtures/hp-alm001.yaml + :language: yaml + + Full example: + + .. literalinclude:: /../../tests/publishers/fixtures/hp-alm002.yaml + :language: yaml + """ + alm_uploader = XML.SubElement(xml_parent, + 'com.microfocus.application.automation.' + 'tools.results.TestResultToALMUploader') + alm_uploader.set('plugin', 'hp-application-automation-tools-plugin') + mapping = [ + ('server-name', 'almServerName', None), + ('credentials-id', 'credentialsId', ''), + ('domain', 'almDomain', None), + ('project', 'almProject', None), + ('client-type', 'clientType', ''), + ('testing-framework', 'testingFramework', 'JUnit'), + ('testing-tool', 'testingTool', ''), + ('folder', 'almTestFolder', None), + ('set-folder', 'almTestSetFolder', None), + ('testing-result-file', 'testingResultFile', None), + ('jenkins-server-url', 'jenkinsServerUrl', ''), + ] + helpers.convert_mapping_to_xml( + alm_uploader, data, mapping, fail_required=True) + + def junit(registry, xml_parent, data): """yaml: junit Publish JUnit test results. @@ -3470,6 +3543,8 @@ def workspace_cleanup(registry, xml_parent, data): :arg bool clean-parent: Cleanup matrix parent workspace (default false) :arg str external-deletion-command: external deletion command to run against files and directories + :arg bool disable-deferred-wipeout: Disable improved deferred wipeout + method (default false) Minimal Example: @@ -3503,7 +3578,8 @@ def workspace_cleanup(registry, xml_parent, data): mappings = [ ('dirmatch', 'deleteDirs', False), ('clean-parent', 'cleanupMatrixParent', False), - ('external-deletion-command', 'externalDelete', '') + ('external-deletion-command', 'externalDelete', ''), + ('disable-deferred-wipeout', 'disableDeferredWipeout', False), ] helpers.convert_mapping_to_xml(p, data, mappings, fail_required=True) diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index f128a354..fcd93390 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -846,6 +846,8 @@ def jms_messaging(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`JMS Messaging Plugin <JMS+Messaging+Plugin>`. + :arg str override-topic: If you need to override the default topic. + (default '') :arg str selector: The JSON or YAML formatted text that conforms to the schema for defining the various OpenShift resources. (default '') note: topic needs to be in double quotes @@ -873,6 +875,11 @@ def jms_messaging(registry, xml_parent, data): jmsm = XML.SubElement(xml_parent, namespace + 'CIBuildTrigger') + if 'override-topic' in data: + overrides = XML.SubElement(jmsm, 'overrides') + XML.SubElement(overrides, + 'topic').text = str(data['override-topic']) + mapping = [ # option, xml name, default value ("spec", 'spec', ''), @@ -1915,17 +1922,40 @@ def rabbitmq(registry, xml_parent, data): <RabbitMQ+Build+Trigger+Plugin>`. :arg str token: the build token expected in the message queue (required) + :arg list filters: list of filters to apply (optional) + + :Filter: + * **field** (`str`) - Some field in message (required) + * **value** (`str`) - value of specified field (required) Example: .. literalinclude:: /../../tests/triggers/fixtures/rabbitmq.yaml :language: yaml + + Example with filters: + + .. literalinclude:: /../../tests/triggers/fixtures/rabbitmq-filters.yaml + :language: yaml """ + rabbitmq_prefix = 'org.jenkinsci.plugins.rabbitmqbuildtrigger.' rabbitmq = XML.SubElement( xml_parent, - 'org.jenkinsci.plugins.rabbitmqbuildtrigger.' - 'RemoteBuildTrigger') + rabbitmq_prefix + 'RemoteBuildTrigger') + filters = data.get('filters', []) + filter_mapping = [ + ('field', 'field', None), + ('value', 'value', None), + ] + if filters: + filters_tag = XML.SubElement(rabbitmq, 'filters') + for filter_data in filters: + filter_tag = XML.SubElement( + filters_tag, + rabbitmq_prefix + 'Filter') + helpers.convert_mapping_to_xml( + filter_tag, filter_data, filter_mapping, fail_required=True) mapping = [ ('', 'spec', ''), ('token', 'remoteBuildToken', None), diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 16b2d86b..ab5dc2b3 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -767,6 +767,8 @@ def workspace_cleanup(registry, xml_parent, data): determine whether to actually clean up :arg str external-deletion-command: external deletion command to run against files and directories + :arg bool disable-deferred-wipeout: Disable improved deferred wipeout + method (default false) Full Example: @@ -808,6 +810,7 @@ def workspace_cleanup(registry, xml_parent, data): ("dirmatch", 'deleteDirs', False), ('check-parameter', 'cleanupParameter', ''), ('external-deletion-command', 'externalDelete', ''), + ('disable-deferred-wipeout', 'disableDeferredWipeout', False), ] helpers.convert_mapping_to_xml(p, data, mapping, fail_required=True) diff --git a/jenkins_jobs/parser.py b/jenkins_jobs/parser.py index 6506033d..667ce426 100644 --- a/jenkins_jobs/parser.py +++ b/jenkins_jobs/parser.py @@ -249,6 +249,11 @@ class YamlParser(object): for view in self.data.get('view', {}).values(): view['name'] = self._getfullname(view) + + if jobs_glob and not matches(view['name'], jobs_glob): + logger.debug("Ignoring view {0}".format(view['name'])) + continue + logger.debug("Expanding view '{0}'".format(view['name'])) self._formatDescription(view) self.views.append(view) diff --git a/test-requirements.txt b/test-requirements.txt index 37767a6f..301b1347 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,4 +12,3 @@ stestr>=2.0.0 # Apache-2.0/BSD tox>=2.9.1 # MIT mock>=2.0 # BSD sphinxcontrib-programoutput -pre-commit>=1.12.0 diff --git a/tests/base.py b/tests/base.py index 514b83c4..b239f64e 100644 --- a/tests/base.py +++ b/tests/base.py @@ -137,7 +137,8 @@ class BaseTestCase(testtools.TestCase): # Read XML content, assuming it is unicode encoded xml_content = "" for f in sorted(self.out_filenames): - xml_content += u"%s" % io.open(f, 'r', encoding='utf-8').read() + with io.open(f, 'r', encoding='utf-8') as xml_file: + xml_content += u"%s" % xml_file.read() return xml_content def _read_yaml_content(self, filename): diff --git a/tests/cmd/fixtures/plugin_warning.ini b/tests/cmd/fixtures/plugin_warning.ini index 58ae8909..87f9cfda 100644 --- a/tests/cmd/fixtures/plugin_warning.ini +++ b/tests/cmd/fixtures/plugin_warning.ini @@ -1,5 +1,2 @@ -[old_plugin] -setting = some value - [plugin "new_plugin"] setting = some value diff --git a/tests/cmd/test_config.py b/tests/cmd/test_config.py index 8b2eee7d..6cbb6d4d 100644 --- a/tests/cmd/test_config.py +++ b/tests/cmd/test_config.py @@ -77,33 +77,6 @@ class TestConfigs(CmdTestsBase): jenkins_jobs = entry.JenkinsJobs(args) self.assertRaises(IOError, jenkins_jobs.execute) - def test_config_old_plugin_format_warning(self): - """ - Run test mode and check that old plugin settings result - in a warning, while ensuring that missing sections do not - trigger the same warning if a default value is provided. - """ - args = ['--conf', - os.path.join(self.fixtures_path, 'plugin_warning.ini'), - 'test', 'foo'] - jenkins_jobs = entry.JenkinsJobs(args) - jenkins_jobs.jjb_config.get_plugin_config( - 'old_plugin', 'setting', True) - jenkins_jobs.jjb_config.get_plugin_config( - 'old_plugin_no_conf', 'setting', True) - jenkins_jobs.jjb_config.get_plugin_config( - 'new_plugin', 'setting') - self.assertIn( - 'using a [old_plugin] section in your config file is deprecated', - self.logger.output) - self.assertNotIn( - 'using a [old_plugin_no_conf] secton in your config file is ' - 'deprecated', - self.logger.output) - self.assertNotIn( - 'using a [new_plugin] section in your config file is deprecated', - self.logger.output) - def test_config_options_not_replaced_by_cli_defaults(self): """ Run test mode and check config settings from conf file retained diff --git a/tests/localyaml/fixtures/include-raw-escaped-multi001.json b/tests/localyaml/fixtures/include-raw-escaped-multi001.json index 15d0bb29..0c23d0e0 100644 --- a/tests/localyaml/fixtures/include-raw-escaped-multi001.json +++ b/tests/localyaml/fixtures/include-raw-escaped-multi001.json @@ -1,6 +1,6 @@ [ { - "template-job": { + "job-template": { "name": "test-job-include-raw-{num}", "builders": [ { diff --git a/tests/localyaml/fixtures/include-raw-escaped-multi001.yaml b/tests/localyaml/fixtures/include-raw-escaped-multi001.yaml index af5d1bf3..327d1a9f 100644 --- a/tests/localyaml/fixtures/include-raw-escaped-multi001.yaml +++ b/tests/localyaml/fixtures/include-raw-escaped-multi001.yaml @@ -1,4 +1,4 @@ -- template-job: +- job-template: name: test-job-include-raw-{num} builders: - shell: diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml index 3a32f7c1..19a0b895 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.xml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml @@ -130,6 +130,7 @@ <ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges> </jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl> <jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/> + <jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies"> <filters> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter> diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.yaml b/tests/multibranch/fixtures/scm_bitbucket_full.yaml index f203fb6e..06c7ece4 100644 --- a/tests/multibranch/fixtures/scm_bitbucket_full.yaml +++ b/tests/multibranch/fixtures/scm_bitbucket_full.yaml @@ -32,6 +32,7 @@ scm: ignore-target-only-changes: true - change-request: {} - regular-branches: true + - skip-initial-build: true - named-branches: - exact-name: name: 'test' diff --git a/tests/multibranch/fixtures/scm_gerrit_full.xml b/tests/multibranch/fixtures/scm_gerrit_full.xml index 5ba878b0..04c59aec 100644 --- a/tests/multibranch/fixtures/scm_gerrit_full.xml +++ b/tests/multibranch/fixtures/scm_gerrit_full.xml @@ -75,6 +75,7 @@ <ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges> </jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl> <jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/> + <jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies"> <filters> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter> diff --git a/tests/multibranch/fixtures/scm_gerrit_full.yaml b/tests/multibranch/fixtures/scm_gerrit_full.yaml index 36040cb5..29fb7c86 100644 --- a/tests/multibranch/fixtures/scm_gerrit_full.yaml +++ b/tests/multibranch/fixtures/scm_gerrit_full.yaml @@ -20,6 +20,7 @@ scm: ignore-target-only-changes: true - change-request: {} - regular-branches: true + - skip-initial-build: true - named-branches: - exact-name: name: 'test' diff --git a/tests/multibranch/fixtures/scm_git_full.xml b/tests/multibranch/fixtures/scm_git_full.xml index 837f0e55..77c4c435 100644 --- a/tests/multibranch/fixtures/scm_git_full.xml +++ b/tests/multibranch/fixtures/scm_git_full.xml @@ -107,6 +107,7 @@ <ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges> </jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl> <jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/> + <jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies"> <filters> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter> diff --git a/tests/multibranch/fixtures/scm_git_full.yaml b/tests/multibranch/fixtures/scm_git_full.yaml index 5e2a28f5..3454f5b0 100644 --- a/tests/multibranch/fixtures/scm_git_full.yaml +++ b/tests/multibranch/fixtures/scm_git_full.yaml @@ -22,6 +22,7 @@ scm: ignore-target-only-changes: true - change-request: {} - regular-branches: true + - skip-initial-build: true - named-branches: - exact-name: name: 'test' diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml index cc4efcc1..2d914b2b 100644 --- a/tests/multibranch/fixtures/scm_github_full.xml +++ b/tests/multibranch/fixtures/scm_github_full.xml @@ -55,6 +55,10 @@ <jenkins.scm.impl.trait.RegexSCMHeadFilterTrait> <regex>(.*/master|.*/release/.*)</regex> </jenkins.scm.impl.trait.RegexSCMHeadFilterTrait> + <org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait> + <contextLabel>jenkins.example.com/my_context</contextLabel> + <typeSuffix>true</typeSuffix> + </org.jenkinsci.plugins.githubScmTraitNotificationContext.NotificationContextTrait> <jenkins.plugins.git.traits.CleanAfterCheckoutTrait> <extension class="hudson.plugins.git.extensions.impl.CleanCheckout"/> </jenkins.plugins.git.traits.CleanAfterCheckoutTrait> @@ -122,6 +126,7 @@ <ignoreTargetOnlyChanges>false</ignoreTargetOnlyChanges> </jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl> <jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl plugin="basic-branch-build-strategies"/> + <jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing plugin="basic-branch-build-strategies"/> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies"> <filters> <jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-ExactNameFilter> diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml index a45ecb65..42350c67 100644 --- a/tests/multibranch/fixtures/scm_github_full.yaml +++ b/tests/multibranch/fixtures/scm_github_full.yaml @@ -15,6 +15,7 @@ scm: discover-pr-forks-trust: everyone discover-pr-origin: both discover-tags: true + notification-context: 'jenkins.example.com/my_context' property-strategies: all-branches: - suppress-scm-triggering: true @@ -28,6 +29,7 @@ scm: ignore-target-only-changes: true - change-request: {} - regular-branches: true + - skip-initial-build: true - named-branches: - exact-name: name: 'test' diff --git a/tests/properties/fixtures/cachet-gating.xml b/tests/properties/fixtures/cachet-gating.xml new file mode 100644 index 00000000..d71a3443 --- /dev/null +++ b/tests/properties/fixtures/cachet-gating.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <properties> + <com.redhat.jenkins.plugins.cachet.CachetJobProperty plugin="cachet-gating"> + <requiredResources>true</requiredResources> + <resources> + <string>beaker</string> + <string>brew</string> + </resources> + </com.redhat.jenkins.plugins.cachet.CachetJobProperty> + </properties> +</project> diff --git a/tests/properties/fixtures/cachet-gating.yaml b/tests/properties/fixtures/cachet-gating.yaml new file mode 100644 index 00000000..8c514cd9 --- /dev/null +++ b/tests/properties/fixtures/cachet-gating.yaml @@ -0,0 +1,6 @@ +properties: + - cachet-gating: + required-resources: true + resources: + - beaker + - brew diff --git a/tests/publishers/fixtures/hp-alm001.xml b/tests/publishers/fixtures/hp-alm001.xml new file mode 100644 index 00000000..cc21a4b5 --- /dev/null +++ b/tests/publishers/fixtures/hp-alm001.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <com.microfocus.application.automation.tools.results.TestResultToALMUploader plugin="hp-application-automation-tools-plugin"> + <almServerName>HP-ALM</almServerName> + <credentialsId/> + <almDomain>FOO_COMPANY</almDomain> + <almProject>foo_project</almProject> + <clientType/> + <testingFramework>JUnit</testingFramework> + <testingTool/> + <almTestFolder>ALM/foo/release1/test_case1</almTestFolder> + <almTestSetFolder>ALM/foo/release1/test_case1/$env</almTestSetFolder> + <testingResultFile>**/junitResult.xml</testingResultFile> + <jenkinsServerUrl/> + </com.microfocus.application.automation.tools.results.TestResultToALMUploader> + </publishers> +</project> diff --git a/tests/publishers/fixtures/hp-alm001.yaml b/tests/publishers/fixtures/hp-alm001.yaml new file mode 100644 index 00000000..f5ae7d6d --- /dev/null +++ b/tests/publishers/fixtures/hp-alm001.yaml @@ -0,0 +1,8 @@ +publishers: + - hp-alm: + server-name: HP-ALM + domain: FOO_COMPANY + project: foo_project + folder: 'ALM/foo/release1/test_case1' + set-folder: 'ALM/foo/release1/test_case1/$env' + testing-result-file: '**/junitResult.xml' diff --git a/tests/publishers/fixtures/hp-alm002.xml b/tests/publishers/fixtures/hp-alm002.xml new file mode 100644 index 00000000..0137e64a --- /dev/null +++ b/tests/publishers/fixtures/hp-alm002.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <com.microfocus.application.automation.tools.results.TestResultToALMUploader plugin="hp-application-automation-tools-plugin"> + <almServerName>HP-ALM</almServerName> + <credentialsId>cba09876-4321-4567-890a-bcde12345678</credentialsId> + <almDomain>FOO_COMPANY</almDomain> + <almProject>foo_project</almProject> + <clientType>foo_client</clientType> + <testingFramework>JUnit</testingFramework> + <testingTool>foo_tool</testingTool> + <almTestFolder>ALM/foo/release1/test_case1</almTestFolder> + <almTestSetFolder>ALM/foo/release1/test_case1/$env</almTestSetFolder> + <testingResultFile>**/junitResult.xml</testingResultFile> + <jenkinsServerUrl>http://myjenkinsserver.test.com:8080</jenkinsServerUrl> + </com.microfocus.application.automation.tools.results.TestResultToALMUploader> + </publishers> +</project> diff --git a/tests/publishers/fixtures/hp-alm002.yaml b/tests/publishers/fixtures/hp-alm002.yaml new file mode 100644 index 00000000..5404538a --- /dev/null +++ b/tests/publishers/fixtures/hp-alm002.yaml @@ -0,0 +1,13 @@ +publishers: + - hp-alm: + server-name: HP-ALM + credentials-id: cba09876-4321-4567-890a-bcde12345678 + domain: FOO_COMPANY + project: foo_project + client-type: foo_client + testing-framework: JUnit + testing-tool: foo_tool + folder: 'ALM/foo/release1/test_case1' + set-folder: 'ALM/foo/release1/test_case1/$env' + testing-result-file: '**/junitResult.xml' + jenkins-server-url: 'http://myjenkinsserver.test.com:8080' diff --git a/tests/publishers/fixtures/jacoco-full.xml b/tests/publishers/fixtures/jacoco-full.xml index 1c11bb97..43d07ef1 100644 --- a/tests/publishers/fixtures/jacoco-full.xml +++ b/tests/publishers/fixtures/jacoco-full.xml @@ -5,6 +5,7 @@ <execPattern>**/**.exec</execPattern> <classPattern>**/classes</classPattern> <sourcePattern>**/src/main/java</sourcePattern> + <sourceInclusionPattern>**/*.java,**/*.kt</sourceInclusionPattern> <changeBuildStatus>true</changeBuildStatus> <inclusionPattern>**/*.class</inclusionPattern> <exclusionPattern>**/*Test*.class</exclusionPattern> diff --git a/tests/publishers/fixtures/jacoco-full.yaml b/tests/publishers/fixtures/jacoco-full.yaml index f1ea1d8b..df3619cb 100644 --- a/tests/publishers/fixtures/jacoco-full.yaml +++ b/tests/publishers/fixtures/jacoco-full.yaml @@ -3,6 +3,7 @@ publishers: exec-pattern: '**/**.exec' class-pattern: '**/classes' source-pattern: '**/src/main/java' + source-inclusion-pattern: '**/*.java,**/*.kt' update-build-status: true inclusion-pattern: '**/*.class' exclusion-pattern: '**/*Test*.class' diff --git a/tests/publishers/fixtures/jacoco-minimal.xml b/tests/publishers/fixtures/jacoco-minimal.xml index 309e36dd..c18aef28 100644 --- a/tests/publishers/fixtures/jacoco-minimal.xml +++ b/tests/publishers/fixtures/jacoco-minimal.xml @@ -5,6 +5,7 @@ <execPattern>**/**.exec</execPattern> <classPattern>**/classes</classPattern> <sourcePattern>**/src/main/java</sourcePattern> + <sourceInclusionPattern>**/*.java</sourceInclusionPattern> <changeBuildStatus>false</changeBuildStatus> <inclusionPattern/> <exclusionPattern/> diff --git a/tests/publishers/fixtures/jacoco001.xml b/tests/publishers/fixtures/jacoco001.xml index ab66dab4..982dd075 100644 --- a/tests/publishers/fixtures/jacoco001.xml +++ b/tests/publishers/fixtures/jacoco001.xml @@ -5,6 +5,7 @@ <execPattern>**/**.exec</execPattern> <classPattern>**/classes</classPattern> <sourcePattern>**/src/main/java</sourcePattern> + <sourceInclusionPattern>**/*.java</sourceInclusionPattern> <changeBuildStatus>true</changeBuildStatus> <inclusionPattern/> <exclusionPattern/> diff --git a/tests/publishers/fixtures/jacoco001.yaml b/tests/publishers/fixtures/jacoco001.yaml index fc45fd1c..296e1ffc 100644 --- a/tests/publishers/fixtures/jacoco001.yaml +++ b/tests/publishers/fixtures/jacoco001.yaml @@ -3,6 +3,7 @@ publishers: exec-pattern: "**/**.exec" class-pattern: "**/classes" source-pattern: "**/src/main/java" + source-inclusion-pattern: '**/*.java' update-build-status: true targets: - branch: diff --git a/tests/publishers/fixtures/stash002.conf b/tests/publishers/fixtures/stash002.conf index 8df10973..cccdcf25 100644 --- a/tests/publishers/fixtures/stash002.conf +++ b/tests/publishers/fixtures/stash002.conf @@ -1,3 +1,3 @@ -[stash] +[plugin "stash"] username=user password=pass diff --git a/tests/publishers/fixtures/workspace-cleanup-full.xml b/tests/publishers/fixtures/workspace-cleanup-full.xml index d5563863..ebe438e9 100644 --- a/tests/publishers/fixtures/workspace-cleanup-full.xml +++ b/tests/publishers/fixtures/workspace-cleanup-full.xml @@ -15,6 +15,7 @@ <deleteDirs>true</deleteDirs> <cleanupMatrixParent>true</cleanupMatrixParent> <externalDelete>command</externalDelete> + <disableDeferredWipeout>true</disableDeferredWipeout> <cleanWhenSuccess>false</cleanWhenSuccess> <cleanWhenUnstable>false</cleanWhenUnstable> <cleanWhenFailure>false</cleanWhenFailure> diff --git a/tests/publishers/fixtures/workspace-cleanup-full.yaml b/tests/publishers/fixtures/workspace-cleanup-full.yaml index 1ea41495..0f5f5e52 100644 --- a/tests/publishers/fixtures/workspace-cleanup-full.yaml +++ b/tests/publishers/fixtures/workspace-cleanup-full.yaml @@ -14,3 +14,4 @@ publishers: fail-build: false clean-parent: true external-deletion-command: 'command' + disable-deferred-wipeout: true diff --git a/tests/publishers/fixtures/workspace-cleanup-minimal.xml b/tests/publishers/fixtures/workspace-cleanup-minimal.xml index 36f0e03e..d264147d 100644 --- a/tests/publishers/fixtures/workspace-cleanup-minimal.xml +++ b/tests/publishers/fixtures/workspace-cleanup-minimal.xml @@ -5,6 +5,7 @@ <deleteDirs>false</deleteDirs> <cleanupMatrixParent>false</cleanupMatrixParent> <externalDelete/> + <disableDeferredWipeout>false</disableDeferredWipeout> <cleanWhenSuccess>true</cleanWhenSuccess> <cleanWhenUnstable>true</cleanWhenUnstable> <cleanWhenFailure>true</cleanWhenFailure> diff --git a/tests/triggers/fixtures/rabbitmq-filters.xml b/tests/triggers/fixtures/rabbitmq-filters.xml new file mode 100644 index 00000000..db1c0bff --- /dev/null +++ b/tests/triggers/fixtures/rabbitmq-filters.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <triggers class="vector"> + <org.jenkinsci.plugins.rabbitmqbuildtrigger.RemoteBuildTrigger> + <filters> + <org.jenkinsci.plugins.rabbitmqbuildtrigger.Filter> + <field>field1</field> + <value>value1</value> + </org.jenkinsci.plugins.rabbitmqbuildtrigger.Filter> + <org.jenkinsci.plugins.rabbitmqbuildtrigger.Filter> + <field>field2</field> + <value>value2</value> + </org.jenkinsci.plugins.rabbitmqbuildtrigger.Filter> + </filters> + <spec/> + <remoteBuildToken>build_trigger_token</remoteBuildToken> + </org.jenkinsci.plugins.rabbitmqbuildtrigger.RemoteBuildTrigger> + </triggers> +</project> diff --git a/tests/triggers/fixtures/rabbitmq-filters.yaml b/tests/triggers/fixtures/rabbitmq-filters.yaml new file mode 100644 index 00000000..bfcdfa99 --- /dev/null +++ b/tests/triggers/fixtures/rabbitmq-filters.yaml @@ -0,0 +1,8 @@ +triggers: + - rabbitmq: + token: 'build_trigger_token' + filters: + - field: 'field1' + value: 'value1' + - field: 'field2' + value: 'value2' diff --git a/tests/wrappers/fixtures/workspace-cleanup-full.xml b/tests/wrappers/fixtures/workspace-cleanup-full.xml index 06b9e11b..22f72f23 100644 --- a/tests/wrappers/fixtures/workspace-cleanup-full.xml +++ b/tests/wrappers/fixtures/workspace-cleanup-full.xml @@ -15,6 +15,7 @@ <deleteDirs>true</deleteDirs> <cleanupParameter>DO_WS_CLEANUP</cleanupParameter> <externalDelete>shred -u %s</externalDelete> + <disableDeferredWipeout>true</disableDeferredWipeout> </hudson.plugins.ws__cleanup.PreBuildCleanup> </buildWrappers> </project> diff --git a/tests/wrappers/fixtures/workspace-cleanup-full.yaml b/tests/wrappers/fixtures/workspace-cleanup-full.yaml index 4ec97cbd..94b66223 100644 --- a/tests/wrappers/fixtures/workspace-cleanup-full.yaml +++ b/tests/wrappers/fixtures/workspace-cleanup-full.yaml @@ -7,3 +7,4 @@ wrappers: dirmatch: true check-parameter: "DO_WS_CLEANUP" external-deletion-command: "shred -u %s" + disable-deferred-wipeout: true diff --git a/tests/wrappers/fixtures/workspace-cleanup-min.xml b/tests/wrappers/fixtures/workspace-cleanup-min.xml index 309a65be..eaecd5d8 100644 --- a/tests/wrappers/fixtures/workspace-cleanup-min.xml +++ b/tests/wrappers/fixtures/workspace-cleanup-min.xml @@ -5,6 +5,7 @@ <deleteDirs>false</deleteDirs> <cleanupParameter/> <externalDelete/> + <disableDeferredWipeout>false</disableDeferredWipeout> </hudson.plugins.ws__cleanup.PreBuildCleanup> </buildWrappers> </project> @@ -49,13 +49,15 @@ commands = [testenv:linters] basepython = python3 +deps = + pre-commit>=1.12.0 commands = - {[tox]install_test_deps} python -m pre_commit run --all # points to linters, kept only for developer convenience [testenv:pep8] envdir={toxworkdir}/linters +deps={[testenv:linters]deps} commands = {[testenv:linters]commands} [testenv:pyflakes] |