Skip to content

Instantly share code, notes, and snippets.

@BenHizak
Last active September 9, 2019 17:16
Show Gist options
  • Select an option

  • Save BenHizak/4632b3df40892a46712f29b4cf4a6057 to your computer and use it in GitHub Desktop.

Select an option

Save BenHizak/4632b3df40892a46712f29b4cf4a6057 to your computer and use it in GitHub Desktop.
Demo of variables dropped
#!/bin/bash
# this one works
docker build . | tee build_with_docker.log
gcloud builds submit --config=kaniko-without-cache.yml | tee build_with_kaniko_uncached.log
gcloud builds submit --config=kaniko-with-cache.yml | tee build_with_kaniko_cached.log
#this one fails
Sending build context to Docker daemon 117.2kB
Step 1/3 : ARG VERSION=3.7.2
Step 2/3 : FROM python:${VERSION}
---> 2053ca75899e
Step 3/3 : RUN echo "this is a demo"
---> Using cache
---> 7596fafd9ddf
Successfully built 7596fafd9ddf
----------------------------------------------------------------------------- REMOTE BUILD OUTPUT -----------------------------------------------------------------------------
starting build "61df6bfb-9be2-4807-901f-7f8fd6361d00"
FETCHSOURCE
Fetching storage object: gs://your-project-name_cloudbuild/source/1568049061.86-1fd099711b98413cae4bcedd698feec0.tgz#1568049063569789
Copying gs://your-project-name_cloudbuild/source/1568049061.86-1fd099711b98413cae4bcedd698feec0.tgz#1568049063569789...
/ [0 files][ 0.0 B/ 1.6 KiB]
/ [1 files][ 1.6 KiB/ 1.6 KiB]
Operation completed over 1 objects/1.6 KiB.
BUILD
Already have image (with digest): gcr.io/kaniko-project/executor@sha256:584a8d90679211d9b09465d778990ec15965cf78f57f197e973d57d14b08eb81
INFO[0000] Resolved base name python:${VERSION} to python:
INFO[0000] Resolved base name python:${VERSION} to python:
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Error while retrieving image from cache: getting file info: stat /cache/sha256:9db2a731d3c7970453d37f5f92708ffd1255d12a76517fb24f944ca3d4f84f8e: no such file or directory
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Built cross stage deps: map[]
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Error while retrieving image from cache: getting file info: stat /cache/sha256:9db2a731d3c7970453d37f5f92708ffd1255d12a76517fb24f944ca3d4f84f8e: no such file or directory
INFO[0000] Downloading base image python:3.7your-project-name
INFO[0001] Checking for cached layer gcr.io/cherre-sandbox/kaniko_fail_example/cache:bb3cc2373ac9cd1aa19c4c586593e506d7e1518cded82f90b664da157d604c6c...
INFO[0001] Using caching version of cmd: RUN echo "this is a demo"
INFO[0001] Skipping unpacking as no commands require it.
INFO[0001] Taking snapshot of full filesystem...
INFO[0001] RUN echo "this is a demo"
INFO[0001] Found cached layer, extracting to filesystem
INFO[0001] No files changed in this command, skipping snapshotting.
PUSH
DONE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID CREATE_TIME DURATION SOURCyour-project-name IMAGES STATUS
61df6bfb-9be2-4807-901f-7f8fd6361d00 2019-09-09T17:11:04+00:00 17S gs://cherre-sandbox_cloudbuild/source/1568049061.86-1fd099711b98413cae4bcedd698feec0.tgz - SUCCESS
----------------------------------------------------------------------------- REMOTE BUILD OUTPUT -----------------------------------------------------------------------------
starting build "5100cce7-b4e1-40c9-b0b0-90a15243bfa1"
FETCHSOURCE
Fetching storage object: gs://your-project-name_cloudbuild/source/1568048999.96-d2b74390ed3e4fea8785af13bd3a17ad.tgz#1568049001632788
Copying gs://your-project-name_cloudbuild/source/1568048999.96-d2b74390ed3e4fea8785af13bd3a17ad.tgz#1568049001632788...
/ [0 files][ 0.0 B/ 890.0 B]
/ [1 files][ 890.0 B/ 890.0 B]
Operation completed over 1 objects/890.0 B.
BUILD
Already have image (with digest): gcr.io/kaniko-project/executor@sha256:584a8d90679211d9b09465d778990ec15965cf78f57f197e973d57d14b08eb81
INFO[0000] Resolved base name python:${VERSION} to python:
INFO[0000] Resolved base name python:${VERSION} to python:
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Error while retrieving image from cache: getting file info: stat /cache/sha256:9db2a731d3c7970453d37f5f92708ffd1255d12a76517fb24f944ca3d4f84f8e: no such file or directory
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Built cross stage deps: map[]
INFO[0000] Downloading base image python:3.7.2
INFO[0000] Error while retrieving image from cache: getting file info: stat /cache/sha256:9db2a731d3c7970453d37f5f92708ffd1255d12a76517fb24f944ca3d4f84f8e: no such file or directory
INFO[0000] Downloading base image python:3.7.2
INFO[0001] Unpacking rootfs as cmd RUN echo "this is a demo" requires it.
INFO[0018] Taking snapshot of full filesystem...
INFO[0030] RUN echo "this is a demo"
INFO[0030] cmd: /bin/sh
INFO[0030] args: [-c echo "this is a demo"]
this is a demo
INFO[0030] Taking snapshot of full filesystem...
INFO[0034] No files were changed, appending empty layer to config. No layer added to image.
PUSH
DONE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID CREATE_TIME DURATION SOURCyour-project-name IMAGES STATUS
5100cce7-b4e1-40c9-b0b0-90a15243bfa1 2019-09-09T17:10:02+00:00 55S gs://cherre-sandbox_cloudbuild/source/1568048999.96-d2b74390ed3e4fea8785af13bd3a17ad.tgz - SUCCESS
ARG VERSION=3.7.2
FROM python:${VERSION}
RUN echo "this is a demo"
steps:
- name: gcr.io/kaniko-project/executor@sha256:584a8d90679211d9b09465d778990ec15965cf78f57f197e973d57d14b08eb81
args:
- --dockerfile=./Dockerfile
- --destination=gcr.io/your-project-name/kaniko_fail_example # note: change 'your-project' to your google cloud
- --cache=true
steps:
- name: gcr.io/kaniko-project/executor@sha256:584a8d90679211d9b09465d778990ec15965cf78f57f197e973d57d14b08eb81
args:
- --dockerfile=./Dockerfile
- --destination=gcr.io/your-project-name/kaniko_fail_example # note: change 'your-project' to your google cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment