# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
loader: taskgraph.loader.transform:loader

kind-dependencies:
    - toolchain
    - fetch

transforms:
    - gecko_taskgraph.transforms.job:transforms
    - gecko_taskgraph.transforms.task:transforms

task-defaults:
    attributes:
        cron: true
    treeherder:
        kind: build
        tier: 2
        symbol: B
    worker-type: b-linux-gcp
    run:
        checkout: true
    worker:
        artifacts:
            - name: public/build
              type: directory
              path: /builds/worker/artifacts/
        docker-image: {in-tree: snap-build-core22}
        max-run-time: 900
        env:
            UPLOAD_DIR: artifacts
            MOZ_STACKWALK_SYMBOLS_SERVER: '1'
    fetches:
        toolchain:
            - linux64-minidump-stackwalk

tasks:
    amd64-nightly/opt:
        description: Build Firefox Nightly as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-nightly
            build_type: opt
        index:
            product: firefox
            job-name: amd64-nightly
            type: generic
        worker:
            max-run-time: 9000
        run:
            using: run-task
            command: >-
              ./run.sh nightly
        treeherder:
            platform: linux64-snap-amd64-nightly/opt

    amd64-nightly/debug:
        description: Build Firefox Nightly (debug) as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-nightly
            build_type: debug
        index:
            product: firefox
            job-name: amd64-nightly-debug
            type: generic
        worker:
            max-run-time: 7200
        run:
            using: run-task
            command: >-
              ./run.sh nightly 1
        treeherder:
            platform: linux64-snap-amd64-nightly/debug

    amd64-beta/opt:
        description: Build Firefox Beta as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-beta
            build_type: opt
        index:
            product: firefox
            job-name: amd64-beta
            type: generic
        worker:
            max-run-time: 9000
        run:
            using: run-task
            command: >-
              ./run.sh beta
        treeherder:
            platform: linux64-snap-amd64-beta/opt

    amd64-beta/debug:
        description: Build Firefox Beta (debug) as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-beta
            build_type: debug
        index:
            product: firefox
            job-name: amd64-beta-debug
            type: generic
        worker:
            max-run-time: 7200
        run:
            using: run-task
            command: >-
              ./run.sh beta 1
        treeherder:
            platform: linux64-snap-amd64-beta/debug

    amd64-stable/opt:
        description: Build Firefox Stable as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-stable
            build_type: opt
        index:
            product: firefox
            job-name: amd64-stable
            type: generic
        worker:
            max-run-time: 9000
        run:
            using: run-task
            command: >-
              ./run.sh stable
        treeherder:
            platform: linux64-snap-amd64-stable/opt

    amd64-stable/debug:
        description: Build Firefox Stable (debug) as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-stable
            build_type: debug
        index:
            product: firefox
            job-name: amd64-stable-debug
            type: generic
        worker:
            max-run-time: 7200
        run:
            using: run-task
            command: >-
              ./run.sh stable 1
        treeherder:
            platform: linux64-snap-amd64-stable/debug

    amd64-esr/opt:
        description: Build Firefox ESR as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-esr
            build_type: opt
        index:
            product: firefox
            job-name: amd64-esr
            type: generic
        worker:
            max-run-time: 9000
        run:
            using: run-task
            command: >-
              ./run.sh esr
        treeherder:
            platform: linux64-snap-amd64-esr/opt

    amd64-esr/debug:
        description: Build Firefox ESR (debug) as a Snap using upstream definition
        attributes:
            build_platform: linux64-snap-upstream-esr
            build_type: debug
        index:
            product: firefox
            job-name: amd64-esr-debug
            type: generic
        worker:
            max-run-time: 7200
        run:
            using: run-task
            command: >-
              ./run.sh esr 1
        treeherder:
            platform: linux64-snap-amd64-esr/debug

    amd64-try/opt:
        description: Build Firefox Nightly as a Snap using upstream definition and try repo
        attributes:
            build_platform: linux64-snap-upstream-try
            build_type: opt
        index:
            product: firefox
            job-name: amd64-try
            type: generic
        worker:
            max-run-time: 9000
        run:
            using: run-task
            command: >-
              ./run.sh try
        treeherder:
            platform: linux64-snap-amd64-try/opt

    amd64-try/debug:
        description: Build Firefox Nightly (debug) as a Snap using upstream definition and try repo
        attributes:
            build_platform: linux64-snap-upstream-try
            build_type: debug
        index:
            product: firefox
            job-name: amd64-try-debug
            type: generic
        worker:
            max-run-time: 7200
        run:
            using: run-task
            command: >-
              ./run.sh try 1
        treeherder:
            platform: linux64-snap-amd64-try/debug
