tasks/libs/pipeline_tools.py
def trigger_agent_pipeline(
    gitlab,
    ref=DEFAULT_BRANCH,
    release_version_6="nightly",
    release_version_7="nightly-a7",
    branch="nightly",
    deploy=False,
    all_builds=False,
    kitchen_tests=False,
):
    """
    Trigger a pipeline on the datadog-agent repositories. Multiple options are available:
    - run a pipeline with all builds (by default, a pipeline only runs a subset of all available builds),
    - run a pipeline with all kitchen tests,
    - run a deploy pipeline (includes all builds & kitchen tests + uploads artifacts to staging repositories);
    """
    args = {}

    if deploy:
        args["DEPLOY_AGENT"] = "true"

    # The RUN_ALL_BUILDS option can be selectively enabled. However, it cannot be explicitly
    # disabled on pipelines where they're activated by default (default branch & deploy pipelines)
    # as that would make the pipeline fail (some jobs on the default branch and deploy pipelines depend
    # on jobs that are only run if RUN_ALL_BUILDS is true).
    if all_builds:
        args["RUN_ALL_BUILDS"] = "true"

    # Kitchen tests can be selectively enabled, or disabled on pipelines where they're
    # enabled by default (default branch and deploy pipelines).
    if kitchen_tests:
        args["RUN_KITCHEN_TESTS"] = "true"
    else:
        args["RUN_KITCHEN_TESTS"] = "false"

    if release_version_6 is not None:
        args["RELEASE_VERSION_6"] = release_version_6

    if release_version_7 is not None:
        args["RELEASE_VERSION_7"] = release_version_7

    if branch is not None:
        args["BUCKET_BRANCH"] = branch

    print(
        "Creating pipeline for datadog-agent on branch/tag {} with args:\n{}".format(  # noqa: FS002
            ref, "\n".join(f"  - {k}: {args[k]}" for k in args)
        )
    )
    result = gitlab.create_pipeline(ref, args)

    if result and "id" in result:
        return result["id"]

    if result and "filtered out by workflow rules" in result.get("message", {}).get("base", [""])[0]:
        raise FilteredOutException

    raise RuntimeError(f"Invalid response from Gitlab: {result}")

    Trigger a pipeline on the datadog-agent repositories. Multiple options are available:
    - run a pipeline with all builds (by default, a pipeline only runs a subset of all available builds),
    - run a pipeline with all kitchen tests,
    - run a deploy pipeline (includes all builds & kitchen tests + uploads artifacts to staging repositories);
    
Trigger a pipeline on the datadog-agent repositories. Multiple options are available:
run a pipeline with all builds (by default, a pipeline only runs a subset of all available builds),
run a pipeline with all kitchen tests,
run a deploy pipeline (includes all builds & kitchen tests + uploads artifacts to staging repositories).
Trigger a pipeline on the datadog - agent repositories . Multiple options are available : run a pipeline with all builds ( by default a pipeline only runs a subset of all available builds ) run a pipeline with all kitchen tests run a deploy pipeline ( includes all builds & kitchen tests + uploads artifacts to staging repositories ) .
def trigger_agent_pipeline(
    gitlab,
    ref=DEFAULT_BRANCH,
    release_version_6="nightly",
    release_version_7="nightly-a7",
    branch="nightly",
    deploy=False,
    all_builds=False,
    kitchen_tests=False,
):
    args = {}
    if deploy:
        args["DEPLOY_AGENT"] = "true"
    if all_builds:
        args["RUN_ALL_BUILDS"] = "true"
    if kitchen_tests:
        args["RUN_KITCHEN_TESTS"] = "true"
    else:
        args["RUN_KITCHEN_TESTS"] = "false"
    if release_version_6 is not None:
        args["RELEASE_VERSION_6"] = release_version_6
    if release_version_7 is not None:
        args["RELEASE_VERSION_7"] = release_version_7
    if branch is not None:
        args["BUCKET_BRANCH"] = branch
    print(
        "Creating pipeline for datadog-agent on branch/tag {} with args:\n{}".format(  
            ref, "\n".join(f"  - {k}: {args[k]}" for k in args)
        )
    )
    result = gitlab.create_pipeline(ref, args)
    if result and "id" in result:
        return result["id"]
    if result and "filtered out by workflow rules" in result.get("message", {}).get("base", [""])[0]:
        raise FilteredOutException
    raise RuntimeError(f"Invalid response from Gitlab: {result}")
def trigger_agent_pipeline ( gitlab , ref = DEFAULT_BRANCH , release_version_6 = "nightly" , release_version_7 = "nightly-a7" , branch = "nightly" , deploy = False , all_builds = False , kitchen_tests = False , ) : args = { } if deploy : args [ "DEPLOY_AGENT" ] = "true" if all_builds : args [ "RUN_ALL_BUILDS" ] = "true" if kitchen_tests : args [ "RUN_KITCHEN_TESTS" ] = "true" else : args [ "RUN_KITCHEN_TESTS" ] = "false" if release_version_6 is not None : args [ "RELEASE_VERSION_6" ] = release_version_6 if release_version_7 is not None : args [ "RELEASE_VERSION_7" ] = release_version_7 if branch is not None : args [ "BUCKET_BRANCH" ] = branch print ( "Creating pipeline for datadog-agent on branch/tag {} with args:\n{}" . format ( ref , "\n" . join ( f"  - {k}: {args[k]}" for k in args ) ) ) result = gitlab . create_pipeline ( ref , args ) if result and "id" in result : return result [ "id" ] if result and "filtered out by workflow rules" in result . get ( "message" , { } ) . get ( "base" , [ "" ] ) [ 0 ] : raise FilteredOutException raise RuntimeError ( f"Invalid response from Gitlab: {result}" )
Trigger a pipeline on the datadog-agent repositories.
Trigger a pipeline on the datadog - agent repositories .
"""
    Trigger a pipeline on the datadog-agent repositories. Multiple options are available:
    - run a pipeline with all builds (by default, a pipeline only runs a subset of all available builds),
    - run a pipeline with all kitchen tests,
    - run a deploy pipeline (includes all builds & kitchen tests + uploads artifacts to staging repositories);
    """ # The RUN_ALL_BUILDS option can be selectively enabled. However, it cannot be explicitly # disabled on pipelines where they're activated by default (default branch & deploy pipelines) # as that would make the pipeline fail (some jobs on the default branch and deploy pipelines depend # on jobs that are only run if RUN_ALL_BUILDS is true). # Kitchen tests can be selectively enabled, or disabled on pipelines where they're # enabled by default (default branch and deploy pipelines). # noqa: FS002
gitlab
ref
release_version_6
release_version_7
branch
deploy
all_builds
kitchen_tests