gcloud run deploy builpacks error

Hi, I’m have some problems with running deploy with buildpacks.

Project structure:
HelloWorld

  • SayHi
  • DatabaseConnector

Command:

~/HelloWorld$ gcloud run deploy hello-world --update-env-vars=GOOGLE_BUILDABLE=SayHi --cpu=0.2 --max-instances=1 --memory=0.5G --vpc-connector=projects/tests-349812/locations/europe-west4/connectors/legacy-test-vpc-connector --source=.

Error message:

starting build "d8995d7c-9cc1-4d6f-8b39-65ad9be23040"

FETCHSOURCE
Fetching storage object: gs://tests-349812_cloudbuild/source/1672832368.574064-77baa4533df04c9591f93f852b82ea32.tgz#1672832370683652
Copying gs://tests-349812_cloudbuild/source/1672832368.574064-77baa4533df04c9591f93f852b82ea32.tgz#1672832370683652...
/ [0 files][    0.0 B/  1.5 MiB]                                                
/ [1 files][  1.5 MiB/  1.5 MiB]                                                
Operation completed over 1 objects/1.5 MiB.                                      
BUILD
Pulling image: gcr.io/k8s-skaffold/pack
Using default tag: latest
latest: Pulling from k8s-skaffold/pack
Digest: sha256:410a0f8a63d42b0c5ac800ba9c71789fcbffbf4fc4691a109e2883e3a365b629
Status: Downloaded newer image for gcr.io/k8s-skaffold/pack:latest
gcr.io/k8s-skaffold/pack:latest
latest: Pulling from buildpacks/builder
Digest: sha256:b653eca355fda172df43fad3f04bd7be45bd5608092fbf8f3e012066886a121f
Status: Downloaded newer image for gcr.io/buildpacks/builder:latest
v1: Pulling from buildpacks/gcp/run
Digest: sha256:ea9b5b1e0fd5680b20b44323155c4648650768424a2194a7671807c86e6dc8b0
Status: Downloaded newer image for gcr.io/buildpacks/gcp/run:v1
0.15.1: Pulling from buildpacksio/lifecycle
8fdb1fc20e24: Already exists
d0398d6cf766: Pulling fs layer
d0398d6cf766: Verifying Checksum
d0398d6cf766: Download complete
d0398d6cf766: Pull complete
Digest: sha256:a8df5457f121fcdda920cb0dfd15717530ec37334f8b088144d94e182ada6db8
Status: Downloaded newer image for buildpacksio/lifecycle:0.15.1
===> DETECTING
[detector] 4 of 6 buildpacks participating
[detector] google.dotnet.sdk     0.9.1
[detector] google.dotnet.publish 0.9.0
[detector] google.dotnet.runtime 0.9.1
[detector] google.utils.label    0.0.2
===> ANALYZING
[analyzer] Previous image with name "europe-west4-docker.pkg.dev/tests-349812/cloud-run-source-deploy/hello-world" not found
===> RESTORING
===> BUILDING
[builder] === .NET - SDK (google.dotnet.sdk@0.9.1) ===
[builder] Looking for global.json in /workspace
[builder] Using latest stable .NET Core SDK version
[builder] 2023/01/04 11:39:49 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/dotnetsdk/version.json
[builder] Installing .NET SDK v7.0.101.
[builder] 2023/01/04 11:39:49 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/dotnetsdk/dotnetsdk-7.0.101.tar.gz
[builder] === .NET - Publish (google.dotnet.publish@0.9.0) ===
[builder] Failure: (ID: e9769965) expected to find exactly one project file in directory ., found [./DatabaseConnector/DatabaseConnector.csproj ./SayHi/SayHi.csproj]
[builder] --------------------------------------------------------------------------------
[builder] Sorry your project couldn't be built.
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder]  -> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
[builder] If you think you've found an issue, please report it:
[builder]  -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] --------------------------------------------------------------------------------
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51
ERROR
ERROR: build step 0 "gcr.io/k8s-skaffold/pack" failed: step exited with non-zero status: 1

Hi @StanislawFlex ,

Welcome to Google Cloud Community!

It looks like you are trying to deploy an application to Cloud Run using Cloud Build and buildpacks.

It appears that there might be an issue with the build process, as the build is failing at the ANALYZING step.

There are a few things you can try to troubleshoot this issue:

  1. Make sure that you have specified the correct value for the --update-env-vars flag. This flag should be set to the name of the buildable component that you want to deploy.
  2. Check the logs for the Cloud Build execution to see if there are any error messages that might provide more information about the issue.
  3. Make sure that you have all the necessary dependencies for your application installed and that they are correctly specified in your project’s global.json file.
  4. If you are using a runtime that is not natively supported by Cloud Run, make sure that you have added the necessary buildpacks to your project.
    Thank you

Turns out the flag

--update-env-vars=GOOGLE_BUILDABLE=SayHi

doesnt work.
Had to add this to project.toml in the project directory:

[[build.env]]   
    name = "GOOGLE_RUNTIME_VERSION"
    value = "3.1.426"
    [[build.env]]
    name = "GOOGLE_BUILDABLE"
    value = "SayHi"

Have a new error now though:

The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information