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

Side by Side Diff: scripts/slave/recipes/infra/gae_sdk_cipd_packager.py

Issue 2355483004: Add CIPD GAE SDK recipe module and packager. (Closed)
Patch Set: Go SDKs need architecture. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
iannucci 2016/09/30 21:05:21 This recipe should have been a separate CL
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 DEPS = [
6 'depot_tools/cipd',
7 'gae_sdk',
8 'gsutil',
9 'recipe_engine/path',
10 'recipe_engine/python',
11 'recipe_engine/raw_io',
12 'recipe_engine/step',
13 ]
14
15
16 def RunSteps(api):
17 # Determine the current GAE SDK version.
18 try:
19 version = api.gae_sdk.latest_upstream_version()
20 except api.gae_sdk.VersionParseError as e:
21 api.python.failing_step('Version Fetch',
22 'Failed to fetch latest version: %s' % (e,))
23
24 # Make sure the CIPD client is installed.
25 api.cipd.install_client()
26
27 # Iterate over all of the GAE SDK packages and build any that don't exist.
28 version_tag = api.gae_sdk.version_tag(version)
29 pkg_outdir = api.path.mkdtemp('gae_sdk_package')
30 for plat, arch in api.gae_sdk.all_packages:
31 pkg_name = api.gae_sdk.package(plat, arch=arch)
32 with api.step.nest('Sync %s' % (pkg_name,)):
33 step = api.cipd.search(pkg_name, '%s:%s' % (version_tag))
34 if len(step.json.output['result']) > 0:
35 api.python.succeeding_step('Synced', 'Package is up to date.')
36 continue
37
38 # Create a temporary directory to build the package in.
39 pkg_base = api.gae_sdk.download_and_unpack(plat, arch, version)
40
41 # Build and register our CIPD package.
42 pkg_path = pkg_outdir.join('gae_sdk_%s_%s.pkg' % (plat, arch))
43 api.cipd.build(
44 pkg_base,
45 pkg_path,
46 pkg_name,
47 install_mode='copy',
48 )
49 api.cipd.register(
50 pkg_name,
51 pkg_path,
52 refs=[api.gae_sdk.latest_ref],
53 tags={version_tag[0]: version_tag[1]},
54 )
55
56
57 def GenTests(api):
58 LATEST_YAML = '\n'.join((
59 'release: "1.2.3"',
60 'foo: bar',
61 'baz:',
62 ' - qux',
63 ))
64
65 def cipd_pkg(plat, pkg_base, exists):
66 pkg_name = 'infra/gae_sdk/%s/%s' % (plat, pkg_base)
67 cipd_step = 'cipd search %s gae_sdk_version:1.2.3' % (pkg_name,)
68 instances = (2) if exists else (0)
69 return api.step_data('Sync %s.%s' % (pkg_name, cipd_step),
70 api.cipd.example_search(pkg_name, instances=instances))
71
72 yield (api.test('packages') +
73 api.step_data('gsutil GAE SDK: Get Latest',
74 api.raw_io.stream_output(LATEST_YAML, stream='stdout')) +
75 cipd_pkg('go', 'linux-amd64', False) +
76 cipd_pkg('go', 'linux-386', True) +
77 cipd_pkg('go', 'mac-amd64', True) +
78 cipd_pkg('python', 'all', False))
79
80 yield (api.test('bad_version_yaml') +
81 api.step_data('gsutil GAE SDK: Get Latest',
82 api.raw_io.stream_output('', stream='stdout')))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698