OLD | NEW |
| (Empty) |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 """Recipe to build CIPD package with sealed Conda environment. | |
6 | |
7 Supposed to be used from manually triggered Buildbot builders. We aren't | |
8 expecting rebuilding this environment often, so setting up and periodic schedule | |
9 is a waste of resources. | |
10 | |
11 To build a new package for all platforms: | |
12 1. Manually trigger all builders by clicking buttons in Buildbot. | |
13 2. Once they all complete, tag the with some release identifier by running: | |
14 ./cipd set-tag infra/conda_python/scientific/ \ | |
15 -tag=release:<name> \ | |
16 -version=latest | |
17 3. Update Puppet configs to use 'release:<name>' as a version. | |
18 """ | |
19 | |
20 DEPS = [ | |
21 'cipd', | |
22 'conda', | |
23 'file', | |
24 'recipe_engine/path', | |
25 'recipe_engine/platform', | |
26 'recipe_engine/properties', | |
27 ] | |
28 | |
29 | |
30 # See https://repo.continuum.io/miniconda/. Miniconda3 is not supported. | |
31 CONDA_VERSION = 'Miniconda2-3.18.3' | |
32 | |
33 | |
34 # These conda packages will be installed into Conda environment. | |
35 EXTRA_CONDA_PACKAGES = [ | |
36 'matplotlib', | |
37 'numpy', | |
38 'scipy', | |
39 ] | |
40 | |
41 | |
42 def RunSteps(api): | |
43 api.cipd.install_client() | |
44 cipd_pkg_name = 'infra/conda_python/scientific/' + api.cipd.platform_suffix() | |
45 cipd_pkg_file = api.path['slave_build'].join('conda_python.cipd') | |
46 | |
47 # Prepare staging directory to install conda into. | |
48 staging_dir = api.path['slave_build'].join('conda_staging_dir') | |
49 api.file.rmtree('cleaning staging dir', staging_dir) | |
50 | |
51 # Install miniconda and all Conda packages, package in CIPD and upload. | |
52 with api.conda.install(CONDA_VERSION, staging_dir) as conda: | |
53 for pkg in EXTRA_CONDA_PACKAGES: | |
54 conda.install(pkg) | |
55 try: | |
56 conda.convert_to_cipd_package(cipd_pkg_name, cipd_pkg_file) | |
57 api.cipd.set_service_account_credentials( | |
58 api.cipd.default_bot_service_account_credentials) | |
59 tags = { | |
60 'buildbot_build': '%s/%s/%s' % ( | |
61 api.properties['mastername'], | |
62 api.properties['buildername'], | |
63 api.properties['buildnumber']), | |
64 'conda': CONDA_VERSION.replace('.', '-'), | |
65 } | |
66 api.cipd.register( | |
67 package_name=cipd_pkg_name, | |
68 package_path=cipd_pkg_file, | |
69 refs=['latest'], | |
70 tags=tags) | |
71 finally: | |
72 api.file.remove('remove *.cipd file', cipd_pkg_file) | |
73 | |
74 | |
75 def GenTests(api): | |
76 yield ( | |
77 api.test('linux') + | |
78 api.platform.name('linux') + | |
79 api.properties.generic(path_config='kitchen') | |
80 ) | |
81 yield ( | |
82 api.test('mac') + | |
83 api.platform.name('mac') + | |
84 api.properties.generic(path_config='kitchen') | |
85 ) | |
86 yield ( | |
87 api.test('win') + | |
88 api.platform.name('win') + | |
89 api.properties.generic(path_config='kitchen') | |
90 ) | |
OLD | NEW |