Skip to content

Commit

Permalink
[ci_yaml_roller] Support main branch
Browse files Browse the repository at this point in the history
This won't create a new config for main

Bug: flutter/flutter#90476
Test: CQ
Change-Id: Ib52743a241f6f09a178a648eae772dac0c074abe
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/18700
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Casey Hillers <chillers@google.com>
  • Loading branch information
Casey Hillers authored and CQ Bot Account committed Oct 6, 2021
1 parent 6cb970e commit 02d482f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions recipes/infra/ci_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def _is_postsubmit(api):
return api.buildbucket.build.builder.bucket == 'prod'


def _is_default_branch(branch):
"""Returns True if branch is master or main."""
return branch in ("main", "master")

def RunSteps(api):
"""Steps to checkout infra, dependencies, and generate new config."""
start_path = api.path['start_dir']
Expand Down Expand Up @@ -77,7 +81,7 @@ def RunSteps(api):
api.step('pub get', cmd=['pub', 'get'])
generate_jspb_path = cocoon_path.join('app_dart', 'bin', 'generate_jspb.dart')
config_name = '%s_config.json' % repo
if git_branch and git_branch != 'master':
if git_branch and not _is_default_branch(git_branch):
config_name = '%s_%s_config.json' % (repo, git_branch)
infra_config_path = infra_path.join('config', 'generated', 'ci_yaml', config_name)
# Generate_jspb
Expand Down Expand Up @@ -119,7 +123,7 @@ def GenTests(api):
revision = 'abc123'
),
api.properties(
git_branch='master',
git_branch='main',
git_repo='engine'
),
api.repo_util.flutter_environment_data(
Expand Down

0 comments on commit 02d482f

Please sign in to comment.