blob: fc6ba509694debfda1589c1d27b62cb88af4d881 [file] [log] [blame]
#!/usr/bin/env lucicfg
# Copyright 2020 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Configurations for packaging builders.
The schedulers pull commits indirectly from GoB repo (https://chromium.googlesource.com/external/github.com/flutter/flutter)
which is mirrored from https://github.com/flutter/flutter.
"""
load("//lib/common.star", "common")
load("//lib/repos.star", "repos")
load("//lib/timeout.star", "timeout")
# Global OS variables
LINUX_OS = "Ubuntu"
WINDOWS_OS = "Windows"
MAC_OS = "Mac-12"
MAC_ARM64_OS = "Mac-12"
# Linux caches
LINUX_DEFAULT_CACHES = [
# Android SDK
swarming.cache(name = "android_sdk", path = "android"),
# Chrome
swarming.cache(name = "chrome_and_driver", path = "chrome"),
# OpenJDK
swarming.cache(name = "openjdk", path = "java"),
# PubCache
swarming.cache(name = "pub_cache", path = ".pub-cache"),
# Flutter SDK code
swarming.cache(name = "flutter_sdk", path = "flutter sdk"),
]
def _setup(branches):
platform_args = {
"linux": {
"os": LINUX_OS,
},
"mac": {
"os": MAC_OS,
"dimensions": {"cpu": "x86"},
},
"mac_arm64": {
"os": MAC_ARM64_OS,
"dimensions": {"cpu": "arm"},
},
"windows": {
"os": WINDOWS_OS,
},
}
luci.recipe(
name = "packaging/packaging",
recipe = "packaging/packaging",
cipd_package = "flutter/recipe_bundles/flutter.googlesource.com/recipes",
cipd_version = branches.main.recipes_ref,
use_bbagent = True,
)
packaging_prod_config(
platform_args,
"stable",
branches.stable.release_ref,
)
packaging_prod_config(
platform_args,
"beta",
branches.beta.release_ref,
)
packaging_prod_config(
platform_args,
"master",
# Note for master, there is no distinction between testing_ref &
# release_ref
"refs/heads/master",
)
def builder_name(pattern, branch):
return pattern % (branch.capitalize(), branch)
def packaging_prod_config(platform_args, branch, ref):
"""Prod configurations for packaging flutter framework artifacts.
Args:
platform_args(dict): Dictionary with default properties with platform as
key.
branch(str): The branch name we are creating configurations for.
ref(str): The git ref we are creating configurations for.
"""
# TODO(chillers): Migrate packaging builders to ci.yaml. https://github.com/flutter/flutter/issues/100806
# Defines console views for prod builders
console_view_name = ("packaging" if branch == "master" else "%s_packaging" % branch)
luci.console_view(
name = console_view_name,
repo = repos.GIT_REMOTE["flutter"],
refs = [ref],
)
# Defines prod schedulers
trigger_name = branch + "-gitiles-trigger-packaging"
luci.gitiles_poller(
name = trigger_name,
bucket = "prod",
repo = repos.GIT_REMOTE["flutter"],
refs = [ref],
)
# Defines triggering policy
if branch == "master":
triggering_policy = scheduler.greedy_batching(
max_concurrent_invocations = 6,
)
else:
triggering_policy = scheduler.greedy_batching(
max_concurrent_invocations = 3,
)
# Select which firebase project to upload the docs to.
firebase_project = ""
if branch == "stable":
firebase_project = "docs-flutter-dev"
# Packaging docs builds are only done on master and stable channels
# However, ci.yaml generates the master build
if branch in ("stable"):
common.linux_prod_builder(
name = "Linux%s docs_publish|docs" % ("" if branch == "master" else " " + branch),
recipe = "%s-flutter/flutter" % "main",
console_view_name = console_view_name,
triggered_by = [trigger_name],
triggering_policy = triggering_policy,
properties = {
"validation": "docs",
"validation_name": "Docs",
"dependencies": [{"dependency": "dashing"}, {"dependency": "firebase"}, {"dependency": "curl"}],
"firebase_project": firebase_project,
# This determines which release channel docs to deploy
"release_ref": ref,
},
caches = LINUX_DEFAULT_CACHES,
os = LINUX_OS,
execution_timeout = timeout.LONG,
expiration_timeout = timeout.LONG_EXPIRATION,
)
# Packaging should only build from release branches and never from master. This
# is to prevent using excesive amount of resources to package something we will
# never use.
if branch in ("beta", "stable"):
# Defines framework prod builders
common.linux_prod_builder(
name = builder_name("Linux Flutter %s Packaging|%s", branch),
recipe = "packaging/packaging",
console_view_name = console_view_name,
triggered_by = [trigger_name],
triggering_policy = triggering_policy,
properties = {
"dependencies": [{"dependency": "cosign"}],
"upload_with_cosign": True,
},
priority = 25,
**platform_args["linux"]
)
common.mac_prod_builder(
name = builder_name("Mac Flutter %s Packaging|%s", branch),
recipe = "packaging/packaging",
console_view_name = console_view_name,
triggered_by = [trigger_name],
triggering_policy = triggering_policy,
properties = {
"dependencies": [{"dependency": "cosign"}],
"upload_with_cosign": True,
},
priority = 25,
**platform_args["mac"]
)
common.mac_prod_builder(
name = builder_name("Mac Arm64 Flutter %s Packaging|%s", branch),
recipe = "packaging/packaging",
console_view_name = console_view_name,
triggered_by = [trigger_name],
triggering_policy = triggering_policy,
properties = {
"dependencies": [{"dependency": "cosign"}],
"upload_with_cosign": True,
},
priority = 25,
**platform_args["mac_arm64"]
)
common.windows_prod_builder(
name = builder_name("Windows Flutter %s Packaging|%s", branch),
recipe = "packaging/packaging",
console_view_name = console_view_name,
triggered_by = [trigger_name],
triggering_policy = triggering_policy,
properties = {
"dependencies": [{"dependency": "cosign"}],
"upload_with_cosign": True,
},
priority = 25,
**platform_args["windows"]
)
packaging_config = struct(setup = _setup)