Deploy docs to firebase only from main.
Docs from release candidate branches will use a different builder to
deploy to firebase.
Change-Id: I19e2cc10d8445506cec188ae611d06fbf4dc58b3
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/34602
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
diff --git a/recipe_modules/adhoc_validation/api.py b/recipe_modules/adhoc_validation/api.py
index 67fa7f4..e15c6ba 100644
--- a/recipe_modules/adhoc_validation/api.py
+++ b/recipe_modules/adhoc_validation/api.py
@@ -60,16 +60,18 @@
else:
with self.m.context(env=env, env_prefixes=env_prefixes):
self.m.test_utils.run_test(validation, [resource_name])
- if ((validation == 'docs' and self.m.properties.get('firebase_project')) or
- (validation == 'docs_deploy') and self.m.properties.get('firebase_project')):
+ if ((validation == 'docs' or validation == 'docs_deploy') and
+ self.m.properties.get('firebase_project')):
docs_path = checkout_path.join('dev', 'docs')
# Do not upload on docs_deploy.
if not validation == 'docs_deploy':
self.m.bucket_util.upload_folder('Upload API Docs', docs_path, 'doc', "api_docs.zip")
project = self.m.properties.get('firebase_project')
- self.m.firebase.deploy_docs(
- env=env,
- env_prefixes=env_prefixes,
- docs_path=docs_path,
- project=project
- )
+ # Only deploy to firebase directly if this is master or main.
+ if (self.m.properties.get('git_branch') in ['master', 'main']):
+ self.m.firebase.deploy_docs(
+ env=env,
+ env_prefixes=env_prefixes,
+ docs_path=docs_path,
+ project=project
+ )
diff --git a/recipe_modules/adhoc_validation/examples/full.expected/linux.json b/recipe_modules/adhoc_validation/examples/full.expected/linux.json
index f91dc9d..b579076 100644
--- a/recipe_modules/adhoc_validation/examples/full.expected/linux.json
+++ b/recipe_modules/adhoc_validation/examples/full.expected/linux.json
@@ -21,7 +21,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -48,7 +48,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -80,7 +80,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -113,7 +113,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -145,7 +145,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -179,7 +179,7 @@
],
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -217,7 +217,7 @@
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
"GCP_PROJECT": "myproject",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
@@ -246,7 +246,7 @@
"env": {
"DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
"GCP_PROJECT": "myproject",
- "GIT_BRANCH": "",
+ "GIT_BRANCH": "main",
"LUCI_BRANCH": "",
"LUCI_CI": "True",
"LUCI_PR": "",
diff --git a/recipe_modules/adhoc_validation/examples/full.py b/recipe_modules/adhoc_validation/examples/full.py
index 038cfe8..5aacd56 100644
--- a/recipe_modules/adhoc_validation/examples/full.py
+++ b/recipe_modules/adhoc_validation/examples/full.py
@@ -31,7 +31,7 @@
)
yield api.test(
'linux', api.platform.name('linux'),
- api.properties(firebase_project='myproject'),
+ api.properties(firebase_project='myproject', git_branch='main'),
api.repo_util.flutter_environment_data(checkout_path)
)
yield api.test(