Refactor cloud build to change provenance source uri (#2419)
diff --git a/app_dart/cloudbuild_app_dart.yaml b/app_dart/cloudbuild_app_dart.yaml
index b1ddb96..534b77a 100644
--- a/app_dart/cloudbuild_app_dart.yaml
+++ b/app_dart/cloudbuild_app_dart.yaml
@@ -1,20 +1,40 @@
# Provide instructions for google Cloud Build to auto-build flutter
# dashboard to flutter-dashboard project. Auto-build will be triggered
-# by daily schedule on `main` branch. This cloudbuild calls two cloudbuild
-# configurations.
+# by daily schedule on `main` branch. This cloudbuild calls an additional
+# cloudbuild configuration responsible for deployment.
#
-# The first job is for generating the docker image with build provenance,
-# and the second uses the generated docker image and deploys it to app engine.
+# This job is for generating the docker image with build provenance,
+# and the deployment job uses the generated docker image and deploys it to
+# App Engine.
steps:
+ # Build dashboard.
+ # This step generates the dashboard files using flutter, then moves the
+ # generated files into the app_dart folder, where a docker image is then
+ # created in the next step.
+ - name: us-docker.pkg.dev/$PROJECT_ID/flutter/flutter
+ entrypoint: '/bin/bash'
+ args: ['cloud_build/dashboard_build.sh']
+
+ # Build docker image
+ - name: 'us-docker.pkg.dev/cloud-builders/ga/v1/docker'
+ args: ['build', '-t', 'us-docker.pkg.dev/$PROJECT_ID/appengine/default.version-$SHORT_SHA', 'app_dart']
+
+ # Trigger the cloud build that deploys the docker image
- name: gcr.io/cloud-builders/gcloud
entrypoint: '/bin/bash'
args:
- '-c'
- |-
- gcloud builds submit --config app_dart/cloudbuild_app_dart_docker.yaml \
- --substitutions="SHORT_SHA=$SHORT_SHA"
- gcloud builds submit --config app_dart/cloudbuild_app_dart_deploy.yaml \
- --substitutions="_GAE_PROMOTE=$_GAE_PROMOTE,SHORT_SHA=$SHORT_SHA"
+ gcloud builds submit \
+ --config app_dart/cloudbuild_app_dart_deploy.yaml \
+ --substitutions="_GAE_PROMOTE=$_GAE_PROMOTE,SHORT_SHA=$SHORT_SHA" \
+ --async
timeout: 1200s
+
+images: ['us-docker.pkg.dev/$PROJECT_ID/appengine/default.version-$SHORT_SHA']
+
+# If build provenance is not generated, the docker deployment will fail.
+options:
+ requestedVerifyOption: VERIFIED
diff --git a/app_dart/cloudbuild_app_dart_docker.yaml b/app_dart/cloudbuild_app_dart_docker.yaml
deleted file mode 100644
index 1c6f582..0000000
--- a/app_dart/cloudbuild_app_dart_docker.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-# Provide instructions for google Cloud Build to build and upload the flutter
-# dashboard docker image to artifact registry.
-
-steps:
- # Build dashboard.
- # This step generates the dashboard files using flutter, then moves the
- # generated files into the app_dart folder, where a docker image is then
- # created in the next step.
- - name: us-docker.pkg.dev/$PROJECT_ID/flutter/flutter
- entrypoint: '/bin/bash'
- args: ['cloud_build/dashboard_build.sh']
-
- # Build docker image
- - name: 'us-docker.pkg.dev/cloud-builders/ga/v1/docker'
- args: ['build', '-t', 'us-docker.pkg.dev/$PROJECT_ID/appengine/default.version-$SHORT_SHA', 'app_dart']
-
-timeout: 1200s
-
-images: ['us-docker.pkg.dev/$PROJECT_ID/appengine/default.version-$SHORT_SHA']
-
-# If build provenance is not generated, the docker deployment will fail.
-options:
- requestedVerifyOption: VERIFIED
diff --git a/auto_submit/cloudbuild_auto_submit.yaml b/auto_submit/cloudbuild_auto_submit.yaml
index 3d94295..06cfc19 100644
--- a/auto_submit/cloudbuild_auto_submit.yaml
+++ b/auto_submit/cloudbuild_auto_submit.yaml
@@ -1,20 +1,32 @@
# Provide instructions for google Cloud Build to auto-build flutter
# auto-submit bot to flutter-dashboard project. Auto-build will be triggered
-# by daily schedule on `main` branch. This cloudbuild calls two cloudbuild
-# configurations.
+# by daily schedule on `main` branch. This cloudbuild calls an additional
+# cloudbuild configuration responsible for deployment.
#
-# The first job is for generating the docker image with build provenance,
-# and the second uses the generated docker image and deploys it to app engine.
+# This job is for generating the docker image with build provenance,
+# and the deployment job uses the generated docker image and deploys it to
+# App Engine.
steps:
+ # Build docker image
+ - name: 'us-docker.pkg.dev/cloud-builders/ga/v1/docker'
+ args: ['build', '-t', 'us-docker.pkg.dev/$PROJECT_ID/appengine/auto-submit.version-$SHORT_SHA', 'auto_submit']
+
+ # Trigger the cloud build that deploys the docker image
- name: gcr.io/cloud-builders/gcloud
entrypoint: '/bin/bash'
args:
- '-c'
- |-
- gcloud builds submit --config auto_submit/cloudbuild_auto_submit_docker.yaml \
- --substitutions="SHORT_SHA=$SHORT_SHA"
- gcloud builds submit --config auto_submit/cloudbuild_auto_submit_deploy.yaml \
- --substitutions="_GAE_PROMOTE=$_GAE_PROMOTE,SHORT_SHA=$SHORT_SHA"
+ gcloud builds submit \
+ --config auto_submit/cloudbuild_auto_submit_deploy.yaml \
+ --substitutions="_GAE_PROMOTE=$_GAE_PROMOTE,SHORT_SHA=$SHORT_SHA" \
+ --async
timeout: 1200s
+
+images: ['us-docker.pkg.dev/$PROJECT_ID/appengine/auto-submit.version-$SHORT_SHA']
+
+# If build provenance is not generated, the docker deployment will fail.
+options:
+ requestedVerifyOption: VERIFIED
diff --git a/auto_submit/cloudbuild_auto_submit_docker.yaml b/auto_submit/cloudbuild_auto_submit_docker.yaml
deleted file mode 100644
index 475000e..0000000
--- a/auto_submit/cloudbuild_auto_submit_docker.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Provide instructions for google Cloud Build to build and upload the flutter
-# auto-submit docker image to artifact registry.
-
-steps:
- # Build docker image
- - name: 'us-docker.pkg.dev/cloud-builders/ga/v1/docker'
- args: ['build', '-t', 'us-docker.pkg.dev/$PROJECT_ID/appengine/auto-submit.version-$SHORT_SHA', 'auto_submit']
-
-timeout: 1200s
-
-images: ['us-docker.pkg.dev/$PROJECT_ID/appengine/auto-submit.version-$SHORT_SHA']
-
-# If build provenance is not generated, the docker deployment will fail.
-options:
- requestedVerifyOption: VERIFIED