
Ultimate access to all questions.
How can you store a flat file generated in one Cloud Build step to make it accessible to all subsequent builders in the same CI/CD pipeline?
(Note: The original question implied copying files to Compute Engine VMs, but the core focus is on inter-step file sharing within Cloud Build.)
# Example Cloud Build step referencing the shared file
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['compute', 'scp', '${_SHARED_FILE}', 'instance-name:~']
volumes:
- name: 'shared-vol'
path: '/workspace/shared'
# Example Cloud Build step referencing the shared file
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['compute', 'scp', '${_SHARED_FILE}', 'instance-name:~']
volumes:
- name: 'shared-vol'
path: '/workspace/shared'
(Code block corrected to use proper Cloud Build syntax with volumes for file sharing.)
A
Store and retrieve the file contents using Compute Engine instance metadata.
B
Output the file contents to a file in /workspace. Read from the same /workspace file in the subsequent build step.
C
Use gsutil to output the file contents to a Cloud Storage object. Read from the same object in the subsequent build step.
D
Add a build argument that runs an HTTP POST via curl to a separate web server to persist the value in one builder. Use an HTTP GET via curl from the subsequent build step to read the value.