def start_pr_release(proj_name, repo_name, pr_number, pr_title, source_hash,source_branch,source_project, source_repo, target_branch,target_project, target_repo, template_filter = None):
    templates = templateApi.getTemplates(template_filter)
    if not templates:
        response.statusCode = 500
        raise Exception("Could not find any templates by filter : %s " % template_filter)
    else:
        if len(templates) > 1:
            response.statusCode = 500
            raise Exception("Found more than one template with tag '%s', please use more specific value. List Found : %s" % (template_filter, [item.title for item in templates]))
    
    template_id = templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Pull Request #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('${pull_request_number}', '%s' % pr_number)
    variables.put('${pull_request_title}', '%s' % pr_title)
    variables.put('${repository_name}', '%s' % repo_name)
    variables.put('${proj_name}', '%s' % proj_name)
    variables.put('${source_hash}', '%s' % source_hash)
    variables.put('${source_branch}', '%s' % source_branch)
    variables.put('${source_project}', '%s' % source_project)
    variables.put('${source_repo}', '%s' % source_repo)
    variables.put('${target_branch}', '%s' % target_branch)
    variables.put('${target_project}', '%s' % target_project)
    variables.put('${target_repo}', '%s' % target_repo)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s for Pull Request %s" % (started_release.getId(), pr_number))
def start_pr_release(repo_full_name, pr_number, pr_title, comment):
    tag = 'pull_request_merger'
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        template_id = GitHubUtils.bootstrapPRMergerTemplate()
    else:
        if len(pr_templates) > 1:
            logger.warn("Found more than one template with tag '%s', using the first one" % tag)
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Merge PR #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('${pull_request_number}', '%s' % pr_number)
    variables.put('${pull_request_title}', '%s' % pr_title)
    variables.put('${repository_full_name}', '%s' % repo_full_name)
    variables.put('${pull_request_comment}', '%s' % comment)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s to merge pull request %s" % (started_release.getId(), pr_number))
def start_pr_release(proj_name,
                     repo_name,
                     pr_number,
                     pr_title,
                     comment,
                     source_hash,
                     target_hash,
                     tag='pull_request_merger'):
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        raise Exception(
            'Could not find any templates by tag [pull_request_merger]. '
            'Did the xlr-development-workflow-plugin initializer run?')
    else:
        if len(pr_templates) > 1:
            logger.warn(
                "Found more than one template with tag '%s', using the first one"
                % tag)
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Pull Request #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('pull_request_number', '%s' % pr_number)
    variables.put('pull_request_title', '%s' % pr_title)
    variables.put('repository_name', '%s' % repo_name)
    variables.put('pull_request_comment', '%s' % comment)
    variables.put('proj_name', '%s' % proj_name)
    variables.put('fromHash', '%s' % source_hash)
    variables.put('toHash', '%s' % target_hash)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s for Pull Request %s" %
                (started_release.getId(), pr_number))
def start_new_branch_release(repo_full_name,
                             branch_name,
                             current_commit_hash,
                             template_filter=None):
    templates = templateApi.getTemplates(template_filter)
    if not templates:
        raise Exception(
            'Could not find any templates by tag [pull_request_merger]. '
            'Did the xlr-development-workflow-plugin initializer run?')
    else:
        if len(templates) > 1:
            logger.warn(
                "Found more than one template with tag '%s', using the first one"
                % template_filter)
        template_id = templates[0].id

    params = StartRelease()
    params.setReleaseTitle("Release for BRANCH: %s/%s" %
                           (repo_full_name, branch_name))
    variables = HashMap()
    variables.put('repo_full_name', '%s' % repo_full_name)
    variables.put('branch_name', '%s' % branch_name)
    variables.put('current_commit_hash', '%s' % current_commit_hash)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started Release %s for BRANCH: %s/%s" %
                (started_release.getId(), repo_full_name, branch_name))
def start_pr_release(repo_full_name, pr_number, pr_title, comment):
    tag = "pull_request_merger"
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        raise Exception(
            "Could not find any templates by tag [pull_request_merger]. "
            "Did the xlr-development-workflow-plugin initializer run?"
        )
    else:
        if len(pr_templates) > 1:
            logger.warn(
                "Found more than one template with tag '%s', using the first one" % tag
            )
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle("Merge PR #%s: %s" % (pr_number, pr_title))
    variables = HashMap()
    variables.put("${pull_request_number}", "%s" % pr_number)
    variables.put("${pull_request_title}", "%s" % pr_title)
    variables.put("${repository_full_name}", "%s" % repo_full_name)
    variables.put("${pull_request_comment}", "%s" % comment)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info(
        "Started release %s to merge pull request %s"
        % (started_release.getId(), pr_number)
    )
def start_new_branch_release(repo_full_name,
                             project_name,
                             branch_name,
                             current_commit_hash,
                             commit_message,
                             template_filter=None):
    templates = templateApi.getTemplates(template_filter)
    if not templates:
        response.statusCode = 500
        raise Exception("Could not find any templates by filter : %s " %
                        template_filter)
    else:
        if len(templates) > 1:
            response.statusCode = 500
            raise Exception(
                "Found more than one template with tag '%s', please use more specific value. List Found : %s"
                % (template_filter, [item.title for item in templates]))

    template_id = templates[0].id
    params = StartRelease()
    params.setReleaseTitle("Release for [%s]:[%s]:[%s]" %
                           (project_name, repo_full_name, branch_name))
    variables = HashMap()
    variables.put('${project_name}', '%s' % project_name)
    variables.put('${repo_full_name}', '%s' % repo_full_name)
    variables.put('${branch_name}', '%s' % branch_name)
    variables.put('${commit_message}', '%s' % commit_message)
    variables.put('${current_commit_hash}', '%s' % current_commit_hash)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info(
        "Started Release %s for [%s]:[%s]:[%s]" %
        (started_release.getId(), project_name, repo_full_name, branch_name))
def start_new_branch_release(repo_full_name, project_name, branch_name, current_commit_hash, commit_message, template_filter = None):
	templates = templateApi.getTemplates(template_filter)
	if not templates:
		response.statusCode = 500
		raise Exception("Could not find any templates by filter : %s " % template_filter)
	else:
		if len(templates) > 1:
			response.statusCode = 500
			raise Exception("Found more than one template with tag '%s', please use more specific value. List Found : %s" % (template_filter, [item.title for item in templates]))
	
	template_id = templates[0].id
	params = StartRelease()
	params.setReleaseTitle("Release for [%s]:[%s]:[%s]" % (project_name, repo_full_name, branch_name))
	variables = HashMap()
	variables.put('${project_name}', '%s' % project_name)
	variables.put('${repo_full_name}', '%s' % repo_full_name)
	variables.put('${branch_name}', '%s' % branch_name)
	variables.put('${commit_message}', '%s' % commit_message)
	variables.put('${current_commit_hash}', '%s' % current_commit_hash)
	params.setReleaseVariables(variables)
	started_release = templateApi.start(template_id, params)
	response.entity = started_release
	logger.info("Started Release %s for [%s]:[%s]:[%s]" % (started_release.getId(),project_name, repo_full_name, branch_name))
Exemplo n.º 8
0
def start_pr_release(
    proj_name,
    repo_name,
    pr_number,
    pr_title,
    source_hash,
    source_branch,
    source_project,
    source_repo,
    target_branch,
    target_project,
    target_repo,
    template_filter=None,
):
    templates = templateApi.getTemplates(template_filter)
    if not templates:
        response.statusCode = 500
        raise Exception("Could not find any templates by filter : %s " %
                        template_filter)
    else:
        if len(templates) > 1:
            response.statusCode = 500
            raise Exception(
                "Found more than one template with tag '%s', please use more specific value. List Found : %s"
                % (template_filter, [item.title for item in templates]))

    template_id = templates[0].id

    params = StartRelease()
    params.setReleaseTitle("Pull Request #%s: %s" % (pr_number, pr_title))
    variables = HashMap()
    variables.put("${pull_request_number}", "%s" % pr_number)
    variables.put("${pull_request_title}", "%s" % pr_title)
    variables.put("${repository_name}", "%s" % repo_name)
    variables.put("${proj_name}", "%s" % proj_name)
    variables.put("${source_hash}", "%s" % source_hash)
    variables.put("${source_branch}", "%s" % source_branch)
    variables.put("${source_project}", "%s" % source_project)
    variables.put("${source_repo}", "%s" % source_repo)
    variables.put("${target_branch}", "%s" % target_branch)
    variables.put("${target_project}", "%s" % target_project)
    variables.put("${target_repo}", "%s" % target_repo)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s for Pull Request %s" %
                (started_release.getId(), pr_number))
Exemplo n.º 9
0
def start_pr_release(repo_full_name, pr_number, pr_title, comment):
    tag = 'pull_request_merger'
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        template_id = GitHubUtils.bootstrapPRMergerTemplate()
    else:
        if len(pr_templates) > 1:
            logger.warn(
                "Found more than one template with tag '%s', using the first one"
                % tag)
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Merge PR #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('${pull_request_number}', '%s' % pr_number)
    variables.put('${pull_request_title}', '%s' % pr_title)
    variables.put('${repository_full_name}', '%s' % repo_full_name)
    variables.put('${pull_request_comment}', '%s' % comment)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s to merge pull request %s" %
                (started_release.getId(), pr_number))