Complete the code to specify the build steps in a Cloud Build configuration file.
steps: - name: 'gcr.io/cloud-builders/[1]' args: ['build', '-t', 'gcr.io/my-project/my-image', '.']
The docker builder is used to build Docker images in Cloud Build steps.
Complete the code to trigger a build on a push to the main branch.
triggerTemplate: branchName: '[1]' repoName: 'my-repo'
The build trigger activates when code is pushed to the main branch.
Fix the error in the Cloud Build YAML to correctly specify the image push step.
steps: - name: 'gcr.io/cloud-builders/docker' args: ['[1]', 'gcr.io/my-project/my-image']
The push command uploads the built image to the container registry.
Fill both blanks to define a substitution variable and use it in the build args.
substitutions: _IMAGE_TAG: '[1]' steps: - name: 'gcr.io/cloud-builders/docker' args: ['build', '-t', 'gcr.io/my-project/my-image:[2]', '.']
The substitution variable _IMAGE_TAG is set to 'v1.0.0' and used in the image tag.
Fill all three blanks to configure a Cloud Build step that runs tests, stores results, and sets a timeout.
steps: - name: 'gcr.io/cloud-builders/[1]' args: ['test'] id: 'run-tests' waitFor: ['-'] timeout: '[2]s' artifacts: objects: location: 'gs://my-bucket/test-results' paths: ['[3]']
The step uses the pytest builder to run tests, sets a 600 second timeout, and stores results in 'test-results.xml'.