Monty Taylor 730d4c09d3 Timed trigger and pollscm are different things.
Change-Id: Ia1b9c2cd2a6be50447f0898b7a8e53d906f683d9
2012-05-21 09:23:51 -04:00

34 lines
1.1 KiB
Python

#! /usr/bin/env python
# Copyright (C) 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Jenkins Job module for scm polling triggers
# To use add the following into your YAML:
# trigger:
# pollscm: '@midnight'
# or
# pollscm: '*/15 * * * *'
import xml.etree.ElementTree as XML
class trigger_pollscm(object):
def __init__(self, data):
self.data = data
def gen_xml(self, xml_parent):
time = self.data['trigger']['pollscm']
trigger = XML.SubElement(xml_parent, 'triggers', {'class':'vector'})
scmtrig = XML.SubElement(trigger, 'hudson.triggers.SCMTrigger')
XML.SubElement(scmtrig, 'spec').text = time