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

Don't create a .bashful directory or add a setting to disable it #61

Open
alexislefebvre opened this issue Oct 3, 2018 · 4 comments
Open

Comments

@alexislefebvre
Copy link

alexislefebvre commented Oct 3, 2018

I ran a bashful script in a project from another directory and I was surprised to see that git detected changes: a .bashful directory has been created in my project.

I think that bashful should not create a directory automatically, but there could be an option so that users who want that could enable this option.

Context: I'm running code analysis tools so I don't need to store results or any other data, I only want to see if commands return 0 or fail, and the output if the command failed.

@wagoodman
Copy link
Owner

The reason for the temp dir is to:

  1. flush out task output for later logging (if logging is enabled)
  2. capture task metadata, such as how long each task takes to run, to help with ETA estimations on future bashful runs in the same dir

I think it makes sense to keep these as default features but to add in a switch/configuration for doing one/all of the following:

  1. move the tempdir to another given location
  2. disable writing a tempdir at all (which means the logfile option would be invalid in this case)
  3. removing the tempdir after each run (ETAs won't work on subsequent runs)

@alexislefebvre
Copy link
Author

Thanks for your answer.

Could the tempdir be written to a temp dir by default? Like /tmp on Unix, %appdata%\Temp on Windows?

@wagoodman
Copy link
Owner

We'd have to rename the .bashful dir to include the project name, which should be unique across other projects using bashful to prevent collisions. Also the temp dir name could not be based on something that's random, otherwise it would be challenging to reuse persistent metadata.

Since metadata should be persistent /tmp wouldn't make sense (since that dir is cleared on reboots). Splitting it into two directories could work, one in /var for persistent data and another in /tmp for log buffers.

The nice thing about bashful is that it's fairly lightweight and portable, you can download the binary and get going, there isn't an install step or a dependency on any privileged locations (like /var).

I think the best compromise would be to:

  • by default write the logs out to the OS's temp dir (/tmp or %appdata%\Temp, etc), as these will never be needed again, and the entire /tmp/bashful.xxxx dir can be removed upon the completion of a bashful run. (In this way the path in /tmp could be random)
  • by default still write out metadata to the local .bashful dir, however, allow this to be disabled via a run.yaml configuration, a cli switch (like --no-persist), or via an environment variable (e.g. BASHFUL_NO_PERSIST=1).

@alexislefebvre
Copy link
Author

Since metadata should be persistent /tmp wouldn't make sense (since that dir is cleared on reboots). Splitting it into two directories could work, one in /var for persistent data and another in /tmp for log buffers.

You're right.

Could metadata be stored use a directory in $HOME? Something like ~/bashful/{directory_id}? So metadata would not be lost after reboot but wouldn't pollute the project where bashful is launched.

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

No branches or pull requests

2 participants