Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build and push my image to Google Artifact Registry using BuildPacks #377

Open
gulpinDev opened this issue Jan 23, 2024 · 4 comments
Labels
kind/question Further information is requested

Comments

@gulpinDev
Copy link

gulpinDev commented Jan 23, 2024

My code to build the image and push it to Artifact Registry:

steps:
  # use Buildpacks to create, build and push the container image to Artifact Registry
  - name: 'gcr.io/k8s-skaffold/pack'
    entrypoint: 'pack'
    args: ['build', '--builder=gcr.io/buildpacks/builder', '--publish', '${_REGION}-docker.pkg.dev/${_PROJECT_ID}/${_REPO_ID}/${_IMAGE}:${_TAG}']

The command I run:

gcloud builds submit --region=europe-west1 --config=cloudbuild.yaml

what it returns:

===> DETECTING
[detector] Timer: Detector started at 2024-01-24T06:19:32Z
[detector] 4 of 6 buildpacks participating
[detector] google.go.runtime        0.9.1
[detector] google.go.gopath         0.9.0
[detector] google.go.build          0.9.0
[detector] google.utils.label-image 0.0.2
[detector] Timer: Detector ran for 91.268404ms and ended at 2024-01-24T06:19:32Z
===> RESTORING
[restorer] Timer: Restorer started at 2024-01-24T06:19:32Z
[restorer] Timer: Restorer ran for 343.56µs and ended at 2024-01-24T06:19:32Z
===> BUILDING
[builder] Timer: Builder started at 2024-01-24T06:19:33Z
[builder] === Go - Runtime (google.go.runtime@0.9.1) ===
[builder] Using runtime version from GOOGLE_RUNTIME_VERSION: 17
[builder] 2024/01/24 06:19:33 [DEBUG] GET https://go.dev/dl/?mode=json
[builder] --------------------------------------------------------------------------------
[builder] failed to build: (error ID: a8a5e01d):
[builder] invalid Go version specified: https://go.dev/dl/?mode=json, You can refer to failed to resolve version matching: 17 for a list of stable Go releases.
[builder] --------------------------------------------------------------------------------
[builder] Sorry your project couldn't be built.
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder]  -> https://cloud.google.com/docs/buildpacks/overview
[builder] If you think you've found an issue, please report it:
[builder]  -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] --------------------------------------------------------------------------------
[builder] Timer: Builder ran for 171.666639ms and ended at 2024-01-24T06:19:33Z
[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
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

BUILD FAILURE: Build step failure: build step 0 "gcr.io/k8s-skaffold/pack" failed: step exited with non-zero status: 1
ERROR: (gcloud.builds.submit) build c21ad7ea-c672-4f33-a87b-75baf7badf67 completed with status "FAILURE"

My project.toml:

[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "17"

can someone help me understand what is wrong here and how to solve it?

thanks in advance

@kennethye1
Copy link
Contributor

Maybe try running in the args --trust-builder or enable your build service account to have Artifact registry service account permissions.

@gulpinDev
Copy link
Author

@kennethye1 thank you for the suggestions, but it doesn't solve the issue. i think this is related to the Go version

@kennethye1
Copy link
Contributor

Ah I see, you're using Go. You should fix it with --env GOOGLE_RUNTIME_VERSION=1.21.

@jama22 jama22 added the kind/question Further information is requested label Jan 26, 2024
@jama22
Copy link
Collaborator

jama22 commented Jan 26, 2024

You actually need to give the full semver version number for the runtime version, so your project.toml needs to be:

[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "1.17"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants