tasks/release.py
def build_rc(ctx, major_versions="6,7", patch_version=False, redo=False):
    """
    To be done after the PR created by release.create-rc is merged, with the same options
    as release.create-rc.

    Tags the new RC versions on the current commit, and creates the build pipeline for these
    new tags.
    """
    if sys.version_info[0] < 3:
        return Exit(message="Must use Python 3 for this task", code=1)

    gitlab = Gitlab(project_name=REPOSITORY_NAME, api_token=get_gitlab_token())
    list_major_versions = parse_major_versions(major_versions)

    # Get the version of the highest major: needed for tag_version and to know
    # which tag to target when creating the pipeline.
    if redo:
        # If redo is enabled, we're moving the current RC tag, so we keep the same version
        new_version = current_version(ctx, max(list_major_versions))
    else:
        new_version = next_rc_version(ctx, max(list_major_versions), patch_version)

    # Get a string representation of the RC, eg. "6/7.32.0-rc.1"
    versions_string = f"{'/'.join([str(n) for n in list_major_versions[:-1]] + [str(new_version)])}"

    # Step 0: checks

    print(color_message("Checking repository state", "bold"))
    # Check that the base branch is valid
    current_branch = ctx.run("git rev-parse --abbrev-ref HEAD", hide=True).stdout.strip()

    if not check_base_branch(current_branch, new_version):
        raise Exit(
            color_message(
                f"The branch you are on is neither {DEFAULT_BRANCH} or the correct release branch ({new_version.branch()}). Aborting.",
                "red",
            ),
            code=1,
        )

    latest_commit = ctx.run("git --no-pager log --no-color -1 --oneline").stdout.strip()

    if not yes_no_question(
        f"This task will create tags for {versions_string} on the current commit: {latest_commit}. Is this OK?",
        color="orange",
        default=False,
    ):
        raise Exit(color_message("Aborting.", "red"), code=1)

    # Step 1: Tag versions

    print(color_message(f"Tagging RC for agent version(s) {list_major_versions}", "bold"))
    print(
        color_message("If commit signing is enabled, you will have to make sure each tag gets properly signed.", "bold")
    )
    # tag_version only takes the highest version (Agent 7 currently), and creates
    # the tags for all supported versions
    # TODO: make it possible to do Agent 6-only or Agent 7-only tags?
    # Note: if redo is enabled, then we need to set the --force option to move the tags.
    tag_version(ctx, str(new_version), force=redo)

    print(color_message(f"Waiting until the {new_version} tag appears in Gitlab", "bold"))
    gitlab_tag = None
    while not gitlab_tag:
        gitlab_tag = gitlab.find_tag(str(new_version)).get("name", None)
        sleep(5)

    print(color_message("Creating RC pipeline", "bold"))

    # Step 2: Run the RC pipeline

    run(
        ctx,
        git_ref=gitlab_tag,
        use_release_entries=True,
        major_versions=major_versions,
        repo_branch="beta",
        deploy=True,
    )

    To be done after the PR created by release.create-rc is merged, with the same options
    as release.create-rc.

    Tags the new RC versions on the current commit, and creates the build pipeline for these
    new tags.
    
To be done after the PR created by release.create-rc is merged, with the same options
as release.create-rc.

Tags the new RC versions on the current commit, and creates the build pipeline for these
new tags.
To be done after the PR created by release . create - rc is merged with the same options as release . create - rc . Tags the new RC versions on the current commit and creates the build pipeline for these new tags .
def build_rc(ctx, major_versions="6,7", patch_version=False, redo=False):
    if sys.version_info[0] < 3:
        return Exit(message="Must use Python 3 for this task", code=1)
    gitlab = Gitlab(project_name=REPOSITORY_NAME, api_token=get_gitlab_token())
    list_major_versions = parse_major_versions(major_versions)
    if redo:
        new_version = current_version(ctx, max(list_major_versions))
    else:
        new_version = next_rc_version(ctx, max(list_major_versions), patch_version)
    versions_string = f"{'/'.join([str(n) for n in list_major_versions[:-1]] + [str(new_version)])}"
    print(color_message("Checking repository state", "bold"))
    current_branch = ctx.run("git rev-parse --abbrev-ref HEAD", hide=True).stdout.strip()
    if not check_base_branch(current_branch, new_version):
        raise Exit(
            color_message(
                f"The branch you are on is neither {DEFAULT_BRANCH} or the correct release branch ({new_version.branch()}). Aborting.",
                "red",
            ),
            code=1,
        )
    latest_commit = ctx.run("git --no-pager log --no-color -1 --oneline").stdout.strip()
    if not yes_no_question(
        f"This task will create tags for {versions_string} on the current commit: {latest_commit}. Is this OK?",
        color="orange",
        default=False,
    ):
        raise Exit(color_message("Aborting.", "red"), code=1)
    print(color_message(f"Tagging RC for agent version(s) {list_major_versions}", "bold"))
    print(
        color_message("If commit signing is enabled, you will have to make sure each tag gets properly signed.", "bold")
    )
    tag_version(ctx, str(new_version), force=redo)
    print(color_message(f"Waiting until the {new_version} tag appears in Gitlab", "bold"))
    gitlab_tag = None
    while not gitlab_tag:
        gitlab_tag = gitlab.find_tag(str(new_version)).get("name", None)
        sleep(5)
    print(color_message("Creating RC pipeline", "bold"))
    run(
        ctx,
        git_ref=gitlab_tag,
        use_release_entries=True,
        major_versions=major_versions,
        repo_branch="beta",
        deploy=True,
    )
def build_rc ( ctx , major_versions = "6,7" , patch_version = False , redo = False ) : if sys . version_info [ 0 ] < 3 : return Exit ( message = "Must use Python 3 for this task" , code = 1 ) gitlab = Gitlab ( project_name = REPOSITORY_NAME , api_token = get_gitlab_token ( ) ) list_major_versions = parse_major_versions ( major_versions ) if redo : new_version = current_version ( ctx , max ( list_major_versions ) ) else : new_version = next_rc_version ( ctx , max ( list_major_versions ) , patch_version ) versions_string = f"{'/'.join([str(n) for n in list_major_versions[:-1]] + [str(new_version)])}" print ( color_message ( "Checking repository state" , "bold" ) ) current_branch = ctx . run ( "git rev-parse --abbrev-ref HEAD" , hide = True ) . stdout . strip ( ) if not check_base_branch ( current_branch , new_version ) : raise Exit ( color_message ( f"The branch you are on is neither {DEFAULT_BRANCH} or the correct release branch ({new_version.branch()}). Aborting." , "red" , ) , code = 1 , ) latest_commit = ctx . run ( "git --no-pager log --no-color -1 --oneline" ) . stdout . strip ( ) if not yes_no_question ( f"This task will create tags for {versions_string} on the current commit: {latest_commit}. Is this OK?" , color = "orange" , default = False , ) : raise Exit ( color_message ( "Aborting." , "red" ) , code = 1 ) print ( color_message ( f"Tagging RC for agent version(s) {list_major_versions}" , "bold" ) ) print ( color_message ( "If commit signing is enabled, you will have to make sure each tag gets properly signed." , "bold" ) ) tag_version ( ctx , str ( new_version ) , force = redo ) print ( color_message ( f"Waiting until the {new_version} tag appears in Gitlab" , "bold" ) ) gitlab_tag = None while not gitlab_tag : gitlab_tag = gitlab . find_tag ( str ( new_version ) ) . get ( "name" , None ) sleep ( 5 ) print ( color_message ( "Creating RC pipeline" , "bold" ) ) run ( ctx , git_ref = gitlab_tag , use_release_entries = True , major_versions = major_versions , repo_branch = "beta" , deploy = True , )
To be done after the PR created by release.create-rc is merged, with the same options
as release.create-rc.
To be done after the PR created by release . create - rc is merged with the same options as release . create - rc .
"""
    To be done after the PR created by release.create-rc is merged, with the same options
    as release.create-rc.

    Tags the new RC versions on the current commit, and creates the build pipeline for these
    new tags.
    """ # Get the version of the highest major: needed for tag_version and to know # which tag to target when creating the pipeline. # If redo is enabled, we're moving the current RC tag, so we keep the same version # Get a string representation of the RC, eg. "6/7.32.0-rc.1" # Step 0: checks # Check that the base branch is valid # Step 1: Tag versions # tag_version only takes the highest version (Agent 7 currently), and creates # the tags for all supported versions # TODO: make it possible to do Agent 6-only or Agent 7-only tags? # Note: if redo is enabled, then we need to set the --force option to move the tags. # Step 2: Run the RC pipeline
ctx
major_versions
patch_version
redo