Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releases/irios/build firefox #4

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ stages:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'
- klar_unit_test:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'

workflows:
firefox_configure_build:
before_run:
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ workers:
provisioner: scriptworker-k8s
implementation: scriptworker-bitrise
os: scriptworker
worker-type: mobile-{level}-bitrise
worker-type: mobile-{level}-bitrise-dev
images:
provisioner: 'mobile-{level}'
implementation: docker-worker
Expand Down
1 change: 1 addition & 0 deletions taskcluster/ffios_taskgraph/transforms/bitrise.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ def add_worker(config, tasks):
for task in tasks:
worker = task.setdefault("worker", {})
worker["bitrise"] = task.pop("bitrise")
task.setdefault("run-on-tasks-for", ["github-push"])
yield task
16 changes: 15 additions & 1 deletion taskcluster/kinds/build/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@ transforms:
- ffios_taskgraph.transforms.bitrise
- taskgraph.transforms.task

task-defaults:
worker-type: bitrise
bitrise:
artifact_prefix: public

tasks:
build-firefox-debug:
description: Build firefox_configure_build bitrise workflow
run-on-tasks-for:
- github-pull-request
- github-push
bitrise:
workflows:
- firefox_configure_build
optimization:
skip-unless-changed:
- bitrise.yml
screenshots:
description: Generate build instrumented for screenshots, including en-US pictures
attributes:
Expand All @@ -22,7 +37,6 @@ tasks:
platform: ios/opt
worker-type: bitrise
bitrise:
artifact_prefix: public
workflows:
- L10nBuild
index:
Expand Down
29 changes: 29 additions & 0 deletions taskcluster/kinds/complete/kind.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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:
- build

transforms:
- ffios_taskgraph.transforms.bitrise
- taskgraph.transforms.task

task-defaults:
worker-type: misc
requires: all-resolved
#run:
# command:
# task-reference:
# /builds/worker/checkouts/vcs/taskcluster/scripts/are_dependencies_completed.py <self>

tasks:
pr:
description: Build firefox_configure_build bitrise workflow
run-on-tasks-for:
- github-pull-request
- github-push
bitrise:
workflows: []
59 changes: 59 additions & 0 deletions taskcluster/scripts/are_dependencies_completed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python3

# 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/.

import argparse
import os

import taskcluster

queue = taskcluster.Queue(
{
"rootUrl": os.environ.get("TASKCLUSTER_PROXY_URL", "https://taskcluster.net"),
}
)


def check_all_dependencies_are_completed(current_task_id):
print(f"Fetching task definition of {current_task_id}...")
task = queue.task(current_task_id)
dependencies_task_ids = task["dependencies"]

print(f"Fetching status of {len(dependencies_task_ids)} dependencies...")
# TODO Make this dict-comprehension async once we go Python 3
state_per_task_ids = {
task_id: queue.status(task_id)["status"]["state"]
for task_id in dependencies_task_ids
}
print("Statuses fetched.")
non_completed_tasks = {
task_id: state
for task_id, state in state_per_task_ids.items()
if state != "completed"
}

if non_completed_tasks:
raise ValueError(f"Some tasks are not completed: {non_completed_tasks}")


def main():
parser = argparse.ArgumentParser(
description='Errors out if one of the DEPENDENCY_TASK_ID does not have the Taskcluster status "completed"'
)

parser.add_argument(
"current_task_id",
metavar="CURRENT_TASK_ID",
help="The task ID of the current running task",
)

result = parser.parse_args()
check_all_dependencies_are_completed(result.current_task_id)
print("All dependencies are completed. Reporting a green task!")
exit(0)


if __name__ == "__main__":
main()