tasks/release.py
def tag_version(ctx, agent_version, commit="HEAD", verify=True, tag_modules=True, push=True, force=False):
    """
    Create tags for a given Datadog Agent version.
    The version should be given as an Agent 7 version.

    * --commit COMMIT will tag COMMIT with the tags (default HEAD)
    * --verify checks for correctness on the Agent version (on by default).
    * --tag_modules tags Go modules in addition to the agent repository
    * --push will push the tags to the origin remote (on by default).
    * --force will allow the task to overwrite existing tags. Needed to move existing tags (off by default).

    Examples:
    inv -e release.tag-version 7.27.0                 # Create tags and push them to origin
    inv -e release.tag-version 7.27.0-rc.3 --no-push  # Create tags locally; don't push them
    inv -e release.tag-version 7.29.0-rc.3 --force    # Create tags (overwriting existing tags with the same name), force-push them to origin
    """
    if verify:
        check_version(agent_version)

    force_option = ""
    if force:
        print(color_message("--force option enabled. This will allow the task to overwrite existing tags.", "orange"))
        result = yes_no_question("Please confirm the use of the --force option.", color="orange", default=False)
        if result:
            print("Continuing with the --force option.")
            force_option = " --force"
        else:
            print("Continuing without the --force option.")

    for module in DEFAULT_MODULES.values():
        if (tag_modules or module.path == ".") and module.should_tag:
            for tag in module.tag(agent_version):
                ok = try_git_command(
                    ctx,
                    f"git tag -m {tag} {tag} {commit}{force_option}",
                )
                if not ok:
                    message = f"Could not create tag {tag}. Please rerun the task to retry creating the tags (you may need the --force option)"
                    raise Exit(color_message(message, "red"), code=1)
                print(f"Created tag {tag}")
                if push:
                    ctx.run(f"git push origin {tag}{force_option}")
                    print(f"Pushed tag {tag}")

    print(f"Created all tags for version {agent_version}")

    Create tags for a given Datadog Agent version.
    The version should be given as an Agent 7 version.

    * --commit COMMIT will tag COMMIT with the tags (default HEAD)
    * --verify checks for correctness on the Agent version (on by default).
    * --tag_modules tags Go modules in addition to the agent repository
    * --push will push the tags to the origin remote (on by default).
    * --force will allow the task to overwrite existing tags. Needed to move existing tags (off by default).

    Examples:
    inv -e release.tag-version 7.27.0                 # Create tags and push them to origin
    inv -e release.tag-version 7.27.0-rc.3 --no-push  # Create tags locally; don't push them
    inv -e release.tag-version 7.29.0-rc.3 --force    # Create tags (overwriting existing tags with the same name), force-push them to origin
    
Create tags for a given Datadog Agent version.
The version should be given as an Agent 7 version.

commit COMMIT will tag COMMIT with the tags (default HEAD)
verify checks for correctness on the Agent version (on by default).
tag_modules tags Go modules in addition to the agent repository
push will push the tags to the origin remote (on by default).
force will allow the task to overwrite existing tags. Needed to move existing tags (off by default).
Create tags for a given Datadog Agent version . The version should be given as an Agent 7 version . commit COMMIT will tag COMMIT with the tags ( default HEAD ) verify checks for correctness on the Agent version ( on by default ) . tag_modules tags Go modules in addition to the agent repository push will push the tags to the origin remote ( on by default ) . force will allow the task to overwrite existing tags . Needed to move existing tags ( off by default ) .
def tag_version(ctx, agent_version, commit="HEAD", verify=True, tag_modules=True, push=True, force=False):
    if verify:
        check_version(agent_version)
    force_option = ""
    if force:
        print(color_message("--force option enabled. This will allow the task to overwrite existing tags.", "orange"))
        result = yes_no_question("Please confirm the use of the --force option.", color="orange", default=False)
        if result:
            print("Continuing with the --force option.")
            force_option = " --force"
        else:
            print("Continuing without the --force option.")
    for module in DEFAULT_MODULES.values():
        if (tag_modules or module.path == ".") and module.should_tag:
            for tag in module.tag(agent_version):
                ok = try_git_command(
                    ctx,
                    f"git tag -m {tag} {tag} {commit}{force_option}",
                )
                if not ok:
                    message = f"Could not create tag {tag}. Please rerun the task to retry creating the tags (you may need the --force option)"
                    raise Exit(color_message(message, "red"), code=1)
                print(f"Created tag {tag}")
                if push:
                    ctx.run(f"git push origin {tag}{force_option}")
                    print(f"Pushed tag {tag}")
    print(f"Created all tags for version {agent_version}")
def tag_version ( ctx , agent_version , commit = "HEAD" , verify = True , tag_modules = True , push = True , force = False ) : if verify : check_version ( agent_version ) force_option = "" if force : print ( color_message ( "--force option enabled. This will allow the task to overwrite existing tags." , "orange" ) ) result = yes_no_question ( "Please confirm the use of the --force option." , color = "orange" , default = False ) if result : print ( "Continuing with the --force option." ) force_option = " --force" else : print ( "Continuing without the --force option." ) for module in DEFAULT_MODULES . values ( ) : if ( tag_modules or module . path == "." ) and module . should_tag : for tag in module . tag ( agent_version ) : ok = try_git_command ( ctx , f"git tag -m {tag} {tag} {commit}{force_option}" , ) if not ok : message = f"Could not create tag {tag}. Please rerun the task to retry creating the tags (you may need the --force option)" raise Exit ( color_message ( message , "red" ) , code = 1 ) print ( f"Created tag {tag}" ) if push : ctx . run ( f"git push origin {tag}{force_option}" ) print ( f"Pushed tag {tag}" ) print ( f"Created all tags for version {agent_version}" )
Create tags for a given Datadog Agent version.
Create tags for a given Datadog Agent version .
"""
    Create tags for a given Datadog Agent version.
    The version should be given as an Agent 7 version.

    * --commit COMMIT will tag COMMIT with the tags (default HEAD)
    * --verify checks for correctness on the Agent version (on by default).
    * --tag_modules tags Go modules in addition to the agent repository
    * --push will push the tags to the origin remote (on by default).
    * --force will allow the task to overwrite existing tags. Needed to move existing tags (off by default).

    Examples:
    inv -e release.tag-version 7.27.0                 # Create tags and push them to origin
    inv -e release.tag-version 7.27.0-rc.3 --no-push  # Create tags locally; don't push them
    inv -e release.tag-version 7.29.0-rc.3 --force    # Create tags (overwriting existing tags with the same name), force-push them to origin
    """
ctx
agent_version
commit
verify
tag_modules
push
force
examples
None