running commands from cloud-builders-community/sonarqube/

94 Views Asked by At
gcloud builds submit . --config=cloudbuild.yaml
Creating temporary tarball archive of 6 file(s) totalling 3.2 KiB before compression.
Uploading tarball of [.] to [gs://training_cloudbuild/source/1670817617.242895-f55df2adc5e04b5ca65f2ed1a6a12fe4.tgz]
ERROR: (gcloud.builds.submit) 403 Could not upload file [/tmp/tmprwqmw411/file.tgz] to [training_cloudbuild/source/1670817617.242895-f55df2adc5e04b5ca65f2ed1a6a12fe4.tgz]: Access denied.

running commands from cloud-builders-community/sonarqube/ in the instance and getting this error .Need help how to run sonar scanner in cloud build .Need to use sonarqube while running the code in cloud build.

1

There are 1 best solutions below

0
On

From Troubleshooting build errors documentation

4xx client errors This group of errors indicates that the build request is not successful presumably by fault of the user sending the request. Some examples of 4xx client errors are:

**Error**: 404 : Requested entity was not found
**Error**: 404 : Trigger not found
**Error**: 400 : Failed Precondition
**Error**: 403 : Permission denied

Error message:

ERROR: (gcloud.builds.submit) 403 Could not upload file [/tmp/tmprwqmw411/file.tgz] to [training_cloudbuild/source/1670817617.242895-f55df2adc5e04b5ca65f2ed1a6a12fe4.tgz]: Access denied.

The error stats, the Service Account does not have access to [gs://training_cloudbuild/]

Try adding below permission to build Service Account:

storage.objects.create
storage.objects.get
storage.objects.list