def Task(element): runif = runif_from(element) if element.tag == "exec": command_and_args = [element.attrib["command"] ] + [e.text for e in element.findall('arg')] working_dir = element.attrib.get( "workingdir", None) # TODO not ideal to return "None" for working_dir return ExecTask(command_and_args, working_dir, runif) if element.tag == "fetchartifact": dest = element.attrib.get('dest', None) origin = element.attrib.get('origin', None) artifact_origin = element.attrib.get('artifactOrigin', None) artifact_id = element.attrib.get('artifactId', None) if artifact_origin == 'external': return FetchArtifactTask(element.attrib['pipeline'], element.attrib['stage'], element.attrib['job'], None, None, runif, origin, artifact_origin, artifact_id, fetch_properties_from(element)) return FetchArtifactTask(element.attrib['pipeline'], element.attrib['stage'], element.attrib['job'], fetch_artifact_src_from(element), dest, runif, origin, artifact_origin) if element.tag == "rake": return RakeTask(element.attrib['target']) raise RuntimeError("Don't know task type %s" % element.tag)
def Task(element): runif = runif_from(element) if element.tag == "exec": command_and_args = [element.attrib["command"]] + [e.text for e in element.findall('arg')] working_dir = element.attrib.get("workingdir", None) # TODO not ideal to return "None" for working_dir return ExecTask(command_and_args, working_dir, runif) if element.tag == "fetchartifact": dest = element.attrib.get('dest', None) return FetchArtifactTask( element.attrib['pipeline'], element.attrib['stage'], element.attrib['job'], fetch_artifact_src_from(element), dest, runif) if element.tag == "rake": return RakeTask(element.attrib['target']) raise RuntimeError("Don't know task type %s" % element.tag)