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

Relative paths don't work with --context, --tarPath, and others... #732

Closed
huguesalary opened this issue Aug 7, 2019 · 1 comment · Fixed by #736
Closed

Relative paths don't work with --context, --tarPath, and others... #732

huguesalary opened this issue Aug 7, 2019 · 1 comment · Fixed by #736
Labels
area/cli bugs related to kaniko CLI kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment. work-around-available

Comments

@huguesalary
Copy link
Contributor

huguesalary commented Aug 7, 2019

Actual behavior

Upon executing, the executor binary changes its root directory to / as seen here https://github.com/GoogleContainerTools/kaniko/blob/master/cmd/executor/cmd/root.go#L84

This prevents the use of relative directories in the executor command line arguments.

For example:

  • Imagine a directory /tmp/build
  • with a subdirectory myworkspace/ containing the Dockerfile (i.e. /tmp/build/myworkspace/Dockerfile)
  • Running the following will fail:
cd /tmp/build
/kaniko/executor --dockerfile=Dockerfile --context=myworkspace/ --destination=image --tarPath=image.tar --cache=true --cache-dir=./cache/ --no-push
  • With the error:
Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile

Expected behavior

Kaniko should allow the use of relative paths in its command line and honor them.

Additional Information

The current behavior is also confusing because the --dockerfile argument does allow a relative path.

That is, the following command line works:

cd /tmp/build
/kaniko/executor --dockerfile=myworkspace/Dockerfile --destination=image --tarPath=image.tar --cache=true --cache-dir=./cache/ --no-push

But fails as soon as the Dockerfile tries to use a "workspace" file

error building image: error building stage: lstat /myworkspace/entrypoint.sh: no such file or directory

Related issues

#731
#675

huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 9, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#31 GoogleContainerTools#675
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 9, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#31 GoogleContainerTools#675
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 9, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#31 GoogleContainerTools#675
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 9, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#731 GoogleContainerTools#675
@tejal29 tejal29 added kind/bug Something isn't working work-around-available labels Aug 9, 2019
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 9, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#731 GoogleContainerTools#675
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 19, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#731 GoogleContainerTools#675
huguesalary added a commit to huguesalary/kaniko that referenced this issue Aug 27, 2019
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes GoogleContainerTools#732 GoogleContainerTools#731 GoogleContainerTools#675
@tejal29 tejal29 added the priority/p3 agreed that this would be good to have, but no one is available at the moment. label Sep 13, 2019
@tejal29 tejal29 added the area/cli bugs related to kaniko CLI label Sep 27, 2019
@tejal29
Copy link
Member

tejal29 commented Oct 2, 2019

This should be fixed by #736

@tejal29 tejal29 closed this as completed Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli bugs related to kaniko CLI kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment. work-around-available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants