Beispiel #1
0
# coding=utf-8
from atlassian import Jira

jira = Jira(url="http://localhost:8080/",
            username="******",
            password="******")
"""That example show how to copy components from one project into another"""

DST_PROJECT = "PROJECT_B"
SRC_PROJECT = "PROJECT_A"
components = jira.get_project_components(SRC_PROJECT)

for component in components:
    data = {
        "project": DST_PROJECT,
        "description": component.get('description'),
        "leadUserName": component.get('leadUserName'),
        "name": component.get('name'),
        "assigneeType": component.get('assigneeType')
    }
    jira.create_component(data)
    print("{} - component created ".format(component.get('name')))
# coding=utf-8
from atlassian import Jira

jira = Jira(url="http://localhost:8080/",
            username="******",
            password="******")

components = ["Data Base", "HTML", "JavaScript"]
"""That example show how to create components on all existing projects, only skipping the one in a provided list"""

project_to_skip = ["SI", "SA", "ETA"]

for i in jira.get_all_projects(included_archived=None):
    if i["key"] in project_to_skip:
        print("Skipping project {} ".format(i["key"]))
    else:
        for j in components:
            print("Creating in project {} ".format(i["key"]))
            comp = {"project": i["key"], "name": j}
            jira.create_component(comp)
            print("{} - component created ".format(comp.get('name')))