Skip to content

Commit

Permalink
Merge 9f91f15 into 4c8d047
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFriendlyCoder committed May 12, 2019
2 parents 4c8d047 + 9f91f15 commit 76ceaf0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/pyjen/plugins/multijob.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""Primitives that manage Jenkins job of type 'MultiJob'"""
from pyjen.job import Job


class MultiJob(Job):
"""Custom job type provided by the jenkins-multijob-plugin plugin
https://plugins.jenkins.io/jenkins-multijob-plugin
"""
@staticmethod
def get_jenkins_plugin_name():
"""Gets the name of the Jenkins plugin associated with this PyJen plugin
This static method is used by the PyJen plugin API to associate this
class with a specific Jenkins plugin, as it is encoded in the config.xml
:rtype: :class:`str`
"""
return "com.tikal.jenkins.plugins.multijob.MultiJobProject"

@staticmethod
def template_config_xml():
return """<com.tikal.jenkins.plugins.multijob.MultiJobProject plugin="jenkins-multijob-plugin@1.32">
<description/>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.plugins.buildblocker.BuildBlockerProperty plugin="build-blocker-plugin@1.7.3">
<useBuildBlocker>false</useBuildBlocker>
<blockLevel>GLOBAL</blockLevel>
<scanQueueFor>DISABLED</scanQueueFor>
<blockingJobs/>
</hudson.plugins.buildblocker.BuildBlockerProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
<pollSubjobs>false</pollSubjobs>
</com.tikal.jenkins.plugins.multijob.MultiJobProject>"""


PluginClass = MultiJob

if __name__ == "__main__": # pragma: no cover
pass
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"conditional-buildstep",
"parameterized-trigger",
"build-blocker-plugin",
"jenkins-multijob-plugin",
]


Expand Down
17 changes: 17 additions & 0 deletions tests/test_jobs/test_multijob_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from ..utils import clean_job
from pyjen.jenkins import Jenkins
from pyjen.plugins.multijob import MultiJob


def test_create_multijob_job(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
expected_name = "test_create_multijob_job"
jb = jk.create_job(expected_name, MultiJob)
with clean_job(jb):
assert jb is not None
assert jb.name == expected_name


if __name__ == "__main__":
pytest.main([__file__, "-v", "-s"])

0 comments on commit 76ceaf0

Please sign in to comment.