0
0
GCPcloud~10 mins

Cloud Build for CI/CD in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the build steps in a Cloud Build configuration file.

GCP
steps:
  - name: 'gcr.io/cloud-builders/[1]'
    args: ['build', '-t', 'gcr.io/my-project/my-image', '.']
Drag options to blanks, or click blank then click option'
Akubectl
Bdocker
Cgcloud
Dbash
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'kubectl' instead of 'docker' for building images.
Using 'gcloud' which is for Google Cloud CLI, not building images.
2fill in blank
medium

Complete the code to trigger a build on a push to the main branch.

GCP
triggerTemplate:
  branchName: '[1]'
  repoName: 'my-repo'
Drag options to blanks, or click blank then click option'
Arelease
Bfeature
Cdevelop
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using a feature branch name which is not the main branch.
Using 'develop' which is often used for development but not production triggers.
3fill in blank
hard

Fix the error in the Cloud Build YAML to correctly specify the image push step.

GCP
steps:
  - name: 'gcr.io/cloud-builders/docker'
    args: ['[1]', 'gcr.io/my-project/my-image']
Drag options to blanks, or click blank then click option'
Apush
Bpull
Cbuild
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pull' which downloads images instead of uploading.
Using 'run' which executes containers, not pushes images.
4fill in blank
hard

Fill both blanks to define a substitution variable and use it in the build args.

GCP
substitutions:
  _IMAGE_TAG: '[1]'
steps:
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/my-project/my-image:[2]', '.']
Drag options to blanks, or click blank then click option'
Av1.0.0
Blatest
Cv2.1.3
Dstable
Attempts:
3 left
💡 Hint
Common Mistakes
Using different values for substitution and image tag causing mismatch.
Using 'latest' which is a moving tag, not a fixed version.
5fill in blank
hard

Fill all three blanks to configure a Cloud Build step that runs tests, stores results, and sets a timeout.

GCP
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]']
Drag options to blanks, or click blank then click option'
Anpm
Bpytest
Ctest-results.xml
D600
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm' which is for Node.js but not the test runner here.
Setting timeout too low or too high without matching the options.
Incorrect artifact path causing missing test results.