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

Skaffold child builds using Kaniko fails with the Google Cloud Build integration #9645

Open
louisjimenez opened this issue Jan 9, 2025 · 0 comments
Labels
build/gcb kind/bug Something isn't working

Comments

@louisjimenez
Copy link

Using Skaffold to build an image from a Dockerfile with Kaniko on Google Cloud Build results in a parent build and a child build. The child build succeeds in building the image but the parent build fails with the error message:

error copying logs to stdout: invalid write result
ERROR
ERROR: build step 0 "gcr.io/k8s-skaffold/skaffold:v2.11.1" failed: step exited with non-zero status: 1

The error is coming from here in the implementation of the GCB builder.

Expected behavior

The intended functionality is that the Skaffold image would output the child build logs so that they could be surfaced in the parent build logs.

Actual behavior

The above error.

Information

  • Skaffold version: gcr.io/k8s-skaffold/skaffold:v2.11.1
  • Operating system: Google Cloud Build Default Pool VM
  • Installed via: Executed as image with the following args to Cloud Build [ "skaffold", "build", "--filename=skaffold.issue.yaml", "--timestamps=true" ]
  • Contents of skaffold.yaml:
apiVersion: skaffold/v4beta9
kind: Config
metadata:
  name: failing-parent-build

build:
  googleCloudBuild:
    region: asia-southeast1

  tagPolicy:
    dateTime: {}

  artifacts:  
    - image: asia-southeast1-docker.pkg.dev/test-project/test-repo/test-image
      kaniko:
        dockerfile: Dockerfile
        cache:
          cacheCopyLayers: true
        verbosity: debug
  • Contents of cloudbuild.yaml:
steps:
  - name: gcr.io/k8s-skaffold/skaffold:v2.11.1
    args: [ "skaffold", "build", "--filename=skaffold.issue.yaml", "--timestamps=true" ]
  • Contents of Dockerfile:
FROM alpine
COPY quickstart.sh /
CMD ["/quickstart.sh"]

Steps to reproduce the behavior

Steps are based on the Google Cloud Build quickstart

  1. Copy the above example skaffold.yaml, cloudbuild.yaml and Dockerfile to a directory.
  2. Create an empty quickstart.sh file in the same directory. touch quickstart.sh
  3. Run the command gcloud builds submit --region=asia-southeast1 --config cloudbuild.issue.yaml
  4. The parent build should successfully download the Skaffold image and create a child build using the image to build the Dockerfile with Kaniko.
  5. The parent build will fail when attempting to surface the child build logs from the Skaffold image.
@louisjimenez louisjimenez added kind/bug Something isn't working build/gcb labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/gcb kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant