Google Cloud Professional Cloud Developer — Question 211
Your company’s corporate policy states that there must be a copyright comment at the very beginning of all source files. You want to write a custom step in Cloud Build that is triggered by each source commit. You need the trigger to validate that the source contains a copyright and add one for subsequent steps if not there. What should you do?
Answer options
- 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.
Correct answer: A
Explanation
The correct answer is A because it specifies that changes are committed back to the source repository, ensuring that all files meet the corporate policy after validation. Option B does not commit changes, which fails to adhere to the policy. Options C and D involve using a Cloud Storage bucket instead of the source repository, which is not aligned with the requirement to validate and update the source files directly in the repository.