Commit eec55274 authored by chrome-bot's avatar chrome-bot Committed by Commit Bot

Infra configuration for CELab E2E tests.

This is the missing configuration required for our LUCI bots.

Validation:
https://ci.chromium.org/swarming/task/4590997a141ce610

Change-Id: I781d4cf6c422501c34977eb2e78b8ac6e4a57b74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670446Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Mathieu Binette <mbinette@google.com>
Cr-Commit-Position: refs/heads/master@{#671695}
parent 9fb6629e
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is a .pyl, or "Python Literal", file. You can treat it just like a
# .json file, with the following exceptions:
# * all keys must be quoted (use single quotes, please);
# * comments are allowed, using '#' syntax; and
# * trailing commas are allowed.
{
# This is a map of buildbot master names -> buildbot builder names ->
# config names (where each config name is a key in the 'configs' dict,
# below). MB uses this dict to look up which config to use for a given bot.
'masters': {
'chromium.win': {
'win-celab-builder-rel': 'win-celab',
},
'tryserver.chromium.win': {
'win-celab-try-rel': 'win-celab',
},
},
# This is the list of configs that you can pass to mb; each config
# represents a particular combination of gn args that we must support.
'configs': {
'win-celab': [
'release_bot', 'minimal_symbols'
],
},
# This is a dict mapping a given 'mixin' name to a dict of settings that
# mb should use. See //tools/mb/docs/user_guide.md for more information.
'mixins':
{
'goma': {
'gn_args': 'use_goma=true strip_absolute_paths_from_debug_symbols=true',
},
'minimal_symbols': {
'gn_args': 'symbol_level=1',
},
'release': {
'gn_args': 'is_debug=false',
},
'release_bot': {
'mixins': ['release', 'static', 'goma'],
},
'static': {
'gn_args': 'is_component_build=false',
},
},
}
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import logging
import os
import sys
def ParseArgs():
parser = argparse.ArgumentParser(
description='Host file generator for CELab E2E tests')
all_tokens = ['project_id', 'storage_bucket', 'storage_prefix']
template_help = 'The full path to the *.host.textpb template file to use. '
template_help += 'Must contain the following tokens: %s' % all_tokens
parser.add_argument(
'--template', metavar='<host_file>', required=True, help=template_help)
parser.add_argument(
'--projects',
metavar='<projectA;projectB;...>',
dest="projects",
required=True,
help='The values to replace "<project_id>" with.')
parser.add_argument(
'--storage_bucket',
metavar='<token>',
dest="storage_bucket",
required=True,
help='The value to replace "<storage_bucket>" with.')
parser.add_argument(
'--storage_prefix',
metavar='<token>',
dest="storage_prefix",
required=True,
help='The value to replace "<storage_prefix>" with.')
parser.add_argument(
'--destination_dir',
metavar='<path>',
dest='destination',
required=True,
action='store',
help='Where to collect extra logs on test failures')
return parser.parse_args()
def ConfigureLogging(args):
logfmt = '%(asctime)s %(filename)s:%(lineno)s: [%(levelname)s] %(message)s'
datefmt = '%Y/%m/%d %H:%M:%S'
logging.basicConfig(level=logging.INFO, format=logfmt, datefmt=datefmt)
if __name__ == '__main__':
args = ParseArgs()
ConfigureLogging(args)
logging.info("Arguments: %s" % args)
if not os.path.exists(args.template):
raise ValueError('Template host file not found: %s' % args.template)
if not os.path.exists(args.destination):
raise ValueError('Destination directory not found: %s' % args.destination)
# Generate all the host files based off the arguments passed.
with open(args.template, 'r') as f:
template = f.read()
for project_id in args.projects.split(';'):
filename = "%s.host.textpb" % project_id
destination = os.path.join(args.destination, filename)
with open(destination, 'w') as f:
logging.info("Generating %s" % destination)
content = template.replace("<project_id>", project_id)
content = content.replace("<storage_bucket>", args.storage_bucket)
content = content.replace("<storage_prefix>", args.storage_prefix)
f.write(content)
sys.exit(0)
# This file is used as a template to generate host files for our CI tests.
# <xyz> tokens are replaced with real values by generate_host_files.py.
project {
# ID of the project. Note that it's not the name of the project.
name: '<project_id>'
# All assets will be created in this zone. Note that this is NOT the region name.
zone: 'us-west1-b'
}
# Where the logs go.
log_settings { admin_log: "admin" }
storage {
# The GCS storage bucket.
bucket: "<storage_bucket>",
# all files used by CEL will be put under this directory.
prefix: "<storage_prefix>"
}
machine_type {
# Name must match the host_machine_type field in the windows_machine asset
# entries.
name: 'win2012r2'
# Going to specify instance properties for a new GCE instance. Alternatively,
# we could specify a GCE instance template name.
instance_properties {
# Go with 2 CPUs and 7.5GB of RAM. This is the GCE machine type, not to be
# confused with the CEL machine_type.
machineType: 'projects/${host.project.name}/zones/${host.project.zone}/machineTypes/n1-standard-2'
# Scheduling options. By default instances are not pre-emptible.
scheduling {
automaticRestart: true
}
# Disks. We only need one disk
disks {
# autoDelete must be set to true when specifying initializeParams.
# Otherwise the toolchain will remind you.
autoDelete: true
# ... which is a boot disk. This can be left out since the first disk
# will become the boot disk by default.
boot: true
initializeParams {
# This is a special form for referencing the URL property of the image
# object named windows-2012-r2. Furthermore, this image type is not
# defined in this file. Instead see the builtins.textpb file for a list
# of builtin host assets that can be included for convenience.
sourceImage: '${host.image.windows-2012-r2.url}'
}
}
# Note that we are leaving a bunch of fields out because their defaults are
# reasonable. See the GCE documentation, and in particular the REST API
# documentation for what these fields do. For our convenience, we generate
# a .proto file containing the Compute API schema which has the same
# information. This generated .proto file can be found at
# /schema/gcp/compute/compute-api.proto.
}
}
machine_type {
# Name must match the host_machine_type field in the windows_machine asset
# entries.
name: 'win2008r2'
instance_properties {
machineType: 'projects/${host.project.name}/zones/${host.project.zone}/machineTypes/n1-standard-2'
scheduling {
automaticRestart: true
}
disks {
autoDelete: true
boot: true
initializeParams {
sourceImage: '${host.image.windows-2008-r2.url}'
}
}
}
}
machine_type {
# Name must match the host_machine_type field in the windows_machine asset
# entries.
name: 'win2016'
instance_properties {
machineType: 'projects/${host.project.name}/zones/${host.project.zone}/machineTypes/n1-standard-2'
scheduling {
automaticRestart: true
}
disks {
autoDelete: true
boot: true
initializeParams {
sourceImage: '${host.image.windows-2016.url}'
}
}
}
}
machine_type {
name: 'win7'
nested_vm {
image: 'gs://<storage_bucket>/images/win7_sp1_ent_unlicensed.img'
user_name: 'win7'
password: 'pass@word!'
}
}
machine_type {
name: 'win10'
nested_vm {
image: 'gs://<storage_bucket>/images/win10_pro_1803.img'
user_name: 'win10'
password: 'pass@word!'
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment