PROFESSIONAL-CLOUD-DEVELOPER · Question #155
You are using Cloud Build for your CI/CD pipeline to complete several tasks, including copying certain files to Compute Engine virtual machines. Your pipeline requires a flat file that is generated in
The correct answer is B. Output the file contents to a file in /workspace. Read from the same /workspace file in the. In Cloud Build, the /workspace directory is a shared volume that is automatically mounted and persisted across all build steps (builders) within the same pipeline. Any file written to /workspace in one step is immediately available to subsequent steps without any additional confi
Question
You are using Cloud Build for your CI/CD pipeline to complete several tasks, including copying certain files to Compute Engine virtual machines. Your pipeline requires a flat file that is generated in one builder in the pipeline to be accessible by subsequent builders in the same pipeline. How should you store the file so that all the builders in the pipeline can access it?
Options
- AStore and retrieve the file contents using Compute Engine instance metadata.
- BOutput the file contents to a file in /workspace. Read from the same /workspace file in the
- CUse gsutil to output the file contents to a Cloud Storage object. Read from the same object in the
- DAdd a build argument that runs an HTTP POST via curl to a separate web server to persist the
How the community answered
(32 responses)- B94% (30)
- C3% (1)
- D3% (1)
Explanation
In Cloud Build, the /workspace directory is a shared volume that is automatically mounted and persisted across all build steps (builders) within the same pipeline. Any file written to /workspace in one step is immediately available to subsequent steps without any additional configuration. This is the intended mechanism for inter-step file sharing in Cloud Build. Option C (Cloud Storage) would technically work but adds unnecessary latency and complexity. Option A (Compute Engine instance metadata) is unrelated to Cloud Build's pipeline architecture. Option D (HTTP POST to a web server) introduces external dependencies and is an anti-pattern for this use case.
Topics
Community Discussion
No community discussion yet for this question.