| 1 |
# Copyright 2013 Hewlett-Packard Development Company, L.P. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
|
| 16 |
""" |
| 17 |
The MultiJob Project module handles creating MultiJob Jenkins projects. |
| 18 |
You may specify ``multijob`` in the ``project-type`` attribute of |
| 19 |
the :ref:`Job` definition. |
| 20 |
|
| 21 |
This project type may use :py:func:`jenkins_jobs.modules.builders.multijob` \ |
| 22 |
builders. |
| 23 |
|
| 24 |
Requires the Jenkins :jenkins-plugins:`Multijob Plugin <jenkins-multijob-plugin>`. |
| 25 |
|
| 26 |
Example:: |
| 27 |
|
| 28 |
job: |
| 29 |
name: test_job |
| 30 |
project-type: multijob |
| 31 |
builders: |
| 32 |
- multijob: |
| 33 |
name: PhaseOne |
| 34 |
condition: SUCCESSFUL |
| 35 |
projects: |
| 36 |
- name: PhaseOneJobA |
| 37 |
current-parameters: true |
| 38 |
git-revision: true |
| 39 |
- name: PhaseOneJobB |
| 40 |
current-parameters: true |
| 41 |
property-file: build.props |
| 42 |
- multijob: |
| 43 |
name: PhaseTwo |
| 44 |
condition: UNSTABLE |
| 45 |
projects: |
| 46 |
- name: PhaseTwoJobA |
| 47 |
current-parameters: true |
| 48 |
predefined-parameters: foo=bar |
| 49 |
- name: PhaseTwoJobB |
| 50 |
current-parameters: false |
| 51 |
""" |
| 52 |
|
| 53 |
import xml.etree.ElementTree as XML |
| 54 |
|
| 55 |
import jenkins_jobs.modules.base |
| 56 |
|
| 57 |
|
| 58 |
class MultiJob(jenkins_jobs.modules.base.Base): |
| 59 |
sequence = 0 |
| 60 |
|
| 61 |
def root_xml(self, data): |
| 62 |
xml_parent = XML.Element( |
| 63 |
"com.tikal.jenkins.plugins.multijob." "MultiJobProject" |
| 64 |
) |
| 65 |
return xml_parent |