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

porter install --file fails with path to file outside pwd #1447

Closed
simongdavies opened this issue Feb 11, 2021 · 10 comments
Closed

porter install --file fails with path to file outside pwd #1447

simongdavies opened this issue Feb 11, 2021 · 10 comments
Assignees
Labels
2 - 🍕 Pizza should be eaten daily bug Oops, sorry!
Milestone

Comments

@simongdavies
Copy link
Contributor

Describe the bug

Executing porter install with --file specifying a manifest in a directory outside the current working directory fails.

To Reproduce

Steps to reproduce the behavior:

  1. create a directory a
  2. place any valid porter.yaml file in this directory
  3. Run this porter command porter install --file a\porter.yaml
  4. See error

Expected behavior

Bundle should be built and installed

Porter Command and Output

$ porter install -f tests/testdata/porter.yaml
 Building bundle ===>
Error: unable to generate manifest: could not read the manifest at "porter.yaml": open /home/simon/github/simongdavies/kubernetes-plugins/porter.yaml: no such file or directory

Version

porter v0.33.0 (991a5a2)

@simongdavies simongdavies added the bug Oops, sorry! label Feb 11, 2021
@carolynvs
Copy link
Member

@vdice and I were talking about the --file parameter and how it's something we originally added but at this point it isn't something that is supported well enough in the code to be usable. I think we ran into this when Vaughn added support for --registry to porter publish and we assume that the file we are building from is always porter.yaml. The other piece of it is that Porter was written with the understanding that it is always run from within the bundle directory.

Before 1.0 we need to decide if we are going to do the work to support file (and cnab-file) flags or if they should be removed.

@carolynvs carolynvs added this to the 1.0 milestone May 10, 2021
@carolynvs carolynvs added the hmm 🛑🤔 Needs more thinking time. Don't start on it yet, please. label May 10, 2021
@carolynvs
Copy link
Member

@vdice Do you think that your fix from earlier, allowing people to specify a build context directory, fixes this?

@vdice
Copy link
Member

vdice commented May 24, 2021

@carolynvs yes. Perhaps we can check in with @simongdavies to be sure we've covered the intended use cases, but porter build supports an alternate build context dir and/or porter.yaml filepath. Note that the action commands porter install, etc., only support the latter, however.

@carolynvs
Copy link
Member

@simongdavies Can you try building the bundle using the --dir (works the same way as the docker build context in conjunction with --file) and let us know if that fixed the problem? e.g.

porter build --dir a

@carolynvs
Copy link
Member

This isn't quite working the way we want it to yet. In the example below, I want porter build --dir fa to default the file to DIR/porter.yaml but it defaults to PWD/porter.yaml. So one more fix is needed.

$ mkdir fa && cd fa && porter create
creating porter configuration in the current directory

$ cd ..

$ porter build --dir fa
Error: unable to generate manifest: could not read the manifest at "": read /Users/carolynvs/demo/install/fa: is a directory

$ porter build --dir fa --file porter.yaml
Error: unable to access --file porter.yaml: stat /Users/carolynvs/demo/install/porter.yaml: no such file or directory

$ porter build --dir fa --file fa/porter.yaml
Copying porter runtime ===>
Copying mixins ===>

@joshuabezaleel
Copy link
Contributor

@carolynvs Since both --dir and --file flag will be in the form of path to point the location of the .yaml file and the target file is assumed to always be porter.yaml file, wouldn't it be redundant to have both flag?

@carolynvs
Copy link
Member

--dir should indicate the base directory to use as the docker context. It lets people put porter's files in a subdirectory and be able to access files from parent directories during porter build. For example:

repo/
  /porter/
    porter.yaml
  /bin/
    myapp
porter build --dir repo --file porter/porter.yaml

--file allows for people to use a filename other than porter.yaml. For example they could have variations of a bundle and put them into aws.porter.yaml and azyre.porter.yaml.

@carolynvs carolynvs added the 2 - 🍕 Pizza should be eaten daily label Nov 18, 2021
@VinozzZ
Copy link
Contributor

VinozzZ commented Jun 7, 2022

currently, -f uses the pwd() as the current working directory if a relative path is provided even when -d is specified with a different value.
However, when a fully resolved path is provided, -f is able to figure out where the porter file is

@carolynvs
Copy link
Member

Thanks for narrowing down where the bug is hiding! I'm going to assign this to you since I think you are pretty close to getting it fixed.

@carolynvs carolynvs removed the hmm 🛑🤔 Needs more thinking time. Don't start on it yet, please. label Jun 7, 2022
@github-actions
Copy link

Closed by #2142.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - 🍕 Pizza should be eaten daily bug Oops, sorry!
Projects
None yet
Development

No branches or pull requests

5 participants