diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index bd73c1930..df3994e37 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -36,6 +36,35 @@ import jenkins_jobs.modules.base from jenkins_jobs.modules.builders import create_builders +def ci_skip(parser, xml_parent, data): + """yaml: ci-skip + Skip making a build for certain push. + Just add [ci skip] into your commit's message to let Jenkins know, + that you do not want to perform build for the next push. + Requires the Jenkins `Ci Skip Plugin. + `_ + + Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/ci-skip001.yaml + """ + rpobj = XML.SubElement(xml_parent, 'ruby-proxy-object') + robj = XML.SubElement(rpobj, 'ruby-object', attrib={ + 'pluginid': 'ci-skip', + 'ruby-class': 'Jenkins::Tasks::BuildWrapperProxy' + }) + pluginid = XML.SubElement(robj, 'pluginid', { + 'pluginid': 'ci-skip', 'ruby-class': 'String' + }) + pluginid.text = 'ci-skip' + obj = XML.SubElement(robj, 'object', { + 'ruby-class': 'CiSkipWrapper', 'pluginid': 'ci-skip' + }) + ciskip = XML.SubElement(obj, 'ci__skip', { + 'pluginid': 'ci-skip', 'ruby-class': 'NilClass' + }) + + def timeout(parser, xml_parent, data): """yaml: timeout Abort the build if it runs too long. diff --git a/setup.py b/setup.py index d0f7f8fb3..4a7c542b9 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,6 @@ requires = setup.parse_requirements() test_requires = setup.parse_requirements(['tools/test-requires']) depend_links = setup.parse_dependency_links() - setuptools.setup( name='jenkins-job-builder', version=version.canonical_version_string(always=True), @@ -196,6 +195,7 @@ setuptools.setup( 'ansicolor=jenkins_jobs.modules.wrappers:ansicolor', 'build-name=jenkins_jobs.modules.wrappers:build_name', 'build-user-vars=jenkins_jobs.modules.wrappers:build_user_vars', + 'ci-skip=jenkins_jobs.modules.wrappers:ci_skip', 'copy-to-slave=jenkins_jobs.modules.wrappers:copy_to_slave', 'env-file=jenkins_jobs.modules.wrappers:env_file', 'inject=jenkins_jobs.modules.wrappers:inject', diff --git a/tests/wrappers/fixtures/ci-skip001.xml b/tests/wrappers/fixtures/ci-skip001.xml new file mode 100644 index 000000000..4d7f08562 --- /dev/null +++ b/tests/wrappers/fixtures/ci-skip001.xml @@ -0,0 +1,13 @@ + + + + + + ci-skip + + + + + + + diff --git a/tests/wrappers/fixtures/ci-skip001.yaml b/tests/wrappers/fixtures/ci-skip001.yaml new file mode 100644 index 000000000..0d98600a0 --- /dev/null +++ b/tests/wrappers/fixtures/ci-skip001.yaml @@ -0,0 +1,2 @@ +wrappers: + - ci-skip