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

Improve the behavior of --dir and --file #55

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

kylekthompson
Copy link
Member

@kylekthompson kylekthompson commented Feb 13, 2024

With the upcoming release of Embedded Runs, we need to better define the behavior around --dir and --file.

Previously, these flags were mutually exclusive. You could provide:

  • Nothing. In this case, we'd look in .mint in your working directory and try to run any task definitions at the top-level of that folder
  • --dir some-dir. In this case, we'd look in that directory for run definitions and try to run them
  • --file some-file.yml. In this case, we'd ignore any .mint directories and simply send the one task definition you specified

Moving forward, embedded runs need the context of a .mint dir to populate the run definitions that can be statically embedded (via call: ${{ mint.run-dir }}/tasks.yml). To facilitate this, the CLI needs to differentiate between the task definitions that we intend to run and the ones which should be treated as the mint dir for a run.

Now, you can provide:

  • Nothing. In this case, we'll start in the working directory and traverse up until we find a .mint dir no no .mint dir
  • --dir some-dir --file somewhere-else/tasks.yml. In this case, the contents of some-dir can be referenced by static embedded runs and somewhere-else/tasks.yml will be the definition we use to start your run
  • --dir some-dir. In this case, we'll read the contents of some-dir, use it as the mint dir for embedded runs and try to start runs with the definitions in the directory
  • --file somewhere-else/tasks.yml. In this case, we'll perform the traversal logic to populate the mint dir and use somewhere-else/tasks.yml to start your run

@kylekthompson kylekthompson self-assigned this Feb 13, 2024
…ded runs and may differ from what we put in TaskDefinitions
@kylekthompson kylekthompson marked this pull request as ready for review February 13, 2024 17:28
Comment on lines +444 to +446
if (workingDirectory == string(os.PathSeparator)) {
return "", nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunate that Go stdlib doesn't expose a "root of filesystem" function (1)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think there are other parts of this that aren't very Windows friendly anyway that we need to tackle 😐 specifically, Mint does pretty much exclusively unix path manipulation, but much of the code in here uses things like filepath.Join which are OS-specific (so windows would send up windows path separators even though Mint wants unix)

@kylekthompson kylekthompson merged commit 220545a into main Feb 13, 2024
2 checks passed
@kylekthompson kylekthompson deleted the kt/dir-and-file-not-either branch February 13, 2024 18:04
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.

None yet

2 participants