Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: recipes/recipes/infra_continuous.py

Issue 2101753004: Make infra-continuous-precise-64 cross-compile Go cipd package for Linux ARM. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@cross-compile-build
Patch Set: fix unrelated pylint errors >_< Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | recipes/recipes/infra_continuous.expected/infra-cross-compile.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipes/recipes/infra_continuous.py
diff --git a/recipes/recipes/infra_continuous.py b/recipes/recipes/infra_continuous.py
index e585408e13a95ffe11a7b4330a00577d0a59c1c2..6982a8648d5b4f2a60ab1769f0d4f54f00b56bd5 100644
--- a/recipes/recipes/infra_continuous.py
+++ b/recipes/recipes/infra_continuous.py
@@ -20,17 +20,36 @@ DEPS = [
]
-def build_cipd_packages(api, repo, rev, mastername, buildername, buildnumber):
- # Build packages locally.
+# Builder name => [{GOOS: ..., GOARCH: ...}].
+CROSS_COMPILING_BUILDERS = {
+ 'infra-continuous-precise-64': [{'GOOS': 'linux', 'GOARCH': 'arm'}],
+}
+
+
+def build_cipd_packages(api, repo, rev, mastername, buildername, buildnumber,
+ goos, goarch):
+ # 'goos' and 'goarch' used for cross-compilation of Go code.
+ step_suffix = ''
+ env = {}
+ if goos or goarch:
+ assert goos and goarch, 'Both GOOS and GOARCH should be set'
+ step_suffix = ' [GOOS:%s GOARCH:%s]' % (goos, goarch)
+ env = {'GOOS': goos, 'GOARCH': goarch}
+
+ # Build packages (don't upload them yet).
api.python(
- 'cipd - build packages',
+ 'cipd - build packages' + step_suffix,
api.path['checkout'].join('build', 'build.py'),
- ['--builder', api.properties.get('buildername')])
+ ['--builder', api.properties.get('buildername')],
+ env=env)
- # Verify they are good.
- api.python(
- 'cipd - test packages integrity',
- api.path['checkout'].join('build', 'test_packages.py'))
+ # Verify they are good. Run tests only when building packages for the host
+ # platform, since the host can't run binaries build with cross-compilation
+ # enabled.
+ if not goos and not goarch:
+ api.python(
+ 'cipd - test packages integrity',
+ api.path['checkout'].join('build', 'test_packages.py'))
# Upload them, attach tags.
tags = [
@@ -40,7 +59,7 @@ def build_cipd_packages(api, repo, rev, mastername, buildername, buildnumber):
]
try:
return api.python(
- 'cipd - upload packages',
+ 'cipd - upload packages' + step_suffix,
api.path['checkout'].join('build', 'build.py'),
[
'--no-rebuild',
@@ -49,7 +68,8 @@ def build_cipd_packages(api, repo, rev, mastername, buildername, buildnumber):
api.cipd.default_bot_service_account_credentials,
'--json-output', api.json.output(),
'--builder', api.properties.get('buildername'),
- ] + ['--tags'] + tags)
+ ] + ['--tags'] + tags,
+ env=env)
finally:
step_result = api.step.active_result
output = step_result.json.output or {}
@@ -140,7 +160,10 @@ def RunSteps(api, mastername, buildername, buildnumber):
if buildnumber != -1:
build_cipd_packages(api, repo_name, rev, mastername, buildername,
- buildnumber)
+ buildnumber, None, None)
+ for spec in CROSS_COMPILING_BUILDERS.get(buildername, []):
+ build_cipd_packages(api, repo_name, rev, mastername, buildername,
+ buildnumber, spec['GOOS'], spec['GOARCH'])
else:
result = api.step('cipd - not building packages', None)
result.presentation.status = api.step.WARNING
@@ -212,6 +235,22 @@ def GenTests(api):
)
yield (
+ api.test('infra-cross-compile') +
+ api.properties.git_scheduled(
+ path_config='kitchen',
+ buildername='infra-continuous-precise-64',
+ buildnumber=123,
+ mastername='chromium.infra',
+ repository='https://chromium.googlesource.com/infra/infra',
+ ) +
+ api.override_step_data(
+ 'cipd - upload packages', api.json.output(cipd_json_output)) +
+ api.override_step_data(
+ 'cipd - upload packages [GOOS:linux GOARCH:arm]',
+ api.json.output(cipd_json_output))
+ )
+
+ yield (
api.test('infra_swarming') +
api.properties.git_scheduled(
path_config='kitchen',
« no previous file with comments | « no previous file | recipes/recipes/infra_continuous.expected/infra-cross-compile.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698