Run a Cloud Build custom step on each commit to verify each source file contains a copyright header and add one if missing. Which design should you implement?
Choose an answer
Tap an option to check your answer.
Correct answer: Build a Docker image that inspects files in /workspace, adds missing copyright headers, and explicitly commits changed files back to the source repository..
Why this is the answer
Cloud Build stages your source code in the /workspace directory within the build environment. A custom step, implemented as a Docker image, can access and modify these files directly. To ensure the copyright headers are permanently added, the modified files must be committed back to the source repository. This makes the changes persistent across commits. The incorrect option that doesn't commit changes back to the repository would only apply the headers temporarily during the build, losing them afterward. The options involving Cloud Storage are incorrect because Cloud Build operates on source code directly from the repository, not from Cloud Storage buckets for this purpose.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed