# 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:
    - fetch
    - toolchain

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

tasks:
    cron:
        description: Cron Job for Updatebot
        run-on-projects: []
        treeherder:
            kind: other
            platform: updatebot/all
            symbol: cron
            tier: 1
        worker-type: b-linux-gcp
        worker:
            docker-image: {in-tree: updatebot}
            max-run-time: 4500
            taskcluster-proxy: true
        scopes:
            - secrets:get:project/updatebot/{level}/try-sshkey
            - secrets:get:project/updatebot/{level}/phabricator-token
            - secrets:get:project/updatebot/{level}/bugzilla-api-key
            - secrets:get:project/updatebot/{level}/database-password
            - secrets:get:project/updatebot/{level}/sentry-url
            - secrets:get:project/updatebot/{level}/sql-proxy-config
            - hooks:trigger-hook:project-gecko/in-tree-action-1-generic/*
        run:
            using: run-task
            command: /builds/worker/run.py /builds/worker/checkouts/gecko /builds/worker/updatebot
        notifications:
            subject: 'updatebot cron failed'
            message: 'updatebot cron failed'
            status-types:
                - on-failed
                - on-exception
            emails: ["tom@mozilla.com", "fbraun@mozilla.com"]
        fetches:
            toolchain:
                - linux64-rust
                - linux64-cargo-vet

    cron-win:
        description: Cron Job for Updatebot (Windows)
        run-on-projects: []
        treeherder:
            kind: other
            platform: updatebot/all
            symbol: w-cron
            tier: 1
        worker-type: b-win2022
        worker:
            max-run-time: 4500
            taskcluster-proxy: true
            # begin _GENERATE_DEPOT_TOOLS_BINARIES_
            # artifacts:
            #     - type: directory
            #       name: public/depot_tools.zip
            #       path: build\src\obj-build\depot_tools
            # end _GENERATE_DEPOT_TOOLS_BINARIES_
            env:
                TOOLTOOL_MANIFEST: "taskcluster/kinds/updatebot/tooltool-manifests/updatebot.manifest"
                MSYSTEM: "MINGW64"
        run:
            using: run-task
            cwd: '{checkout}'
            command: ./taskcluster/docker/updatebot/windows-setup.sh
            tooltool-downloads: internal
        scopes:
            - secrets:get:project/updatebot/{level}/try-sshkey
            - secrets:get:project/updatebot/{level}/phabricator-token
            - secrets:get:project/updatebot/{level}/bugzilla-api-key
            - secrets:get:project/updatebot/{level}/database-password
            - secrets:get:project/updatebot/{level}/sentry-url
            - secrets:get:project/updatebot/{level}/sql-proxy-config
            - hooks:trigger-hook:project-gecko/in-tree-action-1-generic/*
        fetches:
            fetch:
                - cloud-sql-proxy-1.25.0
                - php-windows-7.4.24
                - arcanist
                - depot_tools
