{"id":5330,"library":"mozilla-taskgraph","title":"Mozilla Taskgraph","description":"mozilla-taskgraph provides Mozilla-specific transforms, utilities, and parameter definitions designed to extend and integrate with the taskcluster-taskgraph framework. It enables the configuration and automation of complex CI/CD processes within Mozilla's infrastructure. The library is actively maintained with frequent updates, currently at version 4.1.1, and follows semver principles.","status":"active","version":"4.1.1","language":"en","source_language":"en","source_url":"https://github.com/mozilla-releng/mozilla-taskgraph","tags":["mozilla","taskgraph","taskcluster","ci/cd","automation","build-system"],"install":[{"cmd":"pip install mozilla-taskgraph","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency; mozilla-taskgraph provides extensions and transforms for the taskcluster-taskgraph framework. It is specified as a direct requirement in pyproject.toml.","package":"taskcluster-taskgraph","optional":false}],"imports":[{"symbol":"MozillaProjectConfigBuilder","correct":"from mozilla_taskgraph.project_config import MozillaProjectConfigBuilder"},{"symbol":"transform_version_tasks","correct":"from mozilla_taskgraph.transforms.versions import transform_version_tasks"},{"symbol":"add_platform_to_task_name","correct":"from mozilla_taskgraph.util.task_names import add_platform_to_task_name"}],"quickstart":{"code":"from mozilla_taskgraph.util.task_names import add_platform_to_task_name\nfrom mozilla_taskgraph.parameters import build_parameters\nfrom mozilla_taskgraph.project_config import MozillaProjectConfigBuilder\n\n# Demonstrating a utility function provided by mozilla-taskgraph\nprint(\"\\n--- Demonstrating a utility function ---\")\noriginal_name = \"build-linux\"\nplatform_tag = \"x64\"\nnew_name = add_platform_to_task_name(original_name, platform_tag)\nprint(f\"Original task name: '{original_name}', Platform: '{platform_tag}'\")\nprint(f\"Transformed task name: '{new_name}'\")\n\n# Accessing Mozilla-specific parameter definitions (conceptual)\nprint(\"\\n--- Accessing Mozilla-specific parameter definitions ---\")\n# These parameters are typically consumed by other parts of the taskgraph\ntry:\n    # The exact way to access definitions might vary; this is illustrative.\n    print(f\"Example parameter definition key: {next(iter(build_parameters.BUILD_PROPERTIES_DEFINITION.keys()))}\")\nexcept AttributeError:\n    print(\"Note: Parameter definitions are typically used internally by transforms.\")\n\n# Illustrating the main configuration builder (requires 'taskcluster-taskgraph')\nprint(\"\\n--- Instantiating MozillaProjectConfigBuilder ---\")\n# In a real setup, 'project_dir' would point to a directory containing .taskcluster.yml\n# For this quickstart, we'll instantiate it conceptually without requiring actual files.\n# Note: Full functionality of the builder requires a valid taskgraph project structure.\ntry:\n    # Minimal instantiation, skipping schema validation for quickstart simplicity\n    builder = MozillaProjectConfigBuilder(\n        project_dir=\".\", \n        schema_validate=False\n    )\n    print(\"MozillaProjectConfigBuilder instantiated successfully.\")\n    print(\"This builder extends taskgraph's ProjectConfig to include Mozilla-specific logic and defaults.\")\nexcept Exception as e:\n    print(f\"Could not instantiate MozillaProjectConfigBuilder: {e}\")\n    print(\"Ensure 'taskcluster-taskgraph' is installed and project_dir is correctly set for full functionality.\")\n","lang":"python","description":"This quickstart demonstrates a utility function from `mozilla-taskgraph.util`, accesses a Mozilla-specific parameter definition, and shows how to instantiate the `MozillaProjectConfigBuilder`. `mozilla-taskgraph` provides building blocks that integrate with `taskcluster-taskgraph`; therefore, a full runnable example often requires a `taskcluster-taskgraph` project setup. This example focuses on standalone components where possible."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Python 3.8 support was dropped in version 4.0.0. Projects using `mozilla-taskgraph` must update to Python 3.9 or newer.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Consult `mozilla-taskgraph` release notes and `pyproject.toml` for compatible `taskcluster-taskgraph` versions.","message":"Mozilla-taskgraph is tightly coupled with `taskcluster-taskgraph` versions. Ensure the `mozilla-taskgraph` version you use is compatible with your `taskcluster-taskgraph` version, as stated in its release notes (e.g., 'compatible with Taskgraph v18.0.0').","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand that this library is an extension for a specific ecosystem; direct applicability outside Mozilla's context may be limited without significant adaptation.","message":"This library is highly specialized for Mozilla's CI/CD infrastructure and conventions. While its underlying `taskcluster-taskgraph` framework is general, the transforms and utilities in `mozilla-taskgraph` are tailored for Mozilla's specific needs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your existing decision and image task definitions and update them to use the 'd2g worker pools' as per Mozilla's latest taskgraph conventions.","message":"Changes related to the migration of 'decision' and 'image' tasks to 'd2g worker pools' were introduced in version 4.0.2. Existing task definitions for these types might require updates to align with the new worker pool configurations.","severity":"breaking","affected_versions":">=4.0.2"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}