def create_or_update_pull_request(jira_url, jira_username, jira_api_key,
                                  bitbucket_username, bitbucket_password,
                                  bitbucket_destination_branch_name,
                                  bitbucket_repository_name):
    issue_key = clean_issue_key()
    issue_data = get_issue_fields(jira_url, jira_username, jira_api_key,
                                  issue_key)
    return bitbucket_create_pull_request(
        bitbucket_username, bitbucket_password,
        '{} {}'.format(issue_key, issue_data.summary), '',
        get_current_branch_name(), bitbucket_destination_branch_name,
        bitbucket_repository_name)
Example #2
0
def create_release_pull_request(username, password, source_branch_name,
                                destination_branch_name, repository_name):
    """
    Create new pull request to the bitbucket repository
    """
    if not source_branch_name:
        source_branch_name = get_current_branch_name()

    click.echo('Pull request was successfully created, url: {}'.format(
        create_merge_release_pull_request_func(username, password,
                                               source_branch_name,
                                               destination_branch_name,
                                               repository_name)))
Example #3
0
def print_last_commit_build(bitbucket_username, bitbucket_password,
                            bitbucket_repository_name, branch_name):
    """
    Print last commit build of selected branch.
    """
    branch_name = branch_name or get_current_branch_name()
    commit_builds = get_commit_builds(bitbucket_username, bitbucket_password,
                                      bitbucket_repository_name,
                                      get_commit_hash(branch_name))
    if commit_builds:
        for build_data in commit_builds:
            click.echo(build_data['name'])
            click.echo('  Description: {}'.format(build_data['description']))
            click.echo('  URL: {}\n'.format(build_data['url']))
    else:
        click.echo('Builds weren\'t found')
Example #4
0
def create_release_merge_request(api_url, token, source_branch, target_branch,
                                 project):
    """Create a new merge request in GitLab project after release"""
    if not source_branch:
        source_branch = get_current_branch_name()

    mr_url = create_merge_request_func(
        api_url=api_url,
        token=token,
        title=f'Merge branch "{source_branch}"',
        description='',
        source_branch=source_branch,
        target_branch=target_branch,
        project=project,
    )

    click.echo(f'Merge request was successfully created: {mr_url}')