aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules
diff options
context:
space:
mode:
Diffstat (limited to 'infra/bots/recipe_modules')
-rw-r--r--infra/bots/recipe_modules/flavor/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json4
-rw-r--r--infra/bots/recipe_modules/infra/__init__.py1
-rw-r--r--infra/bots/recipe_modules/infra/api.py15
-rw-r--r--infra/bots/recipe_modules/infra/examples/full.expected/failed_one_update.json10
-rw-r--r--infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json23
-rw-r--r--infra/bots/recipe_modules/infra/examples/full.py7
-rw-r--r--infra/bots/recipe_modules/run/api.py1
-rw-r--r--infra/bots/recipe_modules/run/examples/full.expected/test.json4
8 files changed, 60 insertions, 5 deletions
diff --git a/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json b/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
index 038be54a44..97855a9a92 100644
--- a/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
+++ b/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
@@ -52,7 +52,7 @@
"cmd": [
"python",
"-u",
- "import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n shutil.move(f, dst_path)\n",
+ "import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['bookmaker', 'dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n shutil.move(f, dst_path)\n",
"[START_DIR]/win_vulkan_sdk",
"[CUSTOM_[SWARM_OUT_DIR]]/out/Release_x64"
],
@@ -67,7 +67,7 @@
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@src = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@dst = sys.argv[2]@@@",
- "@@@STEP_LOG_LINE@python.inline@build_products_whitelist = ['dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']@@@",
+ "@@@STEP_LOG_LINE@python.inline@build_products_whitelist = ['bookmaker', 'dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@try:@@@",
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(dst)@@@",
diff --git a/infra/bots/recipe_modules/infra/__init__.py b/infra/bots/recipe_modules/infra/__init__.py
index 94aa82aa7b..5c5212f005 100644
--- a/infra/bots/recipe_modules/infra/__init__.py
+++ b/infra/bots/recipe_modules/infra/__init__.py
@@ -4,6 +4,7 @@
DEPS = [
'recipe_engine/context',
+ 'recipe_engine/file',
'recipe_engine/step',
'run',
'vars',
diff --git a/infra/bots/recipe_modules/infra/api.py b/infra/bots/recipe_modules/infra/api.py
index ee86cd9cdf..3b9b3871d0 100644
--- a/infra/bots/recipe_modules/infra/api.py
+++ b/infra/bots/recipe_modules/infra/api.py
@@ -65,6 +65,21 @@ class InfraApi(recipe_api.RecipeApi):
UPDATE_GO_ATTEMPTS,
cmd=[self.go_exe, 'get', '-u', '-t', '%s/...' % INFRA_GO_PKG])
+ class DownloadGitCookies(object):
+ """Class to download gitcookies from GS."""
+ def __init__(self, gs_path, local_path, api):
+ self._gs_path = gs_path
+ self._local_path = local_path
+ self._api = api
+
+ def __enter__(self):
+ cmd = ['gsutil', 'cp', self._gs_path, self._local_path]
+ self._api.step('download gitcookies', cmd=cmd, infra_step=True)
+
+ def __exit__(self, exc_type, _value, _traceback):
+ if self._api.path.exists(self._local_path):
+ self._api.file.remove('remove %s' % self._local_path, self._local_path)
+
class MetadataFetch():
def __init__(self, api, metadata_key, local_file, **kwargs):
self.m = api
diff --git a/infra/bots/recipe_modules/infra/examples/full.expected/failed_one_update.json b/infra/bots/recipe_modules/infra/examples/full.expected/failed_one_update.json
index a154c9da20..09d2726898 100644
--- a/infra/bots/recipe_modules/infra/examples/full.expected/failed_one_update.json
+++ b/infra/bots/recipe_modules/infra/examples/full.expected/failed_one_update.json
@@ -71,6 +71,16 @@
},
{
"cmd": [
+ "gsutil",
+ "cp",
+ "/test/gspath",
+ "[START_DIR]/localpath"
+ ],
+ "infra_step": true,
+ "name": "download gitcookies"
+ },
+ {
+ "cmd": [
"python",
"-u",
"\nimport os\nimport urllib2\n\nTOKEN_FILE = 'file'\nTOKEN_URL = 'http://metadata/computeMetadata/v1/project/attributes/key'\n\nreq = urllib2.Request(TOKEN_URL, headers={'Metadata-Flavor': 'Google'})\ncontents = urllib2.urlopen(req).read()\n\nhome = os.path.expanduser('~')\ntoken_file = os.path.join(home, TOKEN_FILE)\n\nwith open(token_file, 'w') as f:\n f.write(contents)\n"
diff --git a/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json b/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json
index 0437346f6f..b7613908e8 100644
--- a/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json
+++ b/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json
@@ -49,6 +49,29 @@
},
{
"cmd": [
+ "gsutil",
+ "cp",
+ "/test/gspath",
+ "[START_DIR]/localpath"
+ ],
+ "infra_step": true,
+ "name": "download gitcookies"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "remove",
+ "[START_DIR]/localpath"
+ ],
+ "infra_step": true,
+ "name": "remove [START_DIR]/localpath"
+ },
+ {
+ "cmd": [
"python",
"-u",
"\nimport os\nimport urllib2\n\nTOKEN_FILE = 'file'\nTOKEN_URL = 'http://metadata/computeMetadata/v1/project/attributes/key'\n\nreq = urllib2.Request(TOKEN_URL, headers={'Metadata-Flavor': 'Google'})\ncontents = urllib2.urlopen(req).read()\n\nhome = os.path.expanduser('~')\ntoken_file = os.path.join(home, TOKEN_FILE)\n\nwith open(token_file, 'w') as f:\n f.write(contents)\n"
diff --git a/infra/bots/recipe_modules/infra/examples/full.py b/infra/bots/recipe_modules/infra/examples/full.py
index af1c9f2b59..38b474035e 100644
--- a/infra/bots/recipe_modules/infra/examples/full.py
+++ b/infra/bots/recipe_modules/infra/examples/full.py
@@ -9,6 +9,7 @@
DEPS = [
'core',
'infra',
+ 'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
@@ -21,6 +22,9 @@ DEPS = [
def RunSteps(api):
api.vars.setup()
api.infra.update_go_deps()
+ with api.infra.DownloadGitCookies(
+ '/test/gspath', api.path['start_dir'].join('localpath'), api):
+ pass
with api.infra.MetadataFetch(api, 'key', 'file'):
pass
@@ -32,7 +36,8 @@ def GenTests(api):
repository='https://skia.googlesource.com/skia.git',
revision='abc123',
path_config='kitchen',
- swarm_out_dir='[SWARM_OUT_DIR]')
+ swarm_out_dir='[SWARM_OUT_DIR]') +
+ api.path.exists(api.path['start_dir'].join('localpath'))
)
yield (
diff --git a/infra/bots/recipe_modules/run/api.py b/infra/bots/recipe_modules/run/api.py
index bc6b00cf6a..af89d622b5 100644
--- a/infra/bots/recipe_modules/run/api.py
+++ b/infra/bots/recipe_modules/run/api.py
@@ -10,6 +10,7 @@ from recipe_engine import recipe_api
BUILD_PRODUCTS_ISOLATE_WHITELIST = [
+ 'bookmaker',
'dm',
'dm.exe',
'dm.app',
diff --git a/infra/bots/recipe_modules/run/examples/full.expected/test.json b/infra/bots/recipe_modules/run/examples/full.expected/test.json
index dce7c43faf..10a902d5ed 100644
--- a/infra/bots/recipe_modules/run/examples/full.expected/test.json
+++ b/infra/bots/recipe_modules/run/examples/full.expected/test.json
@@ -114,7 +114,7 @@
"cmd": [
"python",
"-u",
- "import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n shutil.move(f, dst_path)\n",
+ "import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['bookmaker', 'dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n shutil.move(f, dst_path)\n",
"src",
"dst"
],
@@ -129,7 +129,7 @@
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@src = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@dst = sys.argv[2]@@@",
- "@@@STEP_LOG_LINE@python.inline@build_products_whitelist = ['dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']@@@",
+ "@@@STEP_LOG_LINE@python.inline@build_products_whitelist = ['bookmaker', 'dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 'skpbench', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'vulkan-1.dll']@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@try:@@@",
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(dst)@@@",