def setup_assemble_tasks()

in taskcluster/app_services_taskgraph/transforms/nimbus.py [0:0]


def setup_assemble_tasks(config, tasks):
    for task in tasks:
        # Which nimbus binary are we assembling?
        binary = task["attributes"]["nimbus-binary"]

        # Find nimbus-build task dependencies for our binary.
        build_task_deps = [
            NimbusBuildDep(label, build_task.attributes["target"])
            for (label, build_task) in config.kind_dependencies_tasks.items()
            if build_task.kind == "nimbus-build"
            and build_task.attributes.get("binary") == binary
        ]

        task["dependencies"] = {dep.label: dep.label for dep in build_task_deps}
        task["fetches"] = {
            dep.label: [
                {
                    "artifact": f"{binary}-{dep.target}.zip",
                    "dest": binary,
                    "extract": True if binary == "nimbus-fml" else False,
                }
            ]
            for dep in build_task_deps
        }

        artifact_path = "/builds/worker/artifacts"
        if binary == "nimbus-fml":
            # For nimbus-fml, we zip all binaries together and include the sha256
            task["release-artifacts"] = [f"{binary}.{ext}" for ext in ("zip", "sha256")]

            task["run"] = {
                "using": "run-commands",
                "commands": [
                    ["mkdir", "-p", artifact_path],
                    ["cd", "/builds/worker/fetches/nimbus-fml"],
                    ["zip", f"{artifact_path}/nimbus-fml.zip", "-r", "."],
                    ["cd", artifact_path],
                    ["eval", "sha256sum", "nimbus-fml.zip", ">", "nimbus-fml.sha256"],
                ],
            }
        elif binary == "nimbus-cli":
            # For nimbus-cli, we just publish the binaries separately
            task["release-artifacts"] = [
                f"{binary}-{dep.target}.zip" for dep in build_task_deps
            ]
            # Publish a JSON file with information about the build
            task["release-artifacts"].append("nimbus-cli.json")

            sources = [
                f"/builds/worker/fetches/{binary}/{binary}-{dep.target}.zip"
                for dep in build_task_deps
            ]

            task["run"] = {
                "using": "run-commands",
                "commands": [
                    ["mkdir", "-p", artifact_path],
                    ["cp"] + sources + [artifact_path],
                    [
                        "taskcluster/scripts/generate-nimbus-cli-json.py",
                        f"{artifact_path}/nimbus-cli.json",
                    ],
                ],
            }

        yield task