QuestionQ285

Building and testing applications

Your company’s corporate policy requires a copyright comment at the very start of every source file. You want to create a custom Cloud Build step that runs for each source commit. The trigger must verify that the source includes a copyright comment and add one for subsequent steps when it is absent. What should you do?

  • A Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
  • B Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files do not need to be committed back to the source repository.
  • C Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are written back to the Cloud Storage bucket.
  • D Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
Explanation

Cloud Build extracts source code into /workspace, and files written there by one build step are available to subsequent steps. A custom Docker container can inspect and update the source files in /workspace; the changes need not be committed back to the source repository merely to make them available during the remaining build steps.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!