skaffold
skaffold copied to clipboard
Skaffold child builds using Kaniko fails with the Google Cloud Build integration
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
- Copy the above example skaffold.yaml, cloudbuild.yaml and Dockerfile to a directory.
- Create an empty quickstart.sh file in the same directory.
touch quickstart.sh - Run the command
gcloud builds submit --region=asia-southeast1 --config cloudbuild.issue.yaml - The parent build should successfully download the Skaffold image and create a child build using the image to build the Dockerfile with Kaniko.
- The parent build will fail when attempting to surface the child build logs from the Skaffold image.