diff options
85 files changed, 1099 insertions, 493 deletions
diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 87b7139b..d0649663 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -1998,21 +1998,21 @@ def grails(registry, xml_parent, data): Plugin <Grails+Plugin>`. :arg bool use-wrapper: Use a grails wrapper (default false) - :arg str name: Select a grails installation to use (optional) + :arg str name: Select a grails installation to use (default '(Default)') :arg bool force-upgrade: Run 'grails upgrade --non-interactive' first (default false) :arg bool non-interactive: append --non-interactive to all build targets (default false) - :arg str targets: Specify target(s) to run separated by spaces + :arg str targets: Specify target(s) to run separated by spaces (required) :arg str server-port: Specify a value for the server.port system - property (optional) + property (default '') :arg str work-dir: Specify a value for the grails.work.dir system - property (optional) + property (default '') :arg str project-dir: Specify a value for the grails.project.work.dir - system property (optional) + system property (default '') :arg str base-dir: Specify a path to the root of the Grails - project (optional) - :arg str properties: Additional system properties to set (optional) + project (default '') + :arg str properties: Additional system properties to set (default '') :arg bool plain-output: append --plain-output to all build targets (default false) :arg bool stack-trace: append --stack-trace to all build targets @@ -2022,40 +2022,37 @@ def grails(registry, xml_parent, data): :arg bool refresh-dependencies: append --refresh-dependencies to all build targets (default false) - Example: + Full Example: - .. literalinclude:: ../../tests/builders/fixtures/grails.yaml + .. literalinclude:: ../../tests/builders/fixtures/grails-full.yaml + :language: yaml + + Minimal Example: + + .. literalinclude:: ../../tests/builders/fixtures/grails-minimal.yaml :language: yaml """ grails = XML.SubElement(xml_parent, 'com.g2one.hudson.grails.' 'GrailsBuilder') - XML.SubElement(grails, 'targets').text = data['targets'] - XML.SubElement(grails, 'name').text = data.get( - 'name', '(Default)') - XML.SubElement(grails, 'grailsWorkDir').text = data.get( - 'work-dir', '') - XML.SubElement(grails, 'projectWorkDir').text = data.get( - 'project-dir', '') - XML.SubElement(grails, 'projectBaseDir').text = data.get( - 'base-dir', '') - XML.SubElement(grails, 'serverPort').text = data.get( - 'server-port', '') - XML.SubElement(grails, 'properties').text = data.get( - 'properties', '') - XML.SubElement(grails, 'forceUpgrade').text = str( - data.get('force-upgrade', False)).lower() - XML.SubElement(grails, 'nonInteractive').text = str( - data.get('non-interactive', False)).lower() - XML.SubElement(grails, 'useWrapper').text = str( - data.get('use-wrapper', False)).lower() - XML.SubElement(grails, 'plainOutput').text = str( - data.get('plain-output', False)).lower() - XML.SubElement(grails, 'stackTrace').text = str( - data.get('stack-trace', False)).lower() - XML.SubElement(grails, 'verbose').text = str( - data.get('verbose', False)).lower() - XML.SubElement(grails, 'refreshDependencies').text = str( - data.get('refresh-dependencies', False)).lower() + grails.set('plugin', 'grails') + + mappings = [ + ('targets', 'targets', None), + ('name', 'name', '(Default)'), + ('work-dir', 'grailsWorkDir', ''), + ('project-dir', 'projectWorkDir', ''), + ('base-dir', 'projectBaseDir', ''), + ('server-port', 'serverPort', ''), + ('properties', 'properties', ''), + ('force-upgrade', 'forceUpgrade', False), + ('non-interactive', 'nonInteractive', False), + ('use-wrapper', 'useWrapper', False), + ('plain-output', 'plainOutput', False), + ('stack-trace', 'stackTrace', False), + ('verbose', 'verbose', False), + ('refresh-dependencies', 'refreshDependencies', False), + ] + convert_mapping_to_xml(grails, data, mappings, fail_required=True) def sbt(registry, xml_parent, data): @@ -2080,16 +2077,14 @@ def sbt(registry, xml_parent, data): """ sbt = XML.SubElement(xml_parent, 'org.jvnet.hudson.plugins.' 'SbtPluginBuilder') - XML.SubElement(sbt, 'name').text = data.get( - 'name', '') - XML.SubElement(sbt, 'jvmFlags').text = data.get( - 'jvm-flags', '') - XML.SubElement(sbt, 'sbtFlags').text = data.get( - 'sbt-flags', '-Dsbt.log.noformat=true') - XML.SubElement(sbt, 'actions').text = data.get( - 'actions', '') - XML.SubElement(sbt, 'subdirPath').text = data.get( - 'subdir-path', '') + mappings = [ + ('name', 'name', ''), + ('jvm-flags', 'jvmFlags', ''), + ('sbt-flags', 'sbtFlags', '-Dsbt.log.noformat=true'), + ('actions', 'actions', ''), + ('subdir-path', 'subdirPath', ''), + ] + convert_mapping_to_xml(sbt, data, mappings, fail_required=True) def critical_block_start(registry, xml_parent, data): @@ -3621,3 +3616,59 @@ def build_name_setter(registry, xml_parent, data): ] convert_mapping_to_xml( build_name_setter, data, mapping, fail_required=True) + + +def nexus_artifact_uploader(registry, xml_parent, data): + """yaml: nexus-artifact-uploader + To upload result of a build as an artifact in Nexus without the need of + Maven. Requires the Jenkins :nexus-artifact-uploader: + `Nexus Artifact Uploader Plugin <Nexus+Artifact+Uploader>`. + + :arg str protocol: Protocol to use to connect to Nexus (default https) + :arg str nexus_url: Nexus url (without protocol) (default '') + :arg str nexus_user: Username to upload artifact to Nexus (default '') + :arg str nexus_password: Password to upload artifact to Nexus + (default '') + :arg str group_id: GroupId to set for the artifact to upload + (default '') + :arg str artifact_id: ArtifactId to set for the artifact to upload + (default '') + :arg str version: Version to set for the artifact to upload + (default '') + :arg str packaging: Packaging to set for the artifact to upload + (default '') + :arg str type: Type to set for the artifact to upload (default '') + :arg str classifier: Classifier to set for the artifact to upload + (default '') + :arg str repository: In which repository to upload the artifact + (default '') + :arg str file: File which will be the uploaded artifact (default '') + :arg str credentials_id: Credentials to use (instead of password) + (default '') + + File Example: + + .. literalinclude:: + /../../tests/builders/fixtures/nexus-artifact-uploader.yaml + :language: yaml + """ + nexus_artifact_uploader = XML.SubElement( + xml_parent, + 'sp.sd.nexusartifactuploader.NexusArtifactUploader') + mapping = [ + ('protocol', 'protocol', 'https'), + ('nexus_url', 'nexusUrl', ''), + ('nexus_user', 'nexusUser', ''), + ('nexus_password', 'nexusPassword', ''), + ('group_id', 'groupId', ''), + ('artifact_id', 'artifactId', ''), + ('version', 'version', ''), + ('packaging', 'packaging', ''), + ('type', 'type', ''), + ('classifier', 'classifier', ''), + ('repository', 'repository', ''), + ('file', 'file', ''), + ('credentials_id', 'credentialsId', ''), + ] + convert_mapping_to_xml( + nexus_artifact_uploader, data, mapping, fail_required=True) diff --git a/jenkins_jobs/modules/helpers.py b/jenkins_jobs/modules/helpers.py index 21fa65c5..ff824555 100644 --- a/jenkins_jobs/modules/helpers.py +++ b/jenkins_jobs/modules/helpers.py @@ -339,57 +339,51 @@ def artifactory_optional_props(xml_parent, data, target): yaml_prop, '') common_bool_props = [ - # xml property name, yaml property name, default value - ('deployArtifacts', 'deploy-artifacts', True), - ('discardOldBuilds', 'discard-old-builds', False), - ('discardBuildArtifacts', 'discard-build-artifacts', False), - ('deployBuildInfo', 'publish-build-info', False), - ('includeEnvVars', 'env-vars-include', False), - ('runChecks', 'run-checks', False), - ('includePublishArtifacts', 'include-publish-artifacts', False), - ('licenseAutoDiscovery', 'license-auto-discovery', True), - ('enableIssueTrackerIntegration', 'enable-issue-tracker-integration', + # yaml property name, xml property name, default value + ('deploy-artifacts', 'deployArtifacts', True), + ('discard-old-builds', 'discardOldBuilds', False), + ('discard-build-artifacts', 'discardBuildArtifacts', False), + ('publish-build-info', 'deployBuildInfo', False), + ('env-vars-include', 'includeEnvVars', False), + ('run-checks', 'runChecks', False), + ('include-publish-artifacts', 'includePublishArtifacts', False), + ('license-auto-discovery', 'licenseAutoDiscovery', True), + ('enable-issue-tracker-integration', 'enableIssueTrackerIntegration', False), - ('aggregateBuildIssues', 'aggregate-build-issues', False), - ('blackDuckRunChecks', 'black-duck-run-checks', False), - ('blackDuckIncludePublishedArtifacts', - 'black-duck-include-published-artifacts', False), - ('autoCreateMissingComponentRequests', - 'auto-create-missing-component-requests', True), - ('autoDiscardStaleComponentRequests', - 'auto-discard-stale-component-requests', True), - ('filterExcludedArtifactsFromBuild', - 'filter-excluded-artifacts-from-build', False) + ('aggregate-build-issues', 'aggregateBuildIssues', False), + ('black-duck-run-checks', 'blackDuckRunChecks', False), + ('black-duck-include-published-artifacts', + 'blackDuckIncludePublishedArtifacts', False), + ('auto-create-missing-component-requests', + 'autoCreateMissingComponentRequests', True), + ('auto-discard-stale-component-requests', + 'autoDiscardStaleComponentRequests', True), + ('filter-excluded-artifacts-from-build', + 'filterExcludedArtifactsFromBuild', False) ] - - for (xml_prop, yaml_prop, default_value) in common_bool_props: - XML.SubElement(xml_parent, xml_prop).text = str(data.get( - yaml_prop, default_value)).lower() + convert_mapping_to_xml( + xml_parent, data, common_bool_props, fail_required=True) if 'wrappers' in target: wrapper_bool_props = [ - ('enableResolveArtifacts', 'enable-resolve-artifacts', False), - ('disableLicenseAutoDiscovery', - 'disable-license-auto-discovery', False), - ('recordAllDependencies', - 'record-all-dependencies', False) + ('enable-resolve-artifacts', 'enableResolveArtifacts', False), + ('disable-license-auto-discovery', + 'disableLicenseAutoDiscovery', False), + ('record-all-dependencies', + 'recordAllDependencies', False) ] - - for (xml_prop, yaml_prop, default_value) in wrapper_bool_props: - XML.SubElement(xml_parent, xml_prop).text = str(data.get( - yaml_prop, default_value)).lower() + convert_mapping_to_xml( + xml_parent, data, wrapper_bool_props, fail_required=True) if 'publishers' in target: publisher_bool_props = [ - ('evenIfUnstable', 'even-if-unstable', False), - ('passIdentifiedDownstream', 'pass-identified-downstream', False), - ('allowPromotionOfNonStagedBuilds', - 'allow-promotion-of-non-staged-builds', False) + ('even-if-unstable', 'evenIfUnstable', False), + ('pass-identified-downstream', 'passIdentifiedDownstream', False), + ('allow-promotion-of-non-staged-builds', + 'allowPromotionOfNonStagedBuilds', False) ] - - for (xml_prop, yaml_prop, default_value) in publisher_bool_props: - XML.SubElement(xml_parent, xml_prop).text = str(data.get( - yaml_prop, default_value)).lower() + convert_mapping_to_xml( + xml_parent, data, publisher_bool_props, fail_required=True) def artifactory_common_details(details, data): @@ -432,6 +426,9 @@ def append_git_revision_config(parent, config_def): def test_fairy_common(xml_element, data): xml_element.set('plugin', 'TestFairy') + valid_max_duration = ['10m', '60m', '300m', '1440m'] + valid_interval = [1, 2, 5] + valid_video_quality = ['high', 'medium', 'low'] mappings = [ # General @@ -441,13 +438,13 @@ def test_fairy_common(xml_element, data): ('notify-testers', 'notifyTesters', True), ('autoupdate', 'autoUpdate', True), # Session - ('max-duration', 'maxDuration', '10m'), + ('max-duration', 'maxDuration', '10m', valid_max_duration), ('record-on-background', 'recordOnBackground', False), ('data-only-wifi', 'dataOnlyWifi', False), # Video ('video-enabled', 'isVideoEnabled', True), - ('screenshot-interval', 'screenshotInterval', '1'), - ('video-quality', 'videoQuality', 'high'), + ('screenshot-interval', 'screenshotInterval', 1, valid_interval), + ('video-quality', 'videoQuality', 'high', valid_video_quality), # Metrics ('cpu', 'cpu', True), ('memory', 'memory', True), diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index b3bb04fa..692663b4 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -121,24 +121,64 @@ def promoted_build(registry, xml_parent, data): XML.SubElement(active_processes, 'string').text = str(n) +def gitbucket(parser, xml_parent, data): + """yaml: gitbucket + Integrate GitBucket to Jenkins. + Requires the Jenkins :jenkins-wiki:`GitBucket Plugin <GitBucket+Plugin>`. + + :arg str url: GitBucket URL to issue (required) + :arg bool link-enabled: Enable hyperlink to issue (default false) + + Minimal Example: + + .. literalinclude:: /../../tests/properties/fixtures/gitbucket-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/properties/fixtures/gitbucket-full.yaml + :language: yaml + """ + gitbucket = XML.SubElement( + xml_parent, 'org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty') + gitbucket.set('plugin', 'gitbucket') + + mapping = [ + ('url', 'url', None), + ('link-enabled', 'linkEnabled', False), + ] + helpers.convert_mapping_to_xml( + gitbucket, data, mapping, fail_required=True) + + def github(registry, xml_parent, data): """yaml: github Sets the GitHub URL for the project. :arg str url: the GitHub URL (required) + :arg str display-name: This value will be used as context name for commit + status if status builder or status publisher is defined for this + project. (>= 1.14.1) (default '') - Example: + Minimal Example: - .. literalinclude:: /../../tests/properties/fixtures/github.yaml + .. literalinclude:: /../../tests/properties/fixtures/github-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/properties/fixtures/github-full.yaml :language: yaml """ - github = XML.SubElement(xml_parent, - 'com.coravy.hudson.plugins.github.' - 'GithubProjectProperty') - try: - XML.SubElement(github, 'projectUrl').text = data['url'] - except KeyError as e: - raise MissingAttributeError(e) + github = XML.SubElement( + xml_parent, 'com.coravy.hudson.plugins.github.GithubProjectProperty') + github.set('plugin', 'github') + + mapping = [ + ('url', 'projectUrl', None), + ('display-name', 'displayName', ''), + ] + helpers.convert_mapping_to_xml(github, data, mapping, fail_required=True) def gitlab(registry, xml_parent, data): @@ -701,11 +741,6 @@ def slack(registry, xml_parent, data): /../../tests/properties/fixtures/slack001.yaml :language: yaml """ - def _add_xml(elem, name, value): - if isinstance(value, bool): - value = str(value).lower() - XML.SubElement(elem, name).text = value - logger = logging.getLogger(__name__) plugin_info = registry.get_plugin_info('Slack Notification Plugin') @@ -742,33 +777,41 @@ def slack(registry, xml_parent, data): if not data.get('custom-message', ''): raise MissingAttributeError('custom-message') - for yaml_name, xml_name, default_value in mapping: - _add_xml(slack, xml_name, data.get(yaml_name, default_value)) + helpers.convert_mapping_to_xml(slack, data, mapping, fail_required=True) def rebuild(registry, xml_parent, data): """yaml: rebuild - Requires the Jenkins :jenkins-wiki:`Rebuild Plugin - <Rebuild+Plugin>`. + This plug-in allows the user to rebuild a parameterized build without + entering the parameters again.It will also allow the user to edit the + parameters before rebuilding. + Requires the Jenkins :jenkins-wiki:`Rebuild Plugin <Rebuild+Plugin>`. :arg bool auto-rebuild: Rebuild without asking for parameters (default false) :arg bool rebuild-disabled: Disable rebuilding for this job (default false) - Example: + Minimal Example: - .. literalinclude:: - /../../tests/properties/fixtures/rebuild.yaml + .. literalinclude:: /../../tests/properties/fixtures/rebuild-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/properties/fixtures/rebuild-full.yaml :language: yaml """ sub_element = XML.SubElement(xml_parent, 'com.sonyericsson.rebuild.RebuildSettings') + sub_element.set('plugin', 'rebuild') - XML.SubElement(sub_element, 'autoRebuild').text = str( - data.get('auto-rebuild', False)).lower() - XML.SubElement(sub_element, 'rebuildDisabled').text = str( - data.get('rebuild-disabled', False)).lower() + mapping = [ + ('auto-rebuild', 'autoRebuild', False), + ('rebuild-disabled', 'rebuildDisabled', False), + ] + helpers.convert_mapping_to_xml( + sub_element, data, mapping, fail_required=True) def build_discarder(registry, xml_parent, data): @@ -795,14 +838,15 @@ def build_discarder(registry, xml_parent, data): 'jenkins.model.BuildDiscarderProperty') strategy = XML.SubElement(base_sub, 'strategy') strategy.set('class', 'hudson.tasks.LogRotator') - days = XML.SubElement(strategy, 'daysToKeep') - days.text = str(data.get('days-to-keep', -1)) - num = XML.SubElement(strategy, 'numToKeep') - num.text = str(data.get('num-to-keep', -1)) - adays = XML.SubElement(strategy, 'artifactDaysToKeep') - adays.text = str(data.get('artifact-days-to-keep', -1)) - anum = XML.SubElement(strategy, 'artifactNumToKeep') - anum.text = str(data.get('artifact-num-to-keep', -1)) + + mappings = [ + ('days-to-keep', 'daysToKeep', -1), + ('num-to-keep', 'numToKeep', -1), + ('artifact-days-to-keep', 'artifactDaysToKeep', -1), + ('artifact-num-to-keep', 'artifactNumToKeep', -1), + ] + helpers.convert_mapping_to_xml( + strategy, data, mappings, fail_required=True) class Properties(jenkins_jobs.modules.base.Base): diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index f87faf29..1cd14527 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -202,10 +202,8 @@ def jdepend(registry, xml_parent, data): jdepend = XML.SubElement( xml_parent, 'hudson.plugins.jdepend.JDependRecorder') - filepath = data.get('file', None) - if filepath is None: - raise MissingAttributeError('file') - XML.SubElement(jdepend, 'configuredJDependFile').text = str(filepath) + mapping = [('file', 'configuredJDependFile', None)] + helpers.convert_mapping_to_xml(jdepend, data, mapping, fail_required=True) def hue_light(registry, xml_parent, data): @@ -1063,6 +1061,62 @@ def ftp(registry, xml_parent, data): XML.SubElement(transfer_node, 'asciiMode').text = 'false' +def ftp_publisher(registry, xml_parent, data): + """yaml: ftp-publisher + This plugin can be used to upload project artifacts and whole directories + to an ftp server. + Requires the Jenkins :jenkins-wiki:`FTP-Publisher Plugin + <FTP-Publisher+Plugin>`. + + :arg list uploads: List of files to upload + + :uploads: + * **file-path** ('str') -- Destination folder. It will be created + if doesn't exists. Created relative to ftp root directory. + (default '') + * **source-file** ('str') -- Source files which will be uploaded + (default '') + :arg str site-name: Name of FTP server to upload to (required) + :arg bool use-timestamps: Use timestamps in the FTP directory path (default + false) + :arg bool flatten-files: Flatten files on the FTP host (default false) + :arg bool skip-publishing: Skip publishing (default false) + + Minimal Example: + + .. literalinclude:: + /../../tests/publishers/fixtures/ftp-publisher-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: + /../../tests/publishers/fixtures/ftp-publisher-full.yaml + :language: yaml + """ + ftp = XML.SubElement(xml_parent, 'com.zanox.hudson.plugins.FTPPublisher') + ftp.set('plugin', 'ftppublisher') + + entries = XML.SubElement(ftp, 'entries') + if 'uploads' in data: + upload_mapping = [ + ('file-path', 'filePath', ''), + ('source-file', 'sourceFile', ''), + ] + for upload in data['uploads']: + entry = XML.SubElement(entries, 'com.zanox.hudson.plugins.Entry') + helpers.convert_mapping_to_xml( + entry, upload, upload_mapping, fail_required=True) + + mapping = [ + ('site-name', 'siteName', None), + ('use-timestamps', 'useTimestamps', False), + ('flatten-files', 'flatten', False), + ('skip-publishing', 'skip', False), + ] + helpers.convert_mapping_to_xml(ftp, data, mapping, fail_required=True) + + def junit(registry, xml_parent, data): """yaml: junit Publish JUnit test results. @@ -1197,23 +1251,33 @@ def cucumber_testresult(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`cucumber testresult <Cucumber+Test+Result+Plugin>`. - :arg str results: results filename (required) + :arg str results: Results filename (required) + :arg bool ignore-bad-steps: Ignore not existed step results (default false) - Example: + Minimal example: .. literalinclude:: - /../../tests/publishers/fixtures/cucumber_testresult.yaml - :language: yaml + /../../tests/publishers/fixtures/cucumber-testresult-minimal.yaml + :language: yaml + + Full Example: + .. literalinclude:: + /../../tests/publishers/fixtures/cucumber-testresult-complete.yaml + :language: yaml """ cucumber_result = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.cucumber.' 'jsontestsupport.' 'CucumberTestResultArchiver') - filepath = data.get('results', None) - if filepath is None: - raise MissingAttributeError('results') - XML.SubElement(cucumber_result, 'testResults').text = str(filepath) + cucumber_result.set('plugin', 'cucumber-testresult-plugin') + + mappings = [ + ('results', 'testResults', None), + ('ignore-bad-steps', 'ignoreBadSteps', False) + ] + helpers.convert_mapping_to_xml( + cucumber_result, data, mappings, fail_required=True) def xunit(registry, xml_parent, data): @@ -1244,12 +1308,12 @@ def xunit(registry, xml_parent, data): ``gtest``, ``junit``, ``mstest``, ``nunit``, ``phpunit``, ``tusar``, ``unittest``, and ``valgrind``. - The 'custom' type is not supported. + 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. + 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 @@ -1267,6 +1331,7 @@ def xunit(registry, xml_parent, data): """ logger = logging.getLogger(__name__) xunit = XML.SubElement(xml_parent, 'xunit') + xunit.set('plugin', 'xunit') # Map our internal types to the XML element names used by Jenkins plugin types_to_plugin_types = { @@ -1310,17 +1375,17 @@ def xunit(registry, xml_parent, data): xmlframework = XML.SubElement(xmltypes, types_to_plugin_types[framework_name]) - XML.SubElement(xmlframework, 'pattern').text = ( - supported_type[framework_name].get('pattern', '')) - XML.SubElement(xmlframework, 'failIfNotNew').text = str( - supported_type[framework_name].get('requireupdate', True)).lower() - XML.SubElement(xmlframework, 'deleteOutputFiles').text = str( - supported_type[framework_name].get('deleteoutput', True)).lower() - XML.SubElement(xmlframework, 'skipNoTestFiles').text = str( - supported_type[framework_name].get('skip-if-no-test-files', - False)).lower() - XML.SubElement(xmlframework, 'stopProcessingIfError').text = str( - supported_type[framework_name].get('stoponerror', True)).lower() + mappings = [ + ('pattern', 'pattern', ''), + ('requireupdate', 'failIfNotNew', True), + ('deleteoutput', 'deleteOutputFiles', True), + ('skip-if-no-test-files', 'skipNoTestFiles', False), + ('stoponerror', 'stopProcessingIfError', True), + ] + 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', []): @@ -1509,17 +1574,17 @@ def checkstyle(registry, xml_parent, data): The checkstyle component accepts a dictionary with the following values: - :arg str pattern: Report filename pattern (optional) + :arg str pattern: Report filename pattern (default '') :arg bool can-run-on-failed: Also runs for failed builds, instead of just - stable or unstable builds (default false) + stable or unstable builds (default false) :arg bool should-detect-modules: Determines if Ant or Maven modules should - be detected for all files that contain warnings (default false) - :arg int healthy: Sunny threshold (optional) - :arg int unhealthy: Stormy threshold (optional) + be detected for all files that contain warnings (default false) + :arg int healthy: Sunny threshold (default '') + :arg int unhealthy: Stormy threshold (default '') :arg str health-threshold: Threshold priority for health status - ('low', 'normal' or 'high', defaulted to 'low') + ('low', 'normal' or 'high') (default 'low') :arg dict thresholds: Mark build as failed or unstable if the number of - errors exceeds a threshold. (optional) + errors exceeds a threshold. (optional) :thresholds: * **unstable** (`dict`) @@ -1541,19 +1606,19 @@ def checkstyle(registry, xml_parent, data): * **new-high** (`int`) * **new-normal** (`int`) * **new-low** (`int`) - :arg str default-encoding: Encoding for parsing or showing files (optional) + :arg str default-encoding: Encoding for parsing or showing files + (default '') :arg bool do-not-resolve-relative-paths: (default false) :arg bool dont-compute-new: If set to false, computes new warnings based on - the reference build (default true) + the reference build (default true) :arg bool use-previous-build-as-reference: determines whether to always use the previous build as the reference build (default false) :arg bool use-stable-build-as-reference: The number of new warnings will be - calculated based on the last stable build, allowing reverts of unstable - builds where the number of warnings was decreased. (default false) + calculated based on the last stable build, allowing reverts of unstable + builds where the number of warnings was decreased. (default false) :arg bool use-delta-values: If set then the number of new warnings is - calculated by subtracting the total number of warnings of the current - build from the reference build. - (default false) + calculated by subtracting the total number of warnings of the current + build from the reference build. (default false) Example: @@ -1574,9 +1639,10 @@ def checkstyle(registry, xml_parent, data): data.setdefault(lookup[old_key], data[old_key]) del data[old_key] - xml_element = XML.SubElement(xml_parent, - 'hudson.plugins.checkstyle.' - 'CheckStylePublisher') + checkstyle = XML.SubElement(xml_parent, + 'hudson.plugins.checkstyle.' + 'CheckStylePublisher') + checkstyle.set('plugin', 'checkstyle') # Convert old style yaml to new style convert_settings({ @@ -1596,7 +1662,7 @@ def checkstyle(registry, xml_parent, data): 'totalLow': 'total-low' }, threshold_data.get(threshold, {})) - helpers.build_trends_publisher('[CHECKSTYLE] ', xml_element, data) + helpers.build_trends_publisher('[CHECKSTYLE] ', checkstyle, data) def scp(registry, xml_parent, data): @@ -1627,9 +1693,9 @@ def scp(registry, xml_parent, data): /home/jenkins/workspace/${JOB_NAME} - :arg str site: name of the scp site - :arg str target: destination directory - :arg str source: source path specifier + :arg str site: name of the scp site (required) + :arg str target: destination directory (required) + :arg str source: source path specifier (default '') :arg bool keep-hierarchy: keep the file hierarchy when uploading (default false) :arg bool copy-after-failure: copy files even if the job fails @@ -1642,27 +1708,27 @@ def scp(registry, xml_parent, data): .. literalinclude:: /../../tests/publishers/fixtures/scp001.yaml :language: yaml """ - site = data['site'] scp = XML.SubElement(xml_parent, 'be.certipost.hudson.plugin.SCPRepositoryPublisher') - XML.SubElement(scp, 'siteName').text = site + scp.set('plugin', 'scp') + + mappings = [ + ('site', 'siteName', None), + ] + helpers.convert_mapping_to_xml(scp, data, mappings, fail_required=True) + entries = XML.SubElement(scp, 'entries') for entry in data['files']: entry_e = XML.SubElement(entries, 'be.certipost.hudson.plugin.Entry') - XML.SubElement(entry_e, 'filePath').text = entry['target'] - XML.SubElement(entry_e, 'sourceFile').text = entry.get('source', '') - if entry.get('keep-hierarchy', False): - XML.SubElement(entry_e, 'keepHierarchy').text = 'true' - else: - XML.SubElement(entry_e, 'keepHierarchy').text = 'false' - if entry.get('copy-console', False): - XML.SubElement(entry_e, 'copyConsoleLog').text = 'true' - else: - XML.SubElement(entry_e, 'copyConsoleLog').text = 'false' - if entry.get('copy-after-failure', False): - XML.SubElement(entry_e, 'copyAfterFailure').text = 'true' - else: - XML.SubElement(entry_e, 'copyAfterFailure').text = 'false' + mappings = [ + ('target', 'filePath', None), + ('source', 'sourceFile', ''), + ('keep-hierarchy', 'keepHierarchy', False), + ('copy-console', 'copyConsoleLog', False), + ('copy-after-failure', 'copyAfterFailure', False), + ] + helpers.convert_mapping_to_xml( + entry_e, entry, mappings, fail_required=True) def ssh(registry, xml_parent, data): @@ -1791,11 +1857,11 @@ def email(registry, xml_parent, data): :arg str recipients: Space separated list of recipient email addresses - (required) + (required) :arg bool notify-every-unstable-build: Send an email for every - unstable build (default true) + unstable build (default true) :arg bool send-to-individuals: Send an email to the individual - who broke the build (default false) + who broke the build (default false) Example: @@ -1810,10 +1876,11 @@ def email(registry, xml_parent, data): # TODO: raise exception if this is applied to a maven job mailer = XML.SubElement(xml_parent, 'hudson.tasks.Mailer') - try: - XML.SubElement(mailer, 'recipients').text = data['recipients'] - except KeyError as e: - raise MissingAttributeError(e) + mailer.set('plugin', 'mailer') + mapping = [ + ('recipients', 'recipients', None) + ] + helpers.convert_mapping_to_xml(mailer, data, mapping, fail_required=True) # Note the logic reversal (included here to match the GUI if data.get('notify-every-unstable-build', True): @@ -2081,65 +2148,122 @@ def cppcheck(registry, xml_parent, data): Cppcheck result publisher Requires the Jenkins :jenkins-wiki:`Cppcheck Plugin <Cppcheck+Plugin>`. - :arg str pattern: file pattern for cppcheck xml report + :arg str pattern: File pattern for cppcheck xml report (required) + :arg bool ignoreblankfiles: Ignore blank files (default false) + :arg bool allow-no-report: Do not fail the build if the Cppcheck report + is not found (default false) + :arg dict thresholds: + :thresholds: Configure the build status and health. A build is + considered as unstable or failure if the new or total number + of issues exceeds the specified thresholds. The build health + is also determined by thresholds. If the actual number of issues + is between the provided thresholds, then the build health is + interpolated. + * **unstable** (`str`): Total number unstable threshold (default '') + * **new-unstable** (`str`): New number unstable threshold (default '') + * **failure** (`str`): Total number failure threshold (default '') + * **new-failure** (`str`): New number failure threshold (default '') + * **healthy** (`str`): Healthy threshold (default '') + * **unhealthy** (`str`): Unhealthy threshold (default '') + :arg dict severity: + :severity: Determines which severity of issues should be considered + when evaluating the build status and health, default all true + * **error** (`bool`): Severity error (default true) + * **warning** (`bool`): Severity warning (default true) + * **style** (`bool`): Severity style (default true) + * **performance** (`bool`): Severity performance (default true) + * **information** (`bool`): Severity information (default true) + * **nocategory** (`bool`): Severity nocategory (default true) + * **portability** (`bool`): Severity portability (default true) + :arg dict graph: + :graph: Graph configuration + * **xysize** (`array`): Chart width and height (default [500, 200]) + * **num-builds-in-graph** (`int`): Builds number in graph (default 0) + :arg dict display + :display: which errors to display, default only sum + * **sum** (`bool`): Display sum of all issues (default true) + * **error** (`bool`): Display errors (default false) + * **warning** (`bool`): Display warnings (default false) + * **style** (`bool`): Display style (default false) + * **performance** (`bool`): Display performance (default false) + * **information** (`bool`): Display information (default false) + * **nocategory** (`bool`): Display no category (default false) + * **portability** (`bool`): Display portability (default false) - for more optional parameters see the example + Minimal Example: - Example: + .. literalinclude:: + /../../tests/publishers/fixtures/cppcheck-minimal.yaml + :language: yaml - .. literalinclude:: /../../tests/publishers/fixtures/cppcheck001.yaml + Full Example: + .. literalinclude:: + /../../tests/publishers/fixtures/cppcheck-complete.yaml :language: yaml """ + cppextbase = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.cppcheck.' 'CppcheckPublisher') + cppextbase.set('plugin', 'cppcheck') cppext = XML.SubElement(cppextbase, 'cppcheckConfig') - XML.SubElement(cppext, 'pattern').text = data['pattern'] - XML.SubElement(cppext, 'ignoreBlankFiles').text = \ - str(data.get('ignoreblankfiles', False)).lower() + mappings = [ + ('pattern', 'pattern', None), + ('ignoreblankfiles', 'ignoreBlankFiles', False), + ('allow-no-report', 'allowNoReport', False) + ] + helpers.convert_mapping_to_xml(cppext, data, mappings, fail_required=True) csev = XML.SubElement(cppext, 'configSeverityEvaluation') thrsh = data.get('thresholds', {}) - XML.SubElement(csev, 'threshold').text = str(thrsh.get('unstable', '')) - XML.SubElement(csev, 'newThreshold').text = \ - str(thrsh.get('new-unstable', '')) - XML.SubElement(csev, 'failureThreshold').text = \ - str(thrsh.get('failure', '')) - XML.SubElement(csev, 'newFailureThreshold').text = \ - str(thrsh.get('new-failure', '')) - XML.SubElement(csev, 'healthy').text = str(thrsh.get('healthy', '')) - XML.SubElement(csev, 'unHealthy').text = str(thrsh.get('unhealthy', '')) + thrsh_mappings = [ + ('unstable', 'threshold', ''), + ('new-unstable', 'newThreshold', ''), + ('failure', 'failureThreshold', ''), + ('new-failure', 'newFailureThreshold', ''), + ('healthy', 'healthy', ''), + ('unhealthy', 'unHealthy', '') + ] + helpers.convert_mapping_to_xml( + csev, thrsh, thrsh_mappings, fail_required=True) sev = thrsh.get('severity', {}) - XML.SubElement(csev, 'severityError').text = \ - str(sev.get('error', True)).lower() - XML.SubElement(csev, 'severityWarning').text = \ - str(sev.get('warning', True)).lower() - XML.SubElement(csev, 'severityStyle').text = \ - str(sev.get('style', True)).lower() - XML.SubElement(csev, 'severityPerformance').text = \ - str(sev.get('performance', True)).lower() - XML.SubElement(csev, 'severityInformation').text = \ - str(sev.get('information', True)).lower() + sev_mappings = [ + ('error', 'severityError', True), + ('warning', 'severityWarning', True), + ('style', 'severityStyle', True), + ('performance', 'severityPerformance', True), + ('information', 'severityInformation', True), + ('nocategory', 'severityNoCategory', True), + ('portability', 'severityPortability', True) + ] + helpers.convert_mapping_to_xml( + csev, sev, sev_mappings, fail_required=True) graph = data.get('graph', {}) cgraph = XML.SubElement(cppext, 'configGraph') x, y = graph.get('xysize', [500, 200]) XML.SubElement(cgraph, 'xSize').text = str(x) XML.SubElement(cgraph, 'ySize').text = str(y) + graph_mapping = [ + ('num-builds-in-graph', 'numBuildsInGraph', 0) + ] + helpers.convert_mapping_to_xml( + cgraph, graph, graph_mapping, fail_required=True) + gdisplay = graph.get('display', {}) - XML.SubElement(cgraph, 'displayAllErrors').text = \ - str(gdisplay.get('sum', True)).lower() - XML.SubElement(cgraph, 'displayErrorSeverity').text = \ - str(gdisplay.get('error', False)).lower() - XML.SubElement(cgraph, 'displayWarningSeverity').text = \ - str(gdisplay.get('warning', False)).lower() - XML.SubElement(cgraph, 'displayStyleSeverity').text = \ - str(gdisplay.get('style', False)).lower() - XML.SubElement(cgraph, 'displayPerformanceSeverity').text = \ - str(gdisplay.get('performance', False)).lower() - XML.SubElement(cgraph, 'displayInformationSeverity').text = \ - str(gdisplay.get('information', False)).lower() + gdisplay_mappings = [ + ('sum', 'displayAllErrors', True), + ('error', 'displayErrorSeverity', False), + ('warning', 'displayWarningSeverity', False), + ('style', 'displayStyleSeverity', False), + ('performance', 'displayPerformanceSeverity', False), + ('information', 'displayInformationSeverity', False), + ('nocategory', 'displayNoCategorySeverity', False), + ('portability', 'displayPortabilitySeverity', False) + ] + helpers.convert_mapping_to_xml( + cgraph, gdisplay, gdisplay_mappings, fail_required=True) def logparser(registry, xml_parent, data): @@ -2177,8 +2301,10 @@ def copy_to_master(registry, xml_parent, data): :arg list includes: list of file patterns to copy :arg list excludes: list of file patterns to exclude :arg string destination: absolute path into which the files will be copied. - If left blank they will be copied into the - workspace of the current job + If left blank they will be copied into the workspace of the current job + (default '') + :arg bool run-after-result: If this is checked then copying files back to + master will not run until the build result is finalized.(default true) Example: @@ -2186,14 +2312,17 @@ def copy_to_master(registry, xml_parent, data): /../../tests/publishers/fixtures/copy-to-master001.yaml :language: yaml """ - p = 'com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier' - cm = XML.SubElement(xml_parent, p) + cm = XML.SubElement(xml_parent, 'com.michelin.' + 'cio.hudson.plugins.copytoslave.CopyToMasterNotifier') + cm.set('plugin', 'copy-to-slave') XML.SubElement(cm, 'includes').text = ','.join(data.get('includes', [''])) XML.SubElement(cm, 'excludes').text = ','.join(data.get('excludes', [''])) - - XML.SubElement(cm, 'destinationFolder').text = \ - data.get('destination', '') + mappings = [ + ('run-after-result', 'runAfterResultFinalised', True), + ('destination', 'destinationFolder', '') + ] + helpers.convert_mapping_to_xml(cm, data, mappings, fail_required=True) if data.get('destination', ''): XML.SubElement(cm, 'overrideDestinationFolder').text = 'true' @@ -2389,19 +2518,19 @@ def cifs(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`Publish over CIFS Plugin <Publish+Over+CIFS+Plugin>`. - :arg str site: name of the cifs site/share - :arg str target: destination directory + :arg str site: name of the cifs site/share (required) + :arg str target: destination directory (required) :arg bool target-is-date-format: whether target is a date format. If true, - raw text should be quoted (default false) + raw text should be quoted (default false) :arg bool clean-remote: should the remote directory be deleted before - transferring files (default false) - :arg str source: source path specifier - :arg str excludes: excluded file pattern (optional) + transferring files (default false) + :arg str source: source path specifier (required) + :arg str excludes: excluded file pattern (default '') :arg str remove-prefix: prefix to remove from uploaded file paths - (optional) + (default '') :arg bool fail-on-error: fail the build if an error occurs (default false). :arg bool flatten: only create files on the server, don't create - directories (default false). + directories (default false). Example: @@ -2413,8 +2542,8 @@ def cifs(registry, xml_parent, data): plugin_tag = 'jenkins.plugins.publish__over__cifs.CifsPublisherPlugin' publisher_tag = 'jenkins.plugins.publish__over__cifs.CifsPublisher' transfer_tag = 'jenkins.plugins.publish__over__cifs.CifsTransfer' - plugin_reference_tag = 'jenkins.plugins.publish_over_cifs.' \ - 'CifsPublisherPlugin' + plugin_reference_tag = ('jenkins.plugins.publish_over_cifs.' + 'CifsPublisherPlugin') base_publish_over(xml_parent, data, console_prefix, @@ -2447,25 +2576,27 @@ def sonar(registry, xml_parent, data): Analyzing+with+SonarQube+Scanner+for+Jenkins>`_ :arg str jdk: JDK to use (inherited from the job if omitted). (optional) - :arg str branch: branch onto which the analysis will be posted (optional) - :arg str language: source code language (optional) + :arg str branch: branch onto which the analysis will be posted (default '') + :arg str language: source code language (default '') :arg str root-pom: Root POM (default 'pom.xml') :arg bool private-maven-repo: If true, use private Maven repository. - (default false) - :arg str maven-opts: options given to maven (optional) - :arg str additional-properties: sonar analysis parameters (optional) + (default false) + :arg str maven-opts: options given to maven (default '') + :arg str additional-properties: sonar analysis parameters (default '') :arg dict skip-global-triggers: :Triggers: * **skip-when-scm-change** (`bool`): skip analysis when - build triggered by scm + build triggered by scm (default false) * **skip-when-upstream-build** (`bool`): skip analysis when - build triggered by an upstream build + build triggered by an upstream build (default false) * **skip-when-envvar-defined** (`str`): skip analysis when the specified environment variable is set to true + (default '') :arg str settings: Path to use as user settings.xml. It is possible to - provide a ConfigFileProvider settings file, see Example below. (optional) + provide a ConfigFileProvider settings file, see Example below. + (optional) :arg str global-settings: Path to use as global settings.xml. It is - possible to provide a ConfigFileProvider settings file, see Example - below. (optional) + possible to provide a ConfigFileProvider settings file, see Example + below. (optional) Requires the Jenkins :jenkins-wiki:`Config File Provider Plugin <Config+File+Provider+Plugin>` @@ -2474,31 +2605,43 @@ def sonar(registry, xml_parent, data): This publisher supports the post-build action exposed by the Jenkins Sonar Plugin, which is triggering a Sonar Analysis with Maven. - Example: + Minimal Example: - .. literalinclude:: /../../tests/publishers/fixtures/sonar001.yaml + .. literalinclude:: /../../tests/publishers/fixtures/sonar-minimal.yaml + :language: yaml + + Full Example: + .. literalinclude:: /../../tests/publishers/fixtures/sonar-complete.yaml :language: yaml """ + sonar = XML.SubElement(xml_parent, 'hudson.plugins.sonar.SonarPublisher') + sonar.set('plugin', 'sonar') + if 'jdk' in data: XML.SubElement(sonar, 'jdk').text = data['jdk'] - XML.SubElement(sonar, 'branch').text = data.get('branch', '') - XML.SubElement(sonar, 'language').text = data.get('language', '') - XML.SubElement(sonar, 'rootPom').text = data.get('root-pom', 'pom.xml') - XML.SubElement(sonar, 'usePrivateRepository').text = str( - data.get('private-maven-repo', False)).lower() - XML.SubElement(sonar, 'mavenOpts').text = data.get('maven-opts', '') - XML.SubElement(sonar, 'jobAdditionalProperties').text = \ - data.get('additional-properties', '') + + mappings = [ + ('branch', 'branch', ''), + ('language', 'language', ''), + ('root-pom', 'rootPom', 'pom.xml'), + ('private-maven-repo', 'usePrivateRepository', False), + ('maven-opts', 'mavenOpts', ''), + ('additional-properties', 'jobAdditionalProperties', '') + ] + helpers.convert_mapping_to_xml(sonar, data, mappings, fail_required=True) + if 'skip-global-triggers' in data: data_triggers = data['skip-global-triggers'] triggers = XML.SubElement(sonar, 'triggers') - XML.SubElement(triggers, 'skipScmCause').text = \ - str(data_triggers.get('skip-when-scm-change', False)).lower() - XML.SubElement(triggers, 'skipUpstreamCause').text = \ - str(data_triggers.get('skip-when-upstream-build', False)).lower() - XML.SubElement(triggers, 'envVar').text = \ - data_triggers.get('skip-when-envvar-defined', '') + triggers_mappings = [ + ('skip-when-scm-change', 'skipScmCause', False), + ('skip-when-upstream-build', 'skipUpstreamCause', False), + ('skip-when-envvar-defined', 'envVar', '') + ] + helpers.convert_mapping_to_xml( + triggers, data_triggers, triggers_mappings, fail_required=True) + helpers.config_file_provider_settings(sonar, data) @@ -2967,14 +3110,29 @@ def test_fairy(registry, xml_parent, data): :arg bool notify-testers: Send email with changelogs to testers (default false) :arg bool autoupdate: Automatic update (default false) - :arg str max-duration: Duration of the session (default 10m) + + :max-duration values: + * **10m** + * **60m** + * **300m** + * **1440m** :arg bool record-on-background: Record on background (default false) :arg bool data-only-wifi: Record data only in wifi (default false) :arg bool video-enabled: Record video (default true) - :arg str screenshot-interval: Time interval between screenshots + :arg int screenshot-interval: Time interval between screenshots (default 1) + + :screenshot-interval values: + * **1** + * **2** + * **5** :arg str video-quality: Video quality (default high) + + :video-quality values: + * **high** + * **medium** + * **low** :arg bool cpu: Enable CPU metrics (default true) :arg bool memory: Enable memory metrics (default true) :arg bool logs: Enable logs metrics (default true) @@ -3400,22 +3558,31 @@ def xml_summary(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`Summary Display Plugin <Summary+Display+Plugin>`. - :arg str files: Files to parse (default '') + :arg str files: Files to parse (required) :arg bool shown-on-project-page: Display summary on project page - (default 'false') + (default false) - Example: + Minimal Example: - .. literalinclude:: /../../tests/publishers/fixtures/xml-summary001.yaml + .. literalinclude:: + /../../tests/publishers/fixtures/xml-summary-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/publishers/fixtures/xml-summary-full.yaml :language: yaml """ - summary = XML.SubElement(xml_parent, - 'hudson.plugins.summary__report.' - 'ACIPluginPublisher') - XML.SubElement(summary, 'name').text = data['files'] - XML.SubElement(summary, 'shownOnProjectPage').text = str( - data.get('shown-on-project-page', 'false')) + summary = XML.SubElement( + xml_parent, 'hudson.plugins.summary__report.ACIPluginPublisher') + summary.set('plugin', 'summary_report') + + mapping = [ + ('files', 'name', None), + ('shown-on-project-page', 'shownOnProjectPage', False), + ] + helpers.convert_mapping_to_xml(summary, data, mapping, fail_required=True) def robot(registry, xml_parent, data): @@ -4400,8 +4567,9 @@ def testng(registry, xml_parent, data): reporter = XML.SubElement(xml_parent, 'hudson.plugins.testng.Publisher') reporter.set('plugin', 'testng-plugin') - valid_threshold_modes = ['number', 'percentage'] - threshold_mode = data.get('threshold-mode', 'percentage') + threshold_modes = { + 'number': 1, + 'percentage': 2} mappings = [ ('pattern', 'reportFilenamePattern', None), @@ -4413,18 +4581,11 @@ def testng(registry, xml_parent, data): ('unstable-fails', 'unstableFails', 0), ('failed-skips', 'failedSkips', 100), ('failed-fails', 'failedFails', 100), + ('threshold-mode', 'thresholdMode', 'percentage', threshold_modes) ] helpers.convert_mapping_to_xml( reporter, data, mappings, fail_required=True) - if threshold_mode == 'number': - XML.SubElement(reporter, 'thresholdMode').text = str(1) - elif threshold_mode == 'percentage': - XML.SubElement(reporter, 'thresholdMode').text = str(2) - else: - raise InvalidAttributeError( - 'threshold-mode', threshold_mode, valid_threshold_modes) - def artifact_deployer(registry, xml_parent, data): """yaml: artifact-deployer @@ -5528,16 +5689,9 @@ def disable_failed_job(registry, xml_parent, data): valid_conditions = ['Only Failure', 'Failure and Unstable', 'Only Unstable'] - - try: - disable_condition = str(data['when-to-disable']) - except KeyError as e: - raise MissingAttributeError(e.args[0]) - - if disable_condition not in valid_conditions: - raise InvalidAttributeError('when-to-disable', disable_condition, - valid_conditions) - XML.SubElement(xml_element, 'whenDisable').text = disable_condition + mapping = [('when-to-disable', 'whenDisable', None, valid_conditions)] + helpers.convert_mapping_to_xml( + xml_element, data, mapping, fail_required=True) if 'no-of-failures' in data: XML.SubElement(xml_element, 'failureTimes').text = str(data.get( @@ -6087,20 +6241,16 @@ def hipchat(registry, xml_parent, data): XML.SubElement(hipchat, 'room').text = str( ",".join(data['rooms'])) - XML.SubElement(hipchat, 'startNotification').text = str( - data.get('notify-start', False)).lower() - XML.SubElement(hipchat, 'notifySuccess').text = str( - data.get('notify-success', False)).lower() - XML.SubElement(hipchat, 'notifyAborted').text = str( - data.get('notify-aborted', False)).lower() - XML.SubElement(hipchat, 'notifyNotBuilt').text = str( - data.get('notify-not-built', False)).lower() - XML.SubElement(hipchat, 'notifyUnstable').text = str( - data.get('notify-unstable', False)).lower() - XML.SubElement(hipchat, 'notifyFailure').text = str( - data.get('notify-failure', False)).lower() - XML.SubElement(hipchat, 'notifyBackToNormal').text = str( - data.get('notify-back-to-normal', False)).lower() + mapping = [ + ('notify-start', 'startNotification', False), + ('notify-success', 'notifySuccess', False), + ('notify-aborted', 'notifyAborted', False), + ('notify-not-built', 'notifyNotBuilt', False), + ('notify-unstable', 'notifyUnstable', False), + ('notify-failure', 'notifyFailure', False), + ('notify-back-to-normal', 'notifyBackToNormal', False), + ] + helpers.convert_mapping_to_xml(hipchat, data, mapping, fail_required=True) # optional settings, so only add XML in if set. if 'start-message' in data: diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index d873eb42..0a8b930e 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -596,16 +596,14 @@ def cvs(registry, xml_parent, data): raise InvalidAttributeError('compression-level', compression_level, range(-1, 10)) XML.SubElement(repo_tag, 'compressionLevel').text = compression_level - mapping = [('use-update', 'canUseUpdate', True), - ('prune-empty', 'pruneEmptyDirectories', True), - ('skip-changelog', 'skipChangeLog', False), - ('show-all-output', 'disableCvsQuiet', False), - ('clean-checkout', 'cleanOnFailedUpdate', False), - ('clean-copy', 'forceCleanCopy', False)] - for elem in mapping: - opt, xml_tag, val = elem[:] - XML.SubElement(cvs, xml_tag).text = str( - data.get(opt, val)).lower() + mappings = [ + ('use-update', 'canUseUpdate', True), + ('prune-empty', 'pruneEmptyDirectories', True), + ('skip-changelog', 'skipChangeLog', False), + ('show-all-output', 'disableCvsQuiet', False), + ('clean-checkout', 'cleanOnFailedUpdate', False), + ('clean-copy', 'forceCleanCopy', False)] + convert_mapping_to_xml(cvs, data, mappings, fail_required=True) def repo(registry, xml_parent, data): diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index e8c31799..86167752 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -1346,35 +1346,44 @@ def monitor_folders(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`Filesystem Trigger Plugin <FSTrigger+Plugin>`. - :arg str path: Folder path to poll. (optional) + :arg str path: Folder path to poll. (default '') :arg list includes: Fileset includes setting that specifies the list of includes files. Basedir of the fileset is relative to the workspace - root. If no value is set, all files are used. (optional) + root. If no value is set, all files are used. (default '') :arg str excludes: The 'excludes' pattern. A file that matches this mask will not be polled even if it matches the mask specified in 'includes' - section. (optional) + section. (default '') :arg bool check-modification-date: Check last modification date. (default true) :arg bool check-content: Check content. (default true) - :arg bool check-fewer: Check fewer or more files (default true) + :arg bool check-fewer: Check fewer files (default true) :arg str cron: cron syntax of when to run (default '') - Example: + Full Example: + + .. literalinclude:: + /../../tests/triggers/fixtures/monitor-folders-full.yaml + :language: yaml + + Minimal Example: - .. literalinclude:: /../../tests/triggers/fixtures/monitor_folders.yaml + .. literalinclude:: + /../../tests/triggers/fixtures/monitor-folders-minimal.yaml + :language: yaml """ ft = XML.SubElement(xml_parent, ('org.jenkinsci.plugins.fstrigger.' 'triggers.FolderContentTrigger')) - path = data.get('path') - if path: - XML.SubElement(ft, 'path').text = path - includes = data.get('includes') - if includes: - XML.SubElement(ft, 'includes').text = ",".join(includes) - excludes = data.get('excludes') - if excludes: - XML.SubElement(ft, 'excludes').text = excludes - XML.SubElement(ft, 'spec').text = data.get('cron', '') + ft.set('plugin', 'fstrigger') + + mappings = [ + ('path', 'path', ''), + ('cron', 'spec', ''), + ] + convert_mapping_to_xml(ft, data, mappings, fail_required=True) + + includes = data.get('includes', '') + XML.SubElement(ft, 'includes').text = ",".join(includes) + XML.SubElement(ft, 'excludes').text = data.get('excludes', '') XML.SubElement(ft, 'excludeCheckLastModificationDate').text = str( not data.get('check-modification-date', True)).lower() XML.SubElement(ft, 'excludeCheckContent').text = str( diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 4d114d93..f8c72e63 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -1333,6 +1333,34 @@ def sauce_ondemand(registry, xml_parent, data): XML.SubElement(sauce, 'options').text = options +def sonar(registry, xml_parent, data): + """yaml: sonar + Wrapper for SonarQube Plugin + Requires :jenkins-wiki:`SonarQube plugin <SonarQube+plugin>` + + :arg str install-name: Release goals and options (default '') + + Minimal Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/sonar-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/sonar-full.yaml + :language: yaml + """ + sonar = XML.SubElement( + xml_parent, 'hudson.plugins.sonar.SonarBuildWrapper') + sonar.set('plugin', 'sonar') + + if data.get('install-name'): + mapping = [ + ('install-name', 'installationName', ''), + ] + convert_mapping_to_xml(sonar, data, mapping, fail_required=True) + + def pathignore(registry, xml_parent, data): """yaml: pathignore This plugin allows SCM-triggered jobs to ignore @@ -1870,60 +1898,55 @@ def xvfb(registry, xml_parent, data): Enable xvfb during the build. Requires the Jenkins :jenkins-wiki:`Xvfb Plugin <Xvfb+Plugin>`. - :arg str installation-name: The name of the Xvfb tool instalation - (default default) + :arg str installation-name: The name of the Xvfb tool instalation (default + 'default') :arg bool auto-display-name: Uses the -displayfd option of Xvfb by which it - chooses it's own display name - (default false) + chooses it's own display name (default false) :arg str display-name: Ordinal of the display Xvfb will be running on, if - left empty choosen based on current build executor - number (optional) + left empty choosen based on current build executor number (default '') :arg str assigned-labels: If you want to start Xvfb only on specific nodes - specify its name or label (optional) + specify its name or label (default '') :arg bool parallel-build: When running multiple Jenkins nodes on the same - machine this setting influences the display - number generation (default false) + machine this setting influences the display number generation (default + false) :arg int timeout: A timeout of given seconds to wait before returning - control to the job (default 0) - :arg str screen: Resolution and color depth. (default 1024x768x24) - :arg str display-name-offset: Offset for display names. (default 1) + control to the job (default 0) + :arg str screen: Resolution and color depth. (default '1024x768x24') + :arg int display-name-offset: Offset for display names. (default 1) :arg str additional-options: Additional options to be added with the - options above to the Xvfb command line - (optional) + options above to the Xvfb command line (default '') :arg bool debug: If Xvfb output should appear in console log of this job - (default false) + (default false) :arg bool shutdown-with-build: Should the display be kept until the whole - job ends (default false) + job ends (default false) - Example: + Full Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/xvfb-full.yaml + :language: yaml - .. literalinclude:: /../../tests/wrappers/fixtures/xvfb001.yaml + Minimal Example: + .. literalinclude:: /../../tests/wrappers/fixtures/xvfb-minimal.yaml + :language: yaml """ xwrapper = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.xvfb.XvfbBuildWrapper') - XML.SubElement(xwrapper, 'installationName').text = str(data.get( - 'installation-name', 'default')) - XML.SubElement(xwrapper, 'autoDisplayName').text = str(data.get( - 'auto-display-name', False)).lower() - if 'display-name' in data: - XML.SubElement(xwrapper, 'displayName').text = str(data.get( - 'display-name', '')) - XML.SubElement(xwrapper, 'assignedLabels').text = str(data.get( - 'assigned-labels', '')) - XML.SubElement(xwrapper, 'parallelBuild').text = str(data.get( - 'parallel-build', False)).lower() - XML.SubElement(xwrapper, 'timeout').text = str(data.get('timeout', '0')) - XML.SubElement(xwrapper, 'screen').text = str(data.get( - 'screen', '1024x768x24')) - XML.SubElement(xwrapper, 'displayNameOffset').text = str(data.get( - 'display-name-offset', '1')) - XML.SubElement(xwrapper, 'additionalOptions').text = str(data.get( - 'additional-options', '')) - XML.SubElement(xwrapper, 'debug').text = str(data.get( - 'debug', False)).lower() - XML.SubElement(xwrapper, 'shutdownWithBuild').text = str(data.get( - 'shutdown-with-build', False)).lower() + + mapping = [ + ('installation-name', 'installationName', 'default'), + ('auto-display-name', 'autoDisplayName', False), + ('display-name', 'displayName', ''), + ('assigned-labels', 'assignedLabels', ''), + ('parallel-build', 'parallelBuild', False), + ('timeout', 'timeout', 0), + ('screen', 'screen', '1024x768x24'), + ('display-name-offset', 'displayNameOffset', 1), + ('additional-options', 'additionalOptions', ''), + ('debug', 'debug', False), + ('shutdown-with-build', 'shutdownWithBuild', False), + ] + convert_mapping_to_xml(xwrapper, data, mapping, fail_required=True) def android_emulator(registry, xml_parent, data): @@ -2343,6 +2366,59 @@ def maven_release(registry, xml_parent, data): convert_mapping_to_xml(mvn_release, data, mapping, fail_required=True) +def version_number(parser, xml_parent, data): + """yaml: version-number + Generate a version number for the build using a format string. See the + wiki page for more detailed descriptions of options. + + Requires the Jenkins :jenkins-wiki:`version number plugin + <Version+Number+Plugin>`. + + :arg str variable-name: Name of environment variable to assign version + number to (required) + :arg str format-string: Format string used to generate version number + (required) + :arg bool skip-failed-builds: If the build fails, DO NOT increment any + auto-incrementing component of the version number (default: false) + :arg bool display-name: Use the version number for the build display + name (default: false) + :arg str start-date: The date the project began as a UTC timestamp + (default 1970-1-1 00:00:00.0 UTC) + :arg int builds-today: The number of builds that have been executed + today (optional) + :arg int builds-this-month: The number of builds that have been executed + since the start of the month (optional) + :arg int builds-this-year: The number of builds that have been executed + since the start of the year (optional) + :arg int builds-all-time: The number of builds that have been executed + since the start of the project (optional) + + Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/version-number001.yaml + :language: yaml + + """ + version_number = XML.SubElement( + xml_parent, 'org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder' + ) + + mapping = [ + # option, xml name, default value + ("variable-name", 'environmentVariableName', None), + ("format-string", 'versionNumberString', None), + ("skip-failed-builds", 'skipFailedBuilds', False), + ("display-name", 'useAsBuildDisplayName', False), + ("start-date", 'projectStartDate', '1970-1-1 00:00:00.0 UTC'), + ("builds-today", 'oBuildsToday', '-1'), + ("builds-this-month", 'oBuildsThisMonth', '-1'), + ("builds-this-year", 'oBuildsThisYear', '-1'), + ("builds-all-time", 'oBuildsAllTime', '-1'), + ] + + convert_mapping_to_xml(version_number, data, mapping, fail_required=True) + + class Wrappers(jenkins_jobs.modules.base.Base): sequence = 80 diff --git a/requirements.txt b/requirements.txt index 0be6b339..e5ffa4b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ six>=1.5.2 PyYAML python-jenkins>=0.4.8 pbr>=1.0.0,<2.0 -stevedore==1.8.0 +stevedore>=1.8.0 diff --git a/tests/builders/fixtures/grails.xml b/tests/builders/fixtures/grails-full.xml index e209aff6..d558d789 100644 --- a/tests/builders/fixtures/grails.xml +++ b/tests/builders/fixtures/grails-full.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <builders> - <com.g2one.hudson.grails.GrailsBuilder> + <com.g2one.hudson.grails.GrailsBuilder plugin="grails"> <targets>war ear</targets> <name>grails-2.2.2</name> <grailsWorkDir>./grails-work</grailsWorkDir> diff --git a/tests/builders/fixtures/grails-full.yaml b/tests/builders/fixtures/grails-full.yaml new file mode 100644 index 00000000..0b7ef8d9 --- /dev/null +++ b/tests/builders/fixtures/grails-full.yaml @@ -0,0 +1,16 @@ +builders: + - grails: + use-wrapper: true + name: grails-2.2.2 + force-upgrade: true + non-interactive: true + targets: war ear + server-port: 8003 + work-dir: ./grails-work + project-dir: ./project-work + base-dir: ./grails/project + properties: program.name=foo + plain-output: true + stack-trace: true + verbose: true + refresh-dependencies: true diff --git a/tests/builders/fixtures/grails-minimal.xml b/tests/builders/fixtures/grails-minimal.xml new file mode 100644 index 00000000..cc419825 --- /dev/null +++ b/tests/builders/fixtures/grails-minimal.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <builders> + <com.g2one.hudson.grails.GrailsBuilder plugin="grails"> + <targets>foo</targets> + <name>(Default)</name> + <grailsWorkDir/> + <projectWorkDir/> + <projectBaseDir/> + <serverPort/> + <properties/> + <forceUpgrade>false</forceUpgrade> + <nonInteractive>false</nonInteractive> + <useWrapper>false</useWrapper> + <plainOutput>false</plainOutput> + <stackTrace>false</stackTrace> + <verbose>false</verbose> + <refreshDependencies>false</refreshDependencies> + </com.g2one.hudson.grails.GrailsBuilder> + </builders> +</project> diff --git a/tests/builders/fixtures/grails-minimal.yaml b/tests/builders/fixtures/grails-minimal.yaml new file mode 100644 index 00000000..9d888b94 --- /dev/null +++ b/tests/builders/fixtures/grails-minimal.yaml @@ -0,0 +1,3 @@ +builders: + - grails: + targets: foo diff --git a/tests/builders/fixtures/grails.yaml b/tests/builders/fixtures/grails.yaml deleted file mode 100644 index 8cd9be08..00000000 --- a/tests/builders/fixtures/grails.yaml +++ /dev/null @@ -1,16 +0,0 @@ -builders: - - grails: - use-wrapper: "true" - name: "grails-2.2.2" - force-upgrade: "true" - non-interactive: "true" - targets: "war ear" - server-port: "8003" - work-dir: "./grails-work" - project-dir: "./project-work" - base-dir: "./grails/project" - properties: "program.name=foo" - plain-output: "true" - stack-trace: "true" - verbose: "true" - refresh-dependencies: "true" diff --git a/tests/builders/fixtures/nexus_artifact_uploader001.xml b/tests/builders/fixtures/nexus_artifact_uploader001.xml new file mode 100644 index 00000000..78e27a10 --- /dev/null +++ b/tests/builders/fixtures/nexus_artifact_uploader001.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <builders> + <sp.sd.nexusartifactuploader.NexusArtifactUploader> + <protocol>https</protocol> + <nexusUrl>nexus.org</nexusUrl> + <nexusUser/> + <nexusPassword/> + <groupId>com.example</groupId> + <artifactId>artifact</artifactId> + <version>1.0</version> + <packaging>pom</packaging> + <type>zip</type> + <classifier/> + <repository>my-hosted-repo</repository> + <file>/var/lib/jenkins/workspace/my_job/result.zip</file> + <credentialsId/> + </sp.sd.nexusartifactuploader.NexusArtifactUploader> + </builders> +</project> diff --git a/tests/builders/fixtures/nexus_artifact_uploader001.yaml b/tests/builders/fixtures/nexus_artifact_uploader001.yaml new file mode 100644 index 00000000..0b88249e --- /dev/null +++ b/tests/builders/fixtures/nexus_artifact_uploader001.yaml @@ -0,0 +1,10 @@ +builders: + - nexus-artifact-uploader: + nexus_url: 'nexus.org' + group_id: 'com.example' + artifact_id: 'artifact' + version: '1.0' + packaging: 'pom' + type: 'zip' + repository: 'my-hosted-repo' + file: '/var/lib/jenkins/workspace/my_job/result.zip' diff --git a/tests/cmd/subcommands/test_update.py b/tests/cmd/subcommands/test_update.py index 5fbd4aa3..86d502cb 100644 --- a/tests/cmd/subcommands/test_update.py +++ b/tests/cmd/subcommands/test_update.py @@ -92,26 +92,29 @@ class UpdateTests(CmdTestsBase): * mock out a call to jenkins.Jenkins.job_exists() to always return True. """ - jobs = ['old_job001', 'old_job002', 'unmanaged'] - extra_jobs = [{'name': name} for name in jobs] + yaml_jobs = ['bar001', 'bar002', 'baz001', 'bam001'] + extra_jobs = ['old_job001', 'old_job002', 'unmanaged'] path = os.path.join(self.fixtures_path, 'cmd-002.yaml') args = ['--conf', self.default_config_file, 'update', '--delete-old', path] - jenkins_get_jobs.return_value = extra_jobs + jenkins_get_jobs.return_value = [{'name': name} + for name in yaml_jobs + extra_jobs] with mock.patch('jenkins_jobs.builder.JenkinsManager.is_managed', side_effect=(lambda name: name != 'unmanaged')): self.execute_jenkins_jobs_with_args(args) jenkins_reconfig_job.assert_has_calls( - [mock.call(job_name, mock.ANY) - for job_name in ['bar001', 'bar002', 'baz001', 'bam001']], + [mock.call(job_name, mock.ANY) for job_name in yaml_jobs], any_order=True ) - jenkins_delete_job.assert_has_calls( - [mock.call(name) for name in jobs if name != 'unmanaged']) + calls = [mock.call(name) for name in extra_jobs if name != 'unmanaged'] + jenkins_delete_job.assert_has_calls(calls) + # to ensure only the calls we expected were made, have to check + # there were no others, as no API call for assert_has_only_calls + self.assertEquals(jenkins_delete_job.call_count, len(calls)) def test_update_timeout_not_set(self): """Validate update timeout behavior when timeout not explicitly configured. diff --git a/tests/properties/fixtures/gitbucket-full.xml b/tests/properties/fixtures/gitbucket-full.xml new file mode 100644 index 00000000..92c42603 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-full.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <properties> + <org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty plugin="gitbucket"> + <url>https://foo.com</url> + <linkEnabled>true</linkEnabled> + </org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty> + </properties> +</project> diff --git a/tests/properties/fixtures/gitbucket-full.yaml b/tests/properties/fixtures/gitbucket-full.yaml new file mode 100644 index 00000000..d6511ec8 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-full.yaml @@ -0,0 +1,4 @@ +properties: + - gitbucket: + url: https://foo.com + link-enabled: true diff --git a/tests/properties/fixtures/gitbucket-minimal.xml b/tests/properties/fixtures/gitbucket-minimal.xml new file mode 100644 index 00000000..00affa4b --- /dev/null +++ b/tests/properties/fixtures/gitbucket-minimal.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <properties> + <org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty plugin="gitbucket"> + <url>https://foo.com</url> + <linkEnabled>false</linkEnabled> + </org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty> + </properties> +</project> diff --git a/tests/properties/fixtures/gitbucket-minimal.yaml b/tests/properties/fixtures/gitbucket-minimal.yaml new file mode 100644 index 00000000..52d7e9e8 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-minimal.yaml @@ -0,0 +1,3 @@ +properties: + - gitbucket: + url: https://foo.com diff --git a/tests/properties/fixtures/github-full.xml b/tests/properties/fixtures/github-full.xml new file mode 100644 index 00000000..4b93ed33 --- /dev/null +++ b/tests/properties/fixtures/github-full.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <properties> + <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github"> + <projectUrl>https://github.com/openstack-infra/jenkins-job-builder/</projectUrl> + <displayName>foo</displayName> + </com.coravy.hudson.plugins.github.GithubProjectProperty> + </properties> +</project> diff --git a/tests/properties/fixtures/github-full.yaml b/tests/properties/fixtures/github-full.yaml new file mode 100644 index 00000000..af05a175 --- /dev/null +++ b/tests/properties/fixtures/github-full.yaml @@ -0,0 +1,4 @@ +properties: + - github: + url: https://github.com/openstack-infra/jenkins-job-builder/ + display-name: foo diff --git a/tests/properties/fixtures/github.xml b/tests/properties/fixtures/github-minimal.xml index 08413fe3..35c98f51 100644 --- a/tests/properties/fixtures/github.xml +++ b/tests/properties/fixtures/github-minimal.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <project> <properties> - <com.coravy.hudson.plugins.github.GithubProjectProperty> + <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github"> <projectUrl>https://github.com/openstack-infra/jenkins-job-builder/</projectUrl> + <displayName/> </com.coravy.hudson.plugins.github.GithubProjectProperty> </properties> </project> diff --git a/tests/properties/fixtures/github.yaml b/tests/properties/fixtures/github-minimal.yaml index 8aceba64..8aceba64 100644 --- a/tests/properties/fixtures/github.yaml +++ b/tests/properties/fixtures/github-minimal.yaml diff --git a/tests/properties/fixtures/rebuild.xml b/tests/properties/fixtures/rebuild-full.xml index 87111ddc..00be5bab 100644 --- a/tests/properties/fixtures/rebuild.xml +++ b/tests/properties/fixtures/rebuild-full.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <properties> - <com.sonyericsson.rebuild.RebuildSettings> + <com.sonyericsson.rebuild.RebuildSettings plugin="rebuild"> <autoRebuild>true</autoRebuild> <rebuildDisabled>true</rebuildDisabled> </com.sonyericsson.rebuild.RebuildSettings> diff --git a/tests/properties/fixtures/rebuild.yaml b/tests/properties/fixtures/rebuild-full.yaml index 0f22fbf4..0f22fbf4 100644 --- a/tests/properties/fixtures/rebuild.yaml +++ b/tests/properties/fixtures/rebuild-full.yaml diff --git a/tests/properties/fixtures/rebuild-minimal.xml b/tests/properties/fixtures/rebuild-minimal.xml new file mode 100644 index 00000000..e280a20e --- /dev/null +++ b/tests/properties/fixtures/rebuild-minimal.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <properties> + <com.sonyericsson.rebuild.RebuildSettings plugin="rebuild"> + <autoRebuild>false</autoRebuild> + <rebuildDisabled>false</rebuildDisabled> + </com.sonyericsson.rebuild.RebuildSettings> + </properties> +</project> diff --git a/tests/properties/fixtures/rebuild-minimal.yaml b/tests/properties/fixtures/rebuild-minimal.yaml new file mode 100644 index 00000000..935c0251 --- /dev/null +++ b/tests/properties/fixtures/rebuild-minimal.yaml @@ -0,0 +1,2 @@ +properties: + - rebuild diff --git a/tests/publishers/fixtures/checkstyle001.xml b/tests/publishers/fixtures/checkstyle001.xml index 4c9a5f31..0a57877a 100644 --- a/tests/publishers/fixtures/checkstyle001.xml +++ b/tests/publishers/fixtures/checkstyle001.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy>0</healthy> <unHealthy>100</unHealthy> <thresholdLimit>high</thresholdLimit> diff --git a/tests/publishers/fixtures/checkstyle002.xml b/tests/publishers/fixtures/checkstyle002.xml index 7e944ece..10b1a725 100644 --- a/tests/publishers/fixtures/checkstyle002.xml +++ b/tests/publishers/fixtures/checkstyle002.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy>0</healthy> <unHealthy>100</unHealthy> <thresholdLimit>high</thresholdLimit> diff --git a/tests/publishers/fixtures/checkstyle003.xml b/tests/publishers/fixtures/checkstyle003.xml index d3248b3c..d546047d 100644 --- a/tests/publishers/fixtures/checkstyle003.xml +++ b/tests/publishers/fixtures/checkstyle003.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy/> <unHealthy/> <thresholdLimit>low</thresholdLimit> diff --git a/tests/publishers/fixtures/checkstyle004.xml b/tests/publishers/fixtures/checkstyle004.xml index 4c9a5f31..0a57877a 100644 --- a/tests/publishers/fixtures/checkstyle004.xml +++ b/tests/publishers/fixtures/checkstyle004.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy>0</healthy> <unHealthy>100</unHealthy> <thresholdLimit>high</thresholdLimit> diff --git a/tests/publishers/fixtures/checkstyle005.xml b/tests/publishers/fixtures/checkstyle005.xml index 7e944ece..10b1a725 100644 --- a/tests/publishers/fixtures/checkstyle005.xml +++ b/tests/publishers/fixtures/checkstyle005.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy>0</healthy> <unHealthy>100</unHealthy> <thresholdLimit>high</thresholdLimit> diff --git a/tests/publishers/fixtures/checkstyle006.xml b/tests/publishers/fixtures/checkstyle006.xml index 5ead1f99..88d807d7 100644 --- a/tests/publishers/fixtures/checkstyle006.xml +++ b/tests/publishers/fixtures/checkstyle006.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.checkstyle.CheckStylePublisher> + <hudson.plugins.checkstyle.CheckStylePublisher plugin="checkstyle"> <healthy>0</healthy> <unHealthy>100</unHealthy> <thresholdLimit>high</thresholdLimit> diff --git a/tests/publishers/fixtures/conditional-publisher002.xml b/tests/publishers/fixtures/conditional-publisher002.xml index 99e04662..006c5e81 100644 --- a/tests/publishers/fixtures/conditional-publisher002.xml +++ b/tests/publishers/fixtures/conditional-publisher002.xml @@ -8,9 +8,10 @@ <command>ls file*</command> </condition> <runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$DontRun"/> - <publisher class="com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier"> + <publisher class="com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier" plugin="copy-to-slave"> <includes>file1,file2*.txt</includes> <excludes>file2bad.txt</excludes> + <runAfterResultFinalised>true</runAfterResultFinalised> <destinationFolder/> </publisher> </org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher> @@ -24,4 +25,4 @@ </publishers> </org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher> </publishers> -</project>
\ No newline at end of file +</project> diff --git a/tests/publishers/fixtures/copy-to-master001.xml b/tests/publishers/fixtures/copy-to-master001.xml index 1eef0632..18864a5d 100644 --- a/tests/publishers/fixtures/copy-to-master001.xml +++ b/tests/publishers/fixtures/copy-to-master001.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier> + <com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier plugin="copy-to-slave"> <includes>file1,file2*.txt</includes> <excludes>file2bad.txt</excludes> + <runAfterResultFinalised>true</runAfterResultFinalised> <destinationFolder/> </com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier> </publishers> diff --git a/tests/publishers/fixtures/cppcheck-complete.xml b/tests/publishers/fixtures/cppcheck-complete.xml new file mode 100644 index 00000000..9932d1d4 --- /dev/null +++ b/tests/publishers/fixtures/cppcheck-complete.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <org.jenkinsci.plugins.cppcheck.CppcheckPublisher plugin="cppcheck"> + <cppcheckConfig> + <pattern>**/cppcheck.xml</pattern> + <ignoreBlankFiles>true</ignoreBlankFiles> + <allowNoReport>true</allowNoReport> + <configSeverityEvaluation> + <threshold>5</threshold> + <newThreshold>5</newThreshold> + <failureThreshold>7</failureThreshold> + <newFailureThreshold>3</newFailureThreshold> + <healthy>5</healthy> + <unHealthy>10</unHealthy> + <severityError>false</severityError> + <severityWarning>false</severityWarning> + <severityStyle>false</severityStyle> + <severityPerformance>false</severityPerformance> + <severityInformation>false</severityInformation> + <severityNoCategory>false</severityNoCategory> + <severityPortability>false</severityPortability> + </configSeverityEvaluation> + <configGraph> + <xSize>600</xSize> + <ySize>300</ySize> + <numBuildsInGraph>10</numBuildsInGraph> + <displayAllErrors>false</displayAllErrors> + <displayErrorSeverity>true</displayErrorSeverity> + <displayWarningSeverity>true</displayWarningSeverity> + <displayStyleSeverity>true</displayStyleSeverity> + <displayPerformanceSeverity>true</displayPerformanceSeverity> + <displayInformationSeverity>true</displayInformationSeverity> + <displayNoCategorySeverity>true</displayNoCategorySeverity> + <displayPortabilitySeverity>true</displayPortabilitySeverity> + </configGraph> + </cppcheckConfig> + </org.jenkinsci.plugins.cppcheck.CppcheckPublisher> + </publishers> +</project> diff --git a/tests/publishers/fixtures/cppcheck001.yaml b/tests/publishers/fixtures/cppcheck-complete.yaml index 34408a7b..b18ba5a3 100644 --- a/tests/publishers/fixtures/cppcheck001.yaml +++ b/tests/publishers/fixtures/cppcheck-complete.yaml @@ -2,20 +2,35 @@ publishers: - cppcheck: pattern: "**/cppcheck.xml" # the rest is optional + ignoreblankfiles: true + allow-no-report: true # build status (new) error count thresholds thresholds: unstable: 5 new-unstable: 5 failure: 7 new-failure: 3 + healthy: 5 + unhealthy: 10 # severities which count towards the threshold, default all true severity: - error: true - warning: true + error: false + warning: false + style: false + performance: false information: false + nocategory: false + portability: false graph: - xysize: [500, 200] + xysize: [600, 300] + num-builds-in-graph: 10 # which errors to display, default only sum display: sum: false error: true + warning: true + style: true + performance: true + information: true + nocategory: true + portability: true diff --git a/tests/publishers/fixtures/cppcheck001.xml b/tests/publishers/fixtures/cppcheck-minimal.xml index 65b31032..ff5084b6 100644 --- a/tests/publishers/fixtures/cppcheck001.xml +++ b/tests/publishers/fixtures/cppcheck-minimal.xml @@ -1,32 +1,38 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <org.jenkinsci.plugins.cppcheck.CppcheckPublisher> + <org.jenkinsci.plugins.cppcheck.CppcheckPublisher plugin="cppcheck"> <cppcheckConfig> <pattern>**/cppcheck.xml</pattern> <ignoreBlankFiles>false</ignoreBlankFiles> + <allowNoReport>false</allowNoReport> <configSeverityEvaluation> - <threshold>5</threshold> - <newThreshold>5</newThreshold> - <failureThreshold>7</failureThreshold> - <newFailureThreshold>3</newFailureThreshold> + <threshold/> + <newThreshold/> + <failureThreshold/> + <newFailureThreshold/> <healthy/> <unHealthy/> <severityError>true</severityError> <severityWarning>true</severityWarning> <severityStyle>true</severityStyle> <severityPerformance>true</severityPerformance> - <severityInformation>false</severityInformation> + <severityInformation>true</severityInformation> + <severityNoCategory>true</severityNoCategory> + <severityPortability>true</severityPortability> </configSeverityEvaluation> <configGraph> <xSize>500</xSize> <ySize>200</ySize> - <displayAllErrors>false</displayAllErrors> - <displayErrorSeverity>true</displayErrorSeverity> + <numBuildsInGraph>0</numBuildsInGraph> + <displayAllErrors>true</displayAllErrors> + <displayErrorSeverity>false</displayErrorSeverity> <displayWarningSeverity>false</displayWarningSeverity> <displayStyleSeverity>false</displayStyleSeverity> <displayPerformanceSeverity>false</displayPerformanceSeverity> <displayInformationSeverity>false</displayInformationSeverity> + <displayNoCategorySeverity>false</displayNoCategorySeverity> + <displayPortabilitySeverity>false</displayPortabilitySeverity> </configGraph> </cppcheckConfig> </org.jenkinsci.plugins.cppcheck.CppcheckPublisher> diff --git a/tests/publishers/fixtures/cppcheck-minimal.yaml b/tests/publishers/fixtures/cppcheck-minimal.yaml new file mode 100644 index 00000000..b7482813 --- /dev/null +++ b/tests/publishers/fixtures/cppcheck-minimal.yaml @@ -0,0 +1,3 @@ +publishers: + - cppcheck: + pattern: "**/cppcheck.xml" diff --git a/tests/publishers/fixtures/cucumber_testresult.xml b/tests/publishers/fixtures/cucumber-testresult-complete.xml index 5d2331fb..6f44beaa 100644 --- a/tests/publishers/fixtures/cucumber_testresult.xml +++ b/tests/publishers/fixtures/cucumber-testresult-complete.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver> + <org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver plugin="cucumber-testresult-plugin"> <testResults>nosetests.xml</testResults> + <ignoreBadSteps>true</ignoreBadSteps> </org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver> </publishers> </project> diff --git a/tests/publishers/fixtures/cucumber-testresult-complete.yaml b/tests/publishers/fixtures/cucumber-testresult-complete.yaml new file mode 100644 index 00000000..6a00d02b --- /dev/null +++ b/tests/publishers/fixtures/cucumber-testresult-complete.yaml @@ -0,0 +1,4 @@ +publishers: +- cucumber-testresult: + results: nosetests.xml + ignore-bad-steps: true diff --git a/tests/publishers/fixtures/cucumber-testresult-minimal.xml b/tests/publishers/fixtures/cucumber-testresult-minimal.xml new file mode 100644 index 00000000..8992e977 --- /dev/null +++ b/tests/publishers/fixtures/cucumber-testresult-minimal.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver plugin="cucumber-testresult-plugin"> + <testResults>nosetests.xml</testResults> + <ignoreBadSteps>false</ignoreBadSteps> + </org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver> + </publishers> +</project> diff --git a/tests/publishers/fixtures/cucumber_testresult.yaml b/tests/publishers/fixtures/cucumber-testresult-minimal.yaml index d37daf31..d37daf31 100644 --- a/tests/publishers/fixtures/cucumber_testresult.yaml +++ b/tests/publishers/fixtures/cucumber-testresult-minimal.yaml diff --git a/tests/publishers/fixtures/email-complete.xml b/tests/publishers/fixtures/email-complete.xml index 7c7447af..5f9d33ea 100644 --- a/tests/publishers/fixtures/email-complete.xml +++ b/tests/publishers/fixtures/email-complete.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>foo@example.com bar@example.com</recipients> <dontNotifyEveryUnstableBuild>true</dontNotifyEveryUnstableBuild> <sendToIndividuals>true</sendToIndividuals> diff --git a/tests/publishers/fixtures/email-minimal.xml b/tests/publishers/fixtures/email-minimal.xml index aedd0c77..7dfa3646 100644 --- a/tests/publishers/fixtures/email-minimal.xml +++ b/tests/publishers/fixtures/email-minimal.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>foo@example.com</recipients> <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild> <sendToIndividuals>false</sendToIndividuals> diff --git a/tests/publishers/fixtures/ftp-publisher-full.xml b/tests/publishers/fixtures/ftp-publisher-full.xml new file mode 100644 index 00000000..e85e8afa --- /dev/null +++ b/tests/publishers/fixtures/ftp-publisher-full.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <com.zanox.hudson.plugins.FTPPublisher plugin="ftppublisher"> + <entries> + <com.zanox.hudson.plugins.Entry> + <filePath>destination/folder</filePath> + <sourceFile>folder/dist/*.jar</sourceFile> + </com.zanox.hudson.plugins.Entry> + <com.zanox.hudson.plugins.Entry> + <filePath>foo/bar</filePath> + <sourceFile>foo/bar/*.ear</sourceFile> + </com.zanox.hudson.plugins.Entry> + </entries> + <siteName>foo</siteName> + <useTimestamps>true</useTimestamps> + <flatten>true</flatten> + <skip>true</skip> + </com.zanox.hudson.plugins.FTPPublisher> + </publishers> +</project> diff --git a/tests/publishers/fixtures/ftp-publisher-full.yaml b/tests/publishers/fixtures/ftp-publisher-full.yaml new file mode 100644 index 00000000..44b19413 --- /dev/null +++ b/tests/publishers/fixtures/ftp-publisher-full.yaml @@ -0,0 +1,11 @@ +publishers: + - ftp-publisher: + uploads: + - file-path: destination/folder + source-file: folder/dist/*.jar + - file-path: foo/bar + source-file: foo/bar/*.ear + site-name: foo + use-timestamps: true + flatten-files: true + skip-publishing: true diff --git a/tests/publishers/fixtures/ftp-publisher-minimal.xml b/tests/publishers/fixtures/ftp-publisher-minimal.xml new file mode 100644 index 00000000..ab736f8f --- /dev/null +++ b/tests/publishers/fixtures/ftp-publisher-minimal.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <com.zanox.hudson.plugins.FTPPublisher plugin="ftppublisher"> + <entries/> + <siteName>foo</siteName> + <useTimestamps>false</useTimestamps> + <flatten>false</flatten> + <skip>false</skip> + </com.zanox.hudson.plugins.FTPPublisher> + </publishers> +</project> diff --git a/tests/publishers/fixtures/ftp-publisher-minimal.yaml b/tests/publishers/fixtures/ftp-publisher-minimal.yaml new file mode 100644 index 00000000..76b31cee --- /dev/null +++ b/tests/publishers/fixtures/ftp-publisher-minimal.yaml @@ -0,0 +1,3 @@ +publishers: + - ftp-publisher: + site-name: foo diff --git a/tests/publishers/fixtures/scp001.xml b/tests/publishers/fixtures/scp001.xml index fafa32f6..4c4d75ef 100644 --- a/tests/publishers/fixtures/scp001.xml +++ b/tests/publishers/fixtures/scp001.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <be.certipost.hudson.plugin.SCPRepositoryPublisher> + <be.certipost.hudson.plugin.SCPRepositoryPublisher plugin="scp"> <siteName>example.com</siteName> <entries> <be.certipost.hudson.plugin.Entry> diff --git a/tests/publishers/fixtures/sonar002.xml b/tests/publishers/fixtures/sonar-complete.xml index bd2718b3..830adda4 100644 --- a/tests/publishers/fixtures/sonar002.xml +++ b/tests/publishers/fixtures/sonar-complete.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.sonar.SonarPublisher> + <hudson.plugins.sonar.SonarPublisher plugin="sonar"> <jdk>MyJdk</jdk> <branch>myBranch</branch> <language>java</language> @@ -22,4 +22,4 @@ </globalSettings> </hudson.plugins.sonar.SonarPublisher> </publishers> -</project>
\ No newline at end of file +</project> diff --git a/tests/publishers/fixtures/sonar002.yaml b/tests/publishers/fixtures/sonar-complete.yaml index 0aa1b45b..0aa1b45b 100644 --- a/tests/publishers/fixtures/sonar002.yaml +++ b/tests/publishers/fixtures/sonar-complete.yaml diff --git a/tests/publishers/fixtures/sonar-minimal.xml b/tests/publishers/fixtures/sonar-minimal.xml new file mode 100644 index 00000000..f03d4247 --- /dev/null +++ b/tests/publishers/fixtures/sonar-minimal.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <hudson.plugins.sonar.SonarPublisher plugin="sonar"> + <branch/> + <language/> + <rootPom>pom.xml</rootPom> + <usePrivateRepository>false</usePrivateRepository> + <mavenOpts/> + <jobAdditionalProperties/> + <settings class="jenkins.mvn.DefaultSettingsProvider"/> + <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/> + </hudson.plugins.sonar.SonarPublisher> + </publishers> +</project> diff --git a/tests/publishers/fixtures/sonar-minimal.yaml b/tests/publishers/fixtures/sonar-minimal.yaml new file mode 100644 index 00000000..82ac9eea --- /dev/null +++ b/tests/publishers/fixtures/sonar-minimal.yaml @@ -0,0 +1,2 @@ +publishers: + - sonar diff --git a/tests/publishers/fixtures/sonar001.xml b/tests/publishers/fixtures/sonar001.xml deleted file mode 100644 index d08ef9e5..00000000 --- a/tests/publishers/fixtures/sonar001.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<project> - <publishers> - <hudson.plugins.sonar.SonarPublisher> - <jdk>MyJdk</jdk> - <branch>myBranch</branch> - <language>java</language> - <rootPom>pom.xml</rootPom> - <usePrivateRepository>false</usePrivateRepository> - <mavenOpts>-DskipTests</mavenOpts> - <jobAdditionalProperties>-DsonarHostURL=http://example.com/</jobAdditionalProperties> - <triggers> - <skipScmCause>true</skipScmCause> - <skipUpstreamCause>true</skipUpstreamCause> - <envVar>SKIP_SONAR</envVar> - </triggers> - <settings class="jenkins.mvn.DefaultSettingsProvider"/> - <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/> - </hudson.plugins.sonar.SonarPublisher> - </publishers> -</project> diff --git a/tests/publishers/fixtures/sonar001.yaml b/tests/publishers/fixtures/sonar001.yaml deleted file mode 100644 index f5942def..00000000 --- a/tests/publishers/fixtures/sonar001.yaml +++ /dev/null @@ -1,11 +0,0 @@ -publishers: - - sonar: - jdk: MyJdk - branch: myBranch - language: java - maven-opts: -DskipTests - additional-properties: -DsonarHostURL=http://example.com/ - skip-global-triggers: - skip-when-scm-change: true - skip-when-upstream-build: true - skip-when-envvar-defined: SKIP_SONAR diff --git a/tests/publishers/fixtures/test-fairy-android002.xml b/tests/publishers/fixtures/test-fairy-android002.xml index 964f1075..23d53b2e 100644 --- a/tests/publishers/fixtures/test-fairy-android002.xml +++ b/tests/publishers/fixtures/test-fairy-android002.xml @@ -7,12 +7,12 @@ <testersGroups/> <notifyTesters>false</notifyTesters> <autoUpdate>false</autoUpdate> - <maxDuration>10m</maxDuration> + <maxDuration>300m</maxDuration> <recordOnBackground>false</recordOnBackground> <dataOnlyWifi>false</dataOnlyWifi> <isVideoEnabled>true</isVideoEnabled> - <screenshotInterval>1</screenshotInterval> - <videoQuality>high</videoQuality> + <screenshotInterval>2</screenshotInterval> + <videoQuality>low</videoQuality> <cpu>false</cpu> <memory>false</memory> <logs>false</logs> diff --git a/tests/publishers/fixtures/test-fairy-android002.yaml b/tests/publishers/fixtures/test-fairy-android002.yaml index 7186dc54..823054e3 100644 --- a/tests/publishers/fixtures/test-fairy-android002.yaml +++ b/tests/publishers/fixtures/test-fairy-android002.yaml @@ -6,6 +6,9 @@ publishers: keystorepath: /tmp/keystorefile notify-testers: false autoupdate: false + max-duration: 300m + screenshot-interval: 2 + video-quality: low cpu: false memory: false logs: false diff --git a/tests/publishers/fixtures/test-fairy-ios002.xml b/tests/publishers/fixtures/test-fairy-ios002.xml index d8e07e2b..e6f92ea0 100644 --- a/tests/publishers/fixtures/test-fairy-ios002.xml +++ b/tests/publishers/fixtures/test-fairy-ios002.xml @@ -7,12 +7,12 @@ <testersGroups/> <notifyTesters>false</notifyTesters> <autoUpdate>false</autoUpdate> - <maxDuration>10m</maxDuration> + <maxDuration>1440m</maxDuration> <recordOnBackground>false</recordOnBackground> <dataOnlyWifi>false</dataOnlyWifi> <isVideoEnabled>true</isVideoEnabled> - <screenshotInterval>1</screenshotInterval> - <videoQuality>high</videoQuality> + <screenshotInterval>5</screenshotInterval> + <videoQuality>medium</videoQuality> <cpu>false</cpu> <memory>false</memory> <logs>false</logs> @@ -26,4 +26,4 @@ <mappingFile/> </org.jenkinsci.plugins.testfairy.TestFairyIosRecorder> </publishers> -</project>
\ No newline at end of file +</project> diff --git a/tests/publishers/fixtures/test-fairy-ios002.yaml b/tests/publishers/fixtures/test-fairy-ios002.yaml index 55eac366..7e81f1e1 100644 --- a/tests/publishers/fixtures/test-fairy-ios002.yaml +++ b/tests/publishers/fixtures/test-fairy-ios002.yaml @@ -5,6 +5,9 @@ publishers: appfile: /tmp/appfile.ipa notify-testers: false autoupdate: false + max-duration: 1440m + screenshot-interval: 5 + video-quality: medium cpu: false memory: false logs: false diff --git a/tests/publishers/fixtures/xml-summary002.xml b/tests/publishers/fixtures/xml-summary-full.xml index 11443ab4..3ec8101a 100644 --- a/tests/publishers/fixtures/xml-summary002.xml +++ b/tests/publishers/fixtures/xml-summary-full.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.summary__report.ACIPluginPublisher> + <hudson.plugins.summary__report.ACIPluginPublisher plugin="summary_report"> <name>*_summary_report.xml</name> <shownOnProjectPage>true</shownOnProjectPage> </hudson.plugins.summary__report.ACIPluginPublisher> diff --git a/tests/publishers/fixtures/xml-summary002.yaml b/tests/publishers/fixtures/xml-summary-full.yaml index 2a69d64e..499f7aa6 100644 --- a/tests/publishers/fixtures/xml-summary002.yaml +++ b/tests/publishers/fixtures/xml-summary-full.yaml @@ -1,4 +1,4 @@ publishers: - xml-summary: files: '*_summary_report.xml' - shown-on-project-page: 'true' + shown-on-project-page: true diff --git a/tests/publishers/fixtures/xml-summary001.xml b/tests/publishers/fixtures/xml-summary-minimal.xml index 52831224..a4a3e0e9 100644 --- a/tests/publishers/fixtures/xml-summary001.xml +++ b/tests/publishers/fixtures/xml-summary-minimal.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <hudson.plugins.summary__report.ACIPluginPublisher> + <hudson.plugins.summary__report.ACIPluginPublisher plugin="summary_report"> <name>*_summary_report.xml</name> <shownOnProjectPage>false</shownOnProjectPage> </hudson.plugins.summary__report.ACIPluginPublisher> diff --git a/tests/publishers/fixtures/xml-summary001.yaml b/tests/publishers/fixtures/xml-summary-minimal.yaml index 6205df44..6205df44 100644 --- a/tests/publishers/fixtures/xml-summary001.yaml +++ b/tests/publishers/fixtures/xml-summary-minimal.yaml diff --git a/tests/publishers/fixtures/xunit001.xml b/tests/publishers/fixtures/xunit001.xml index 1999e127..f6409ab7 100644 --- a/tests/publishers/fixtures/xunit001.xml +++ b/tests/publishers/fixtures/xunit001.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <xunit> + <xunit plugin="xunit"> <types> <PHPUnitJunitHudsonTestType> <pattern>junit.log</pattern> diff --git a/tests/publishers/fixtures/xunit002.xml b/tests/publishers/fixtures/xunit002.xml index 3b648b94..a770202d 100644 --- a/tests/publishers/fixtures/xunit002.xml +++ b/tests/publishers/fixtures/xunit002.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <xunit> + <xunit plugin="xunit"> <types> <CTestType> <pattern>build/tests/reports/ctest.xml</pattern> diff --git a/tests/publishers/fixtures/xunit003.xml b/tests/publishers/fixtures/xunit003.xml index f214c7c3..21ad8de1 100644 --- a/tests/publishers/fixtures/xunit003.xml +++ b/tests/publishers/fixtures/xunit003.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <project> <publishers> - <xunit> + <xunit plugin="xunit"> <types> <PHPUnitJunitHudsonTestType> <pattern>junit.log</pattern> diff --git a/tests/triggers/fixtures/monitor_folders.xml b/tests/triggers/fixtures/monitor-folders-full.xml index f7da2b88..399ceebf 100644 --- a/tests/triggers/fixtures/monitor_folders.xml +++ b/tests/triggers/fixtures/monitor-folders-full.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <project> <triggers class="vector"> - <org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger> + <org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger plugin="fstrigger"> <path>pathname</path> + <spec>H/15 * * * *</spec> <includes>pattern1,pattern2</includes> <excludes>pattern1</excludes> - <spec>H/15 * * * *</spec> <excludeCheckLastModificationDate>true</excludeCheckLastModificationDate> <excludeCheckContent>true</excludeCheckContent> <excludeCheckFewerOrMoreFiles>true</excludeCheckFewerOrMoreFiles> </org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger> </triggers> -</project>
\ No newline at end of file +</project> diff --git a/tests/triggers/fixtures/monitor_folders.yaml b/tests/triggers/fixtures/monitor-folders-full.yaml index eda43d38..ab71ac51 100644 --- a/tests/triggers/fixtures/monitor_folders.yaml +++ b/tests/triggers/fixtures/monitor-folders-full.yaml @@ -2,10 +2,10 @@ triggers: - monitor-folders: path: 'pathname' includes: - - 'pattern1' - - 'pattern2' + - 'pattern1' + - 'pattern2' excludes: 'pattern1' check-modification-date: false check-content: false check-fewer: false - cron: 'H/15 * * * *' + cron: H/15 * * * * diff --git a/tests/triggers/fixtures/monitor-folders-minimal.xml b/tests/triggers/fixtures/monitor-folders-minimal.xml new file mode 100644 index 00000000..1564aef7 --- /dev/null +++ b/tests/triggers/fixtures/monitor-folders-minimal.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <triggers class="vector"> + <org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger plugin="fstrigger"> + <path/> + <spec/> + <includes/> + <excludes/> + <excludeCheckLastModificationDate>false</excludeCheckLastModificationDate> + <excludeCheckContent>false</excludeCheckContent> + <excludeCheckFewerOrMoreFiles>false</excludeCheckFewerOrMoreFiles> + </org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger> + </triggers> +</project> diff --git a/tests/triggers/fixtures/monitor-folders-minimal.yaml b/tests/triggers/fixtures/monitor-folders-minimal.yaml new file mode 100644 index 00000000..6ce84ad0 --- /dev/null +++ b/tests/triggers/fixtures/monitor-folders-minimal.yaml @@ -0,0 +1,2 @@ +triggers: + - monitor-folders diff --git a/tests/wrappers/fixtures/sonar-full.xml b/tests/wrappers/fixtures/sonar-full.xml new file mode 100644 index 00000000..e7fb0bd9 --- /dev/null +++ b/tests/wrappers/fixtures/sonar-full.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <buildWrappers> + <hudson.plugins.sonar.SonarBuildWrapper plugin="sonar"> + <installationName>test-sonar-installation</installationName> + </hudson.plugins.sonar.SonarBuildWrapper> + </buildWrappers> +</project> diff --git a/tests/wrappers/fixtures/sonar-full.yaml b/tests/wrappers/fixtures/sonar-full.yaml new file mode 100644 index 00000000..e72aa9be --- /dev/null +++ b/tests/wrappers/fixtures/sonar-full.yaml @@ -0,0 +1,3 @@ +wrappers: + - sonar: + install-name: test-sonar-installation diff --git a/tests/wrappers/fixtures/sonar-minimal.xml b/tests/wrappers/fixtures/sonar-minimal.xml new file mode 100644 index 00000000..e675f9d0 --- /dev/null +++ b/tests/wrappers/fixtures/sonar-minimal.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <buildWrappers> + <hudson.plugins.sonar.SonarBuildWrapper plugin="sonar"/> + </buildWrappers> +</project> diff --git a/tests/wrappers/fixtures/sonar-minimal.yaml b/tests/wrappers/fixtures/sonar-minimal.yaml new file mode 100644 index 00000000..dad6d19e --- /dev/null +++ b/tests/wrappers/fixtures/sonar-minimal.yaml @@ -0,0 +1,2 @@ +wrappers: + - sonar diff --git a/tests/wrappers/fixtures/version-number001.xml b/tests/wrappers/fixtures/version-number001.xml new file mode 100644 index 00000000..9d2b9c2c --- /dev/null +++ b/tests/wrappers/fixtures/version-number001.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <buildWrappers> + <org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder> + <environmentVariableName>relVersion</environmentVariableName> + <versionNumberString>${BUILD_DATE_FORMATTED, "yy.M"}.${BUILDS_THIS_MONTH_Z}</versionNumberString> + <skipFailedBuilds>false</skipFailedBuilds> + <useAsBuildDisplayName>false</useAsBuildDisplayName> + <projectStartDate>1970-1-1 00:00:00.0 UTC</projectStartDate> + <oBuildsToday>-1</oBuildsToday> + <oBuildsThisMonth>-1</oBuildsThisMonth> + <oBuildsThisYear>-1</oBuildsThisYear> + <oBuildsAllTime>-1</oBuildsAllTime> + </org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder> + </buildWrappers> +</project> diff --git a/tests/wrappers/fixtures/version-number001.yaml b/tests/wrappers/fixtures/version-number001.yaml new file mode 100644 index 00000000..f55d06c2 --- /dev/null +++ b/tests/wrappers/fixtures/version-number001.yaml @@ -0,0 +1,4 @@ +wrappers: + - version-number: + variable-name: relVersion + format-string: ${BUILD_DATE_FORMATTED, "yy.M"}.${BUILDS_THIS_MONTH_Z} diff --git a/tests/wrappers/fixtures/xvfb001.xml b/tests/wrappers/fixtures/xvfb-full.xml index b87b2b3f..b87b2b3f 100644 --- a/tests/wrappers/fixtures/xvfb001.xml +++ b/tests/wrappers/fixtures/xvfb-full.xml diff --git a/tests/wrappers/fixtures/xvfb001.yaml b/tests/wrappers/fixtures/xvfb-full.yaml index dac0a97b..dac0a97b 100644 --- a/tests/wrappers/fixtures/xvfb001.yaml +++ b/tests/wrappers/fixtures/xvfb-full.yaml diff --git a/tests/wrappers/fixtures/xvfb002.xml b/tests/wrappers/fixtures/xvfb-minimal.xml index 851043b0..856a34c0 100644 --- a/tests/wrappers/fixtures/xvfb002.xml +++ b/tests/wrappers/fixtures/xvfb-minimal.xml @@ -4,6 +4,7 @@ <org.jenkinsci.plugins.xvfb.XvfbBuildWrapper> <installationName>default</installationName> <autoDisplayName>false</autoDisplayName> + <displayName/> <assignedLabels/> <parallelBuild>false</parallelBuild> <timeout>0</timeout> diff --git a/tests/wrappers/fixtures/xvfb002.yaml b/tests/wrappers/fixtures/xvfb-minimal.yaml index 923eb07d..923eb07d 100644 --- a/tests/wrappers/fixtures/xvfb002.yaml +++ b/tests/wrappers/fixtures/xvfb-minimal.yaml diff --git a/tests/yamlparser/fixtures/project_flow_template002.xml b/tests/yamlparser/fixtures/project_flow_template002.xml index 74f04ae6..13b80d37 100644 --- a/tests/yamlparser/fixtures/project_flow_template002.xml +++ b/tests/yamlparser/fixtures/project_flow_template002.xml @@ -23,7 +23,7 @@ build("job2c") </hudson.tasks.Shell> </builders> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>developer@nowhere.net</recipients> <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild> <sendToIndividuals>false</sendToIndividuals> diff --git a/tests/yamlparser/fixtures/template_override_project_level_defaults.xml b/tests/yamlparser/fixtures/template_override_project_level_defaults.xml index 10807152..1fff6aa4 100644 --- a/tests/yamlparser/fixtures/template_override_project_level_defaults.xml +++ b/tests/yamlparser/fixtures/template_override_project_level_defaults.xml @@ -57,7 +57,7 @@ <scm class="hudson.scm.NullSCM"/> <builders/> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>qa@example.com</recipients> <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild> <sendToIndividuals>false</sendToIndividuals> diff --git a/tests/yamlparser/fixtures/templates001.xml b/tests/yamlparser/fixtures/templates001.xml index 086c8d49..9ebef3e4 100644 --- a/tests/yamlparser/fixtures/templates001.xml +++ b/tests/yamlparser/fixtures/templates001.xml @@ -15,7 +15,7 @@ </hudson.tasks.Shell> </builders> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>projmanager@nowhere.net</recipients> <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild> <sendToIndividuals>false</sendToIndividuals> @@ -41,7 +41,7 @@ </hudson.tasks.Shell> </builders> <publishers> - <hudson.tasks.Mailer> + <hudson.tasks.Mailer plugin="mailer"> <recipients>developer@nowhere.net</recipients> <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild> <sendToIndividuals>false</sendToIndividuals> |