Questions tagged [google-cloud-build]
For programming/API questions about Google Cloud Build, a service that executes builds, regardless of language, on the Google Cloud Platform infrastructure.
google-cloud-build
1,514
questions
65
votes
6
answers
15k
views
Can I delete container images from Google Cloud Storage artifacts bucket?
I have a Google App Engine app, which connects to Google Cloud Storage.
I noticed that the amount of data stored was unreasonably high (4.01 GB, when it should be 100MB or so).
So, I looked at how ...
62
votes
7
answers
26k
views
Cloud Build fails to deploy to Google App Engine - You do not have permission to act as @appspot.gserviceaccount.com
This morning I made a PR which triggered a Cloud Build for my staging enviroment but failed to deploy the results to GAE.
The error was as follows:
ERROR: (gcloud.app.deploy) PERMISSION_DENIED: You ...
55
votes
3
answers
30k
views
Is it possible to cache multi-stage docker builds?
I recently switched to multi-stage docker builds, and it doesn't appear that there's any caching on intermediate builds. I'm not sure if this is a docker limitation, something which just isn't ...
53
votes
5
answers
39k
views
Deploy individual services from a monorepo using github actions
I have around 10 individual micro-services which are mostly cloud functions for various data processing jobs, which all live in a single github repository.
The goal is to trigger the selective ...
48
votes
2
answers
27k
views
Google Cloud Build timing out
I have a Google Cloud Build build that times out after 10 min, 3 sec. Is there a way to extend that timeout?
The build status is set to "Build failed (timeout)" and I'm okay with it taking longer ...
28
votes
9
answers
9k
views
Google Cloud Build deploy to GKE Private Cluster
I'm running a Google Kubernetes Engine with the "private-cluster" option.
I've also defined "authorized Master Network" to be able to remotely access the environment - this works just fine.
Now I want ...
27
votes
5
answers
23k
views
gcloud - ERROR: (gcloud.app.deploy) Permissions error fetching application
I am trying to deploy node js app on google cloud but getting following error -
Step #1: ERROR: (gcloud.app.deploy) Permissions error fetching application [apps
/mytest-240512]. Please make sure you ...
26
votes
7
answers
44k
views
How to set environment variables using Google Cloud Build or other method in Google App Engine Standard Environment?
Is there anyway to inject environment variables from Cloud Build into the App Engine Standard environment?
I do not want to push my environment variables to GitHub inside the app.yaml or .env. Thus, ...
26
votes
6
answers
15k
views
How do I set an environment or substitution variable via a step in Google Cloud Build?
Basically, when using Google Cloud Build, how do I read a value that was written in an earlier build step in subsequent steps?
Specifically, I'd like to make a custom image tag that's based on a ...
25
votes
8
answers
29k
views
Specify Dockerfile for gcloud build submit
I understand gcloud uses the Dockerfile specified in the root directory of the source (.) as in the command:
gcloud builds submit --tag gcr.io/[PROJECT_ID]/quickstart-image .
but I am trying to ...
24
votes
4
answers
45k
views
Failed to get existing workspaces: querying Cloud Storage failed: storage: bucket doesn't exist
I was using terraform in cloud build, but it fails at this step
steps:
# Terraform
- id: 'configure_terraform'
name: node:10.16.3
entrypoint: "node"
args: ["./...
24
votes
3
answers
8k
views
Using Docker Buildkit on Google Cloud Build
I'm trying to use BuildKit with Docker on Google Cloud Build so that I can eventually use the --secret flag. I'm using Build Enhancements for Docker as a reference.
It works on my laptop when I use ...
23
votes
3
answers
9k
views
GitHub Cloud Build Integration with multiple cloudbuild.yamls in monorepo
GitHub's Google Cloud Build integration does not detect a cloudbuild.yaml or Dockerfile if it is not in the root of the repository.
When using a monorepo that contains multiple cloudbuild.yamls, how ...
22
votes
6
answers
10k
views
Run node.js database migrations on Google Cloud SQL during Google Cloud Build
I would like to run database migrations written in node.js during the Cloud Build process.
Currently, the database migration command is being executed but it seems that the Cloud Build process does ...
19
votes
3
answers
19k
views
Error publishing source code from cloud build to a bucket using triggers
I´m trying to publish the html code from one cloud source repository to a public storage bucket in gcp through a cloud build trigger . However , I get the following error in the build each time I push ...
19
votes
2
answers
18k
views
Google Cloud build conditional step
I have the following cloudbuild.yaml file:
substitutions:
_CLOUDSDK_COMPUTE_ZONE: us-central1-a
_CLOUDSDK_CONTAINER_CLUSTER: $_CLOUDSDK_CONTAINER_CLUSTER
steps:
- name: gcr.io/$PROJECT_ID/...
19
votes
2
answers
7k
views
How can I specify a region for the Cloud Storage buckets used by Cloud Build for a Cloud Run deployment?
When deploying a docker container image to Cloud Run, I can choose a region, which is fine. Cloud Run delegates the build to Cloud Build, which apparently creates two buckets to make this happen. ...
18
votes
6
answers
23k
views
Why am I seeing this error: 'ERROR: (gcloud.run.deploy) PERMISSION_DENIED: The caller does not have permission' while deploying container?
Assume I have a cloudbuild.yaml file like the one below. Also assume that I can run and deploy the container in question manually when using gcloud for the separate functionalities (building and ...
18
votes
4
answers
13k
views
Multiple commands in the same build step in Google Cloud Builder
I want to run our automated backend test suite on Google Cloud Builder environment. However, naturally, I bumped into the need to install various dependencies and prerequisites within the Cloud ...
18
votes
2
answers
9k
views
How can I save google cloud build step text output to file
I'm trying to use google cloud build. At one step, I need to get a list of all running compute instances.
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list']
and it works ...
18
votes
3
answers
6k
views
Communicate between two containers in Google cloud build
I am running my CI/CD pipeline in Google cloud build. My app has web and wget containers. I am trying to reach web from wget
Cloud build internally used cloudbuild bridge network while starting ...
17
votes
5
answers
15k
views
ERROR: (gcloud.beta.functions.deploy) ... message=[The caller does not have permission]
I am trying to deploy code from this repo:
https://github.com/anishkny/puppeteer-on-cloud-functions
in Google Cloud Build. My cloudbuild.yaml file contents are:
steps:
- name: 'gcr.io/cloud-...
17
votes
4
answers
8k
views
How can I grant the account permission to list enabled APIs?
During a build on Cloud Build, I get the following warning:
Step #2: WARNING: Unable to verify that the Appengine Flexible API is enabled for project [xxxxx]. You may not have permission to list ...
16
votes
8
answers
4k
views
GCP Cloud Function - ERROR fetching storage source during build/deploy
Running into problems building deploying functions. When trying to programmatically deploy the function I get the following output in builder logs (ERRORS).
2020-10-20T02:22:12.155866856Z starting ...
15
votes
2
answers
5k
views
Google Cloud Build - View logs permissions
I am the owner of a project and want to give Permissions to another user to view Logs of Google Cloud Build, but I can not figure out which Role / Permission this user needs.
Roles I've ...
15
votes
3
answers
5k
views
How to prevent cloud build from running builds in parallel?
We are using cloud build for continuous deployment on GCP. When pushing commits to fast (e.g. on development) the triggered builds are running in parallel. Sometimes those interfere which one another. ...
15
votes
4
answers
7k
views
How to access a GCP Cloud Source Repository from another project?
I have project A and project B.
I use a GCP Cloud Source Repository on project A as my 'origin' remote.
I use Cloud Build with a trigger on changes to the 'develop' branch of the repo to trigger ...
14
votes
1
answer
9k
views
GCP Cloud Build fails with permissions error even though correct role is granted
I setup a Cloud Build Trigger in my GCP project in order to deploy a Cloud Function from a Cloud Source Repository via a .yaml file. Everything seems to have been setup correctly and permissions ...
14
votes
3
answers
5k
views
Can I persist yarn install cache during docker build using RUN --mount=type=bind?
I'm trying to generate and re-use a yarn install cache when building a Docker image using Docker BuildKit. The yarn cache is persisted in the directory .yarn/cache and should never be included in the ...
12
votes
0
answers
3k
views
How do I get Google Cloud Build to properly substitute values when it responds to a GitHub trigger?
The Problem
A GitHub trigger set up in Google Cloud Build doesn't actually substitute the configured values while running the Build (cloudbuild.yaml)
This is the Google Cloud Build config
cloudbuild....
11
votes
2
answers
13k
views
Firebase Cloud messaging - permissions error for cloud build deployed app
I have a java spring boot backend app, that I am trying to hook up to Firebase Cloud Messages.
I have an android app that uses firebase and I am trying to use this backend to push notifications.
I've ...
11
votes
9
answers
11k
views
How to run a Google Cloud Build trigger via cli / rest api / cloud functions?
Is there such an option? My use case would be running a trigger for a production build (deploys to production). Ideally, that trigger doesn't need to listen to any change since it is invoked manually ...
11
votes
2
answers
1k
views
Firebase deploy function Build failed: Build error details not available
I have several projects having the same issue. It was deploying fine just a day ago. Now the deployment will quit with an error:
Build failed: Build error details not available.
The logs from the GCP ...
11
votes
1
answer
5k
views
Is there a way to allow cloudbuild steps to access the Cloud SQL in GCP
I'm setting up a cloud build trigger in order to deploy a PHP/Symfony Application. When the docker file runs the php app/console assetic:dump command in order to create the assets I get the following ...
10
votes
6
answers
10k
views
How to upgrade node js version on google cloud build
So I recently upgraded my app from Angular 7 to Angular 8 and I'm having issues with the node version of the cloud build VM as Angular 8 requires node version 10.9 or greater as shown below:
How can ...
10
votes
3
answers
4k
views
Trigger Google Cloud Build with Google Cloud Scheduler periodically
Is it somehow possible to trigger a Google Cloud Build with Google Cloud Scheduler periodically?
I can't find anything related to it on the Internet.
10
votes
3
answers
6k
views
Application Default Credentials in Google Cloud Build
Within my code, I am attempting to gather the Application Default Credentials from the associated service account in Cloud Build:
from google.auth import default
credentials, project_id = default()
...
10
votes
2
answers
3k
views
Can Google Cloud Build recurse through directories of artifacts?
My workspace looks like this:
|
|--> web-app
|
|--> src
|--> build
|
|--> fonts
|--> static
My cloudbuild.json looks like this:
{
"...
10
votes
2
answers
12k
views
Google Cloud Build - Pass environment variable for Dockerfile
I´m trying to dockerize my Angular application for Cloud Run and then conditionally build it with the production or the development configuration based on an environment variable.
cloud build command:
...
10
votes
4
answers
6k
views
In GCP, through Cloudbuild how can I ensure that only those steps get triggered for which changes have happened in file
My issue is that, given the below yaml file, if I'm making changes for example in any file of "dir: process/cbd-bu-data", Cloud Build runs all the steps serially when triggered. This leads to wastage ...
10
votes
1
answer
2k
views
cloudbuild.yaml include a different cloud builder configuration
My project is split into gitmodules like so:
/ +
|
+-module_1
| |
| +- cloudbuild.yaml
| +- src/
| +-.git/
|
+-module_2
| |
| +- cloudbuild.yaml
| +- src/
| +-.git/
...
10
votes
1
answer
697
views
Google Cloud Build not caching custom build steps?
Is it possible to have Google Cloud Build cache custom build step images? It appears to re-download them every build regardless of latest vs specific tags used in the name, which makes things slower ...
10
votes
2
answers
3k
views
How to use private, self hosted NPM package with Google App Engine node, standard environment
I have an NPM package hosted on a private Bitbucket git repo (not in the official NPM registry).
I have this in my package.json, under the "dependencies" key:
"a-private-package" git+ssh://git@...
9
votes
5
answers
2k
views
GCloud Build Failure: ERROR: failed to initialize analyzer, No such object
My most recent builds with GCloud all started failing recently and I am not really sure why. I keep getting 404 errors from the build attempting to find an image that doesn't exist.
Sample error:
...
9
votes
3
answers
5k
views
Bazel - Build, Push, Deploy Docker Containers to Kubernetes within Monorepo
I have a monorepo with some backend (Node.js) and frontend (Angular) services. Currently my deployment process looks like this:
Check if tests pass
Build docker images for my services
Push docker ...
9
votes
4
answers
7k
views
Plan Error: Cloud Resource Manager API has not been used
When I try to run
steps:
- id: Plan Terraform
name: hashicorp/terraform:light
args:
- plan
in Cloud Build, I get the error:
Error: Error reading Project Service foo/cloudbuild.googleapis.com: ...
9
votes
3
answers
3k
views
Google Cloud Build doesn't substitute values in secrets section of cloudbuild.yaml
I'm trying to create a Cloud Build trigger where secret environment variables are encrypted with cloud KMS and stored as a substitution variable in Cloud Build. This way my cloud build yaml is fairly ...
9
votes
2
answers
884
views
understanding "action required" email from GCP, re: enable Cloud Build API
I use Firebase for my web apps, not Google Cloud Platform -- though I'm aware that behind the scenes, every Firebase project is also a GCP project.
I just received an email from GCP, saying (...
9
votes
3
answers
11k
views
Secret environment variables in Cloudbuild (with out files), how?
I am creating a CI/CD pipeline in Cloud Build of a very basic Node.js app with deployment to GCP appengine standard.
None-secret environment variables are stored in app.yaml file. But of course I ...
9
votes
4
answers
3k
views
How to use PNPM with Google Cloud Build?
I'd like to migrate to PNPM, however, I can't find a way to use its lockfile on Google Cloud. My current cloudbuild config is the following:
steps:
- name: "gcr.io/google.com/cloudsdktool/cloud-...