Kaniko (and possibly Docker) targets to work like in v0.31.0
Kaniko targets don't work as expected when building and instead gives an error
apiVersion: skaffold/v1beta11
kind: Config
build:
artifacts:
- image: registry.gitlab.com/example/example/dump
context: docker/aws
kaniko:
cache: {}
target: dump
- image: registry.gitlab.com/example/example/postgis
context: docker/postgis
kaniko:
cache: {}
- image: registry.gitlab.com/example/example/upload
context: docker/aws
kaniko:
cache: {}
target: upload
cluster:
dockerConfig:
secretName: kaniko
namespace: kaniko
pullSecretName: gitlab-registry
tagPolicy:
envTemplate:
template: "{{.IMAGE_NAME}}:latest"
deploy:
kustomize:
path: kustomize/overlays/prod
profiles:
- name: dev
activation:
- kubeContext: minikube
build:
artifacts:
- image: example/dev/dump
context: docker/aws
docker:
target: dump
- image: example/dev/postgis
context: docker/postgis
- image: example/dev/upload
context: docker/aws
docker:
target: upload
local: {}
deploy:
kustomize:
path: kustomize/overlays/dev
Dockerfile for context docker/aws:
FROM alpine AS aws
RUN apk add --no-cache \
python
RUN wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip \
&& unzip awscli-bundle.zip \
&& ./awscli-bundle/install \
-b /usr/local/bin/aws \
-i /usr/local/aws \
&& rm -r awscli-bundle*
FROM aws AS dump
RUN apk add --no-cache \
jq \
postgresql-client
COPY --chown=root:root files/dump.sh /scripts/
CMD ["/scripts/dump.sh"]
FROM aws AS upload
COPY --chown=root:root files/upload.sh /scripts/
CMD ["/scripts/upload.sh"]
skaffold build
Generating tags...
- registry.gitlab.com/example/example/dump -> registry.gitlab.com/example/example/dump:latest
- registry.gitlab.com/example/example/postgis -> registry.gitlab.com/example/example/postgis:latest
- registry.gitlab.com/example/example/upload -> registry.gitlab.com/example/example/upload:latest
Tags generated in 242.837碌s
Starting build...
Creating kaniko secret [gitlab-registry]...
Creating docker config secret [kaniko]...
Building [registry.gitlab.com/example/example/dump]...
Complete in 8.165794902s
FATA[0008] build failed: building [registry.gitlab.com/example/example/dump]: kaniko build for [registry.gitlab.com/example/example/dump]: getting dependencies for registry.gitlab.com/example/example/dump: listing copied files: retrieving image config: getting image: UNAUTHORIZED: authentication required; [map[Type:repository Class: Name:library/aws Action:pull]]
I'm working on it. This is not specific to Kaniko. Something is broken with the way we handle multi stage builds.
Can anyone try with this PR? https://github.com/GoogleContainerTools/skaffold/pull/2340
@dgageot I was going to try it, but I can't seem to find instructions on how to build the binary from your PR branch. This may be trivial, but I am not a GO developer yet. If you could please point me out to the "build from source" instructions, I'll be more than happy to see if it fixes the current error on my end.
If you really want to do it (I would understand if you didn't!), you have to install go 1.11 or 1.12 and run make install at the root of skaffold folder
Your PR #2340 works for my setup using multi-stage docker dockerfiles.
Thanks!
Thanks. Curious if there will be a 0.32.1 release for this?
Most helpful comment
Thanks. Curious if there will be a 0.32.1 release for this?