tasks/release.py
def unfreeze(ctx, base_directory="~/dd", major_versions="6,7", upstream="origin", redo=False):
    """
    Performs set of tasks required for the main branch unfreeze during the agent release cycle.
    That includes:
    - creates a release branch in datadog-agent, omnibus-ruby and omnibus-software repositories,
    - pushes an empty commit on the datadog-agent main branch,
    - creates devel tags in the datadog-agent repository on the empty commit from the last step.

    Notes:
    base_directory - path to the directory where dd repos are cloned, defaults to ~/dd, but can be overwritten.
    This requires a Github token (either in the GITHUB_TOKEN environment variable, or in the MacOS keychain),
    with 'repo' permissions.
    This also requires that there are no local uncommitted changes, that the current branch is 'main' or the
    release branch, and that no branch named 'release/<new rc version>' already exists locally or upstream.
    """
    if sys.version_info[0] < 3:
        return Exit(message="Must use Python 3 for this task", code=1)

    list_major_versions = parse_major_versions(major_versions)

    current = current_version(ctx, max(list_major_versions))
    next = current.next_version(bump_minor=True)
    next.devel = True

    # Strings with proper branch/tag names
    release_branch = current.branch()
    devel_tag = str(next)

    # Step 0: checks

    print(color_message("Checking repository state", "bold"))
    ctx.run("git fetch")

    if check_uncommitted_changes(ctx):
        raise Exit(
            color_message(
                "There are uncomitted changes in your repository. Please commit or stash them before trying again.",
                "red",
            ),
            code=1,
        )

    if not yes_no_question(
        f"This task will create new branches with the name '{release_branch}' in repositories: {', '.join(UNFREEZE_REPOS)}. Is this OK?",
        color="orange",
        default=False,
    ):
        raise Exit(color_message("Aborting.", "red"), code=1)

    # Step 1: Create release branch
    for repo in UNFREEZE_REPOS:
        create_release_branch(ctx, repo, release_branch, base_directory=base_directory)

    print(color_message("Creating empty commit for devel tags", "bold"))
    with ctx.cd(f"{base_directory}/datadog-agent"):
        ctx.run("git checkout main")
        ok = try_git_command(ctx, "git commit --allow-empty -m 'Empty commit for next release devel tags'")
        if not ok:
            raise Exit(
                color_message(
                    "Could not create commit. Please commit manually, push the commit manually to the main branch.",
                    "red",
                ),
                code=1,
            )

        print(color_message("Pushing new commit", "bold"))
        res = ctx.run(f"git push {upstream}", warn=True)
        if res.exited is None or res.exited > 0:
            raise Exit(
                color_message(
                    f"Could not push commit to the upstream '{upstream}'. Please push it manually.",
                    "red",
                ),
                code=1,
            )

    # Step 3: Create tags for next version
    print(color_message(f"Creating devel tags 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, devel_tag, tag_modules=False, push=True, force=redo)

    Performs set of tasks required for the main branch unfreeze during the agent release cycle.
    That includes:
    - creates a release branch in datadog-agent, omnibus-ruby and omnibus-software repositories,
    - pushes an empty commit on the datadog-agent main branch,
    - creates devel tags in the datadog-agent repository on the empty commit from the last step.

    Notes:
    base_directory - path to the directory where dd repos are cloned, defaults to ~/dd, but can be overwritten.
    This requires a Github token (either in the GITHUB_TOKEN environment variable, or in the MacOS keychain),
    with 'repo' permissions.
    This also requires that there are no local uncommitted changes, that the current branch is 'main' or the
    release branch, and that no branch named 'release/<new rc version>' already exists locally or upstream.
    
Performs set of tasks required for the main branch unfreeze during the agent release cycle.

path to the directory where dd repos are cloned, defaults to ~/dd, but can be overwritten.
This requires a Github token (either in the GITHUB_TOKEN environment variable, or in the MacOS keychain),
with 'repo' permissions.
This also requires that there are no local uncommitted changes, that the current branch is 'main' or the
release branch, and that no branch named 'release/' already exists locally or upstream.
Performs set of tasks required for the main branch unfreeze during the agent release cycle . path to the directory where dd repos are cloned defaults to ~ / dd but can be overwritten . This requires a Github token ( either in the GITHUB_TOKEN environment variable or in the MacOS keychain ) with ' repo ' permissions . This also requires that there are no local uncommitted changes that the current branch is ' main ' or the release branch and that no branch named ' release / ' already exists locally or upstream .
def unfreeze(ctx, base_directory="~/dd", major_versions="6,7", upstream="origin", redo=False):
    if sys.version_info[0] < 3:
        return Exit(message="Must use Python 3 for this task", code=1)
    list_major_versions = parse_major_versions(major_versions)
    current = current_version(ctx, max(list_major_versions))
    next = current.next_version(bump_minor=True)
    next.devel = True
    release_branch = current.branch()
    devel_tag = str(next)
    print(color_message("Checking repository state", "bold"))
    ctx.run("git fetch")
    if check_uncommitted_changes(ctx):
        raise Exit(
            color_message(
                "There are uncomitted changes in your repository. Please commit or stash them before trying again.",
                "red",
            ),
            code=1,
        )
    if not yes_no_question(
        f"This task will create new branches with the name '{release_branch}' in repositories: {', '.join(UNFREEZE_REPOS)}. Is this OK?",
        color="orange",
        default=False,
    ):
        raise Exit(color_message("Aborting.", "red"), code=1)
    for repo in UNFREEZE_REPOS:
        create_release_branch(ctx, repo, release_branch, base_directory=base_directory)
    print(color_message("Creating empty commit for devel tags", "bold"))
    with ctx.cd(f"{base_directory}/datadog-agent"):
        ctx.run("git checkout main")
        ok = try_git_command(ctx, "git commit --allow-empty -m 'Empty commit for next release devel tags'")
        if not ok:
            raise Exit(
                color_message(
                    "Could not create commit. Please commit manually, push the commit manually to the main branch.",
                    "red",
                ),
                code=1,
            )
        print(color_message("Pushing new commit", "bold"))
        res = ctx.run(f"git push {upstream}", warn=True)
        if res.exited is None or res.exited > 0:
            raise Exit(
                color_message(
                    f"Could not push commit to the upstream '{upstream}'. Please push it manually.",
                    "red",
                ),
                code=1,
            )
    print(color_message(f"Creating devel tags 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, devel_tag, tag_modules=False, push=True, force=redo)
def unfreeze ( ctx , base_directory = "~/dd" , major_versions = "6,7" , upstream = "origin" , redo = False ) : if sys . version_info [ 0 ] < 3 : return Exit ( message = "Must use Python 3 for this task" , code = 1 ) list_major_versions = parse_major_versions ( major_versions ) current = current_version ( ctx , max ( list_major_versions ) ) next = current . next_version ( bump_minor = True ) next . devel = True release_branch = current . branch ( ) devel_tag = str ( next ) print ( color_message ( "Checking repository state" , "bold" ) ) ctx . run ( "git fetch" ) if check_uncommitted_changes ( ctx ) : raise Exit ( color_message ( "There are uncomitted changes in your repository. Please commit or stash them before trying again." , "red" , ) , code = 1 , ) if not yes_no_question ( f"This task will create new branches with the name '{release_branch}' in repositories: {', '.join(UNFREEZE_REPOS)}. Is this OK?" , color = "orange" , default = False , ) : raise Exit ( color_message ( "Aborting." , "red" ) , code = 1 ) for repo in UNFREEZE_REPOS : create_release_branch ( ctx , repo , release_branch , base_directory = base_directory ) print ( color_message ( "Creating empty commit for devel tags" , "bold" ) ) with ctx . cd ( f"{base_directory}/datadog-agent" ) : ctx . run ( "git checkout main" ) ok = try_git_command ( ctx , "git commit --allow-empty -m 'Empty commit for next release devel tags'" ) if not ok : raise Exit ( color_message ( "Could not create commit. Please commit manually, push the commit manually to the main branch." , "red" , ) , code = 1 , ) print ( color_message ( "Pushing new commit" , "bold" ) ) res = ctx . run ( f"git push {upstream}" , warn = True ) if res . exited is None or res . exited > 0 : raise Exit ( color_message ( f"Could not push commit to the upstream '{upstream}'. Please push it manually." , "red" , ) , code = 1 , ) print ( color_message ( f"Creating devel tags 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 , devel_tag , tag_modules = False , push = True , force = redo )
Performs set of tasks required for the main branch unfreeze during the agent release cycle.
Performs set of tasks required for the main branch unfreeze during the agent release cycle .
"""
    Performs set of tasks required for the main branch unfreeze during the agent release cycle.
    That includes:
    - creates a release branch in datadog-agent, omnibus-ruby and omnibus-software repositories,
    - pushes an empty commit on the datadog-agent main branch,
    - creates devel tags in the datadog-agent repository on the empty commit from the last step.

    Notes:
    base_directory - path to the directory where dd repos are cloned, defaults to ~/dd, but can be overwritten.
    This requires a Github token (either in the GITHUB_TOKEN environment variable, or in the MacOS keychain),
    with 'repo' permissions.
    This also requires that there are no local uncommitted changes, that the current branch is 'main' or the
    release branch, and that no branch named 'release/<new rc version>' already exists locally or upstream.
    """ # Strings with proper branch/tag names # Step 0: checks # Step 1: Create release branch # Step 3: Create tags for next version
ctx
base_directory
major_versions
upstream
redo