-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]) |