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

COPY does not seem to recursively copy contents of files #904

Closed
poy opened this issue Dec 6, 2019 · 0 comments · Fixed by #905
Closed

COPY does not seem to recursively copy contents of files #904

poy opened this issue Dec 6, 2019 · 0 comments · Fixed by #905

Comments

@poy
Copy link
Contributor

poy commented Dec 6, 2019

Actual behavior
COPY results in the expected directory structure and files, but the files are empty.

Expected behavior
When using the COPY command on a directory structure that has some depth, I would expect the files and their contents to be copied.

To Reproduce
Steps to reproduce the behavior:

  1. Create the following cloudbuild.yaml:
steps:
- id: 'prepare workspace'
  name: ubuntu
  entrypoint: 'bash'
  args:
  - "-c"
  - |
    set -eux

    mkdir -p /workspace/public/getting-started/install

    echo "some-content" > /workspace/public/getting-started/install/index.html

    cat << EOF > /workspace/Dockerfile
    FROM ubuntu:latest
    COPY public /workspace
    EOF

- name: 'gcr.io/kaniko-project/executor'
  dir: '/workspace'
  args:
  - --destination=gcr.io/${PROJECT_ID}/some-image:latest

- name: gcr.io/${PROJECT_ID}/some-image:latest
  entrypoint: 'bash'
  args:
  - "-c"
  - |
    set -eux

    size=$(ls -al /workspace/public/getting-started/install/index.html | awk '{print $5}')
    if [ ${size} == 0 ]; then
      echo "FAIL: file is empty"
      exit 1
    fi

    echo "SUCCESS: file is not empty"
  1. Run in cloud build:
gcloud builds submit . --config=cloudbuild.yaml

Additional Information

  • Dockerfile
    Please provide either the Dockerfile you're trying to build or one that can reproduce this error.
  • Build Context
    Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
  • Kaniko Image (fully qualified with digest)

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
poy added a commit to poy/kaniko that referenced this issue Dec 8, 2019
When using the COPY command, if the source and destination have the same
the file should be skipped rather than copied. This is to prevent the
file from being overwritten and therefore producing an empty file.

fixes GoogleContainerTools#904
poy added a commit to poy/kaniko that referenced this issue Dec 8, 2019
When using the COPY command, if the source and destination have the same
the file should be skipped rather than copied. This is to prevent the
file from being overwritten and therefore producing an empty file.

fixes GoogleContainerTools#904
cvgw pushed a commit to cvgw/kaniko that referenced this issue Dec 10, 2019
When using the COPY command, if the source and destination have the same
the file should be skipped rather than copied. This is to prevent the
file from being overwritten and therefore producing an empty file.

fixes GoogleContainerTools#904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant