# coding: utf8 from atlassian import Bamboo import os BAMBOO_URL = os.environ.get('BAMBOO_URL', 'http://localhost:8085') ATLASSIAN_USER = os.environ.get('ATLASSIAN_USER', 'admin') ATLASSIAN_PASSWORD = os.environ.get('ATLASSIAN_PASSWORD', 'admin') bamboo = Bamboo( url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD) bamboo.add_users_into_group(group_name='group_name', users=['user_name'])
# coding: utf8 from atlassian import Bamboo import os BAMBOO_URL = os.environ.get('BAMBOO_URL', 'http://localhost:8085') ATLASSIAN_USER = os.environ.get('ATLASSIAN_USER', 'admin') ATLASSIAN_PASSWORD = os.environ.get('ATLASSIAN_PASSWORD', 'admin') bamboo = Bamboo( url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD) # Methods in plural (projects, plans, results...) return a generator that iterates through # all results without the need of dealing need with pagination # for project in bamboo.projects(): # print(project) for branch in bamboo.plan_branches('PROJ-SP2'): print(branch) # for result in bamboo.latest_results(): # print(result) # for result in bamboo.plan_results(project_key='FOO', plan_key='BAR'): # print(result) # for report in bamboo.reports():
# coding=utf-8 import os from atlassian import Bamboo BAMBOO_URL = os.environ.get("BAMBOO_URL", "http://localhost:8085") ATLASSIAN_USER = os.environ.get("ATLASSIAN_USER", "admin") ATLASSIAN_PASSWORD = os.environ.get("ATLASSIAN_PASSWORD", "admin") bamboo = Bamboo(url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD) # Methods in plural (projects, plans, results...) return a generator that iterates through # all results without the need of dealing need with pagination # for project in bamboo.projects(): # print(project) for branch in bamboo.plan_branches("PROJ-SP2"): print(branch) # for result in bamboo.latest_results(): # print(result) # for result in bamboo.plan_results(project_key='FOO', plan_key='BAR'): # print(result) # for report in bamboo.reports(): # print(report)
from atlassian import Bamboo import argparse bamboo = Bamboo(url="https://", username="", password="") def create_plan_branch(plan, vcs_branch): bamboo_branch = vcs_branch.replace("/", "-") return bamboo.create_branch(plan, bamboo_branch, vcs_branch=vcs_branch, enabled=True) def main(): parser = argparse.ArgumentParser() parser.add_argument("--plan") parser.add_argument("--vcs_branch") args = parser.parse_args() branch = create_plan_branch(plan=args.plan, vcs_branch=args.vcs_branch) print(branch.get("key") or branch) if __name__ == "__main__": main()
# coding: utf8 from atlassian import Bamboo import os BAMBOO_URL = os.environ.get('BAMBOO_URL', 'http://localhost:8085') ATLASSIAN_USER = os.environ.get('ATLASSIAN_USER', 'admin') ATLASSIAN_PASSWORD = os.environ.get('ATLASSIAN_PASSWORD', 'admin') bamboo = Bamboo( url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD) agent_status = bamboo.agent_status() print(agent_status) activity = bamboo.activity() print(activity)
def get_latest(project): return [ result["buildResultKey"] for result in bamboo.project_latest_results(project, include_all_states=True) ] if __name__ == "__main__": BAMBOO_URL = os.environ.get("BAMBOO_URL", "") ATLASSIAN_USER = os.environ.get("ATLASSIAN_USER", "") ATLASSIAN_PASSWORD = os.environ.get("ATLASSIAN_PASSWORD", "") # AMS bamboo = Bamboo( url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD ) x = bamboo.get_custom_expiry(limit=10000) pprint(x) # projects = get_all_projects() # # projects = ["RFP"] # plans = [] # latest = [] # for project in projects: # plans.extend(get_plans_from_project(project)) # latest.extend(get_latest(project)) # branches = [] # for plan in plans: # branches.extend(get_branches_from_plan(plan)) # results = [] # for branch in branches: