PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

[FIXED] Why Google Cloud Build is passing data between steps without any configuration in cloudbuild.yaml file

 September 26, 2022     continuous-deployment, continuous-integration, google-cloud-build, google-cloud-platform     No comments   

Issue

Refer to Google Cloud documentation Passing data between build steps

It says -

Cloud Build runs your tasks as a series of build steps, which execute in isolated and containerized environments. After each step, the container is discarded. This allows you to have totally different tools and environments for each step, and by default, any data created in one step can't contaminate the next step. But sometimes you may need to persist state from one step of a build to use in subsequent steps.

Now refer to the below cloudbuild.yaml code from Google Cloud Documentation example.

 
steps:
# Step 1
- name: node
  entrypoint: npm
  args: ['install']

# Step 2
- name: node
  entrypoint: npm
  args: ['test']

Question: Why and how the above example runs successfully even if we don’t have a step to install the requirements again in step 2. Because as per my thinking, the step 2 should get fail (but it is not actually) as the installations done in step 1 should get discarded as per the documentation. Thanks!


Solution

The reason both steps succeed is because the command npm install will download/install the dependencies of your application in a persistent volume in CloudBuild runners which is shared between all of your steps and then the npm test will run against your app code which is sitting under the same shared volume. This volume name is /workspace.

Take a closer look at this part of the documentation which will give you more details on how the data is shared between steps: https://cloud.google.com/build/docs/configuring-builds/pass-data-between-steps#passing_data_using_workspaces



Answered By - CaioT
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing