Do not fail the build if adb, dart, etc process do not exist.
Builds are failing because we try to kill windows processes at the end
of the task execution. This is expected and we should avoid failing the
full task when that happens.
Change-Id: I681179cf255069e3f9a24536d527c68d8034ec96
Bug: https://github.com/flutter/flutter/issues/63699
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/5623
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/os_utils/api.py b/recipe_modules/os_utils/api.py
index 63e0a54..ca0eaeb 100644
--- a/recipe_modules/os_utils/api.py
+++ b/recipe_modules/os_utils/api.py
@@ -4,6 +4,8 @@
from recipe_engine import recipe_api
+from PB.go.chromium.org.luci.buildbucket.proto import common as common_pb2
+
class FlutterDepsApi(recipe_api.RecipeApi):
"""Operating system utilities."""
@@ -15,7 +17,10 @@
name(str): The name of the step.
exe_name(str): The name of the windows executable.
"""
- self.m.step(name, ['taskkill', '/f', '/im', exe_name, '/t'], ok_ret='any')
+ try:
+ step_result = self.m.step(name, ['taskkill', '/f', '/im', exe_name, '/t'])
+ except (self.m.step.StepFailure, self.m.step.InfraFailure):
+ pass
def kill_win_processes(self):
"""Kills windows processes.
diff --git a/recipe_modules/os_utils/examples/full.expected/with_failures.json b/recipe_modules/os_utils/examples/full.expected/with_failures.json
new file mode 100644
index 0000000..c0bbb8d
--- /dev/null
+++ b/recipe_modules/os_utils/examples/full.expected/with_failures.json
@@ -0,0 +1,52 @@
+[
+ {
+ "cmd": [],
+ "name": "Killing Windows Processes",
+ "~followup_annotations": [
+ "@@@STEP_FAILURE@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "taskkill",
+ "/f",
+ "/im",
+ "java.exe",
+ "/t"
+ ],
+ "name": "Killing Windows Processes.stop gradle daemon",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "taskkill",
+ "/f",
+ "/im",
+ "dart.exe",
+ "/t"
+ ],
+ "name": "Killing Windows Processes.stop dart",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_FAILURE@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "taskkill",
+ "/f",
+ "/im",
+ "adb.exe",
+ "/t"
+ ],
+ "name": "Killing Windows Processes.stop adb",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipe_modules/os_utils/examples/full.py b/recipe_modules/os_utils/examples/full.py
index f0e03c1..103884b 100644
--- a/recipe_modules/os_utils/examples/full.py
+++ b/recipe_modules/os_utils/examples/full.py
@@ -7,6 +7,7 @@
DEPS = [
'flutter/os_utils',
'recipe_engine/platform',
+ 'recipe_engine/python',
]
@@ -19,3 +20,6 @@
'basic',
api.platform('win', 64),
)
+ yield api.test(
+ 'with_failures', api.platform('win', 64),
+ api.step_data("Killing Windows Processes.stop dart", retcode=1))