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

move and standardize location of plan files for components #364

Closed
wants to merge 1 commit into from

Conversation

reset
Copy link
Collaborator

@reset reset commented Apr 8, 2016

In my previous PR I added a number of plans but I didn't follow the convention that I had started with the depot crate, oops! This moves the plans of those components to components/${name}/plan/* and also updates the sup component to match.

I think it's important that the plan.sh file not be at the root of the component but instead be stored within a directory since a plan consists of more than just the .sh entry point. Open to discussions though!

gif-keyboard-14556048527026980386

@jtimberman
Copy link
Contributor

I like the idea of a plan directory containing all the things relevant to the plan. I wonder if we should start using build.sh instead of plan.sh? For example, if I'm building an application, does it make more sense to have:

  • myapp/plan/build.sh

or

  • myapp/plan/plan.sh

Or maybe if the app only needs the .sh, the presence of a plan.sh at the toplevel? Like, it doesn't have special configuration or a service because it's a library (a la zlib, libpng, etc).

@fnichol
Copy link
Collaborator

fnichol commented Apr 8, 2016

I struggled with this too last night and had the following thought: unless there's a reason to bury plan.sh under another directory (such as config, templates, hooks, etc. for service packaged) why add more directories? It reminded me a bit of Rust modules:

src/
├── package
│   ├── hooks.rs
│   ├── mod.rs
│   └── updater.rs

vs.

src/
├── packakge.rs

Similarly with Plan files:

.
├── plan.sh

vs.

.
├── plan
│   ├── plan.sh
│   ├── default.toml
│   ├── config

Really all I'm after is to be able to do this:

# in a Studio
hab-studio> build components/depot

or

# outside
> hab-studio build components/depot

without having to:

# in a Studio
hab-studio> build components/depot/plan

or

# outside
> hab-studio build components/depot/plan

The above needs a tiny bit more smarts in hab-plab-build.sh (formerly bldr-build) but I think the final CLI call is worth it.

One other thing that I'm a bit sad about is that nowhere do we reference Habitat with a Plan file--it'll be up to people to make the connection. However, still prefer this to everything being a Bldrfile as in days of yore.


Have I taken up enough vertical space yet?

How about this?

gif-keyboard-7700441627820782128

@reset
Copy link
Collaborator Author

reset commented Apr 9, 2016

@fnichol so bldr-build would

  • take a directory as an argument (as it does)
  • look for a plan.sh file in that directory (as it does)
  • alternatively look for a plan directory and then look in that for a plan.sh file
  • If it finds both a plan.sh file and a plan directory then we fail out cause you can't have two plans

That feels a lot like the way Rust does things and I'm alright with it. I might suggest one other scenario to think a bit on

  • place the plan.sh at the root
  • place all other artifacts of the plan within a subdirectory called plan or hab or build or hell, we could even let you configure it in your plan.sh if you don't like our default name for where to look for the other stuff

@reset
Copy link
Collaborator Author

reset commented Apr 28, 2016

This was largely completed in #456

@reset reset closed this Apr 28, 2016
@reset reset deleted the mv-plans branch April 28, 2016 17:18
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 this pull request may close these issues.

4 participants