#Design knot: Part 2 - Workspace API

1 messages · Page 1 of 1 (latest)

solid ridge
#

🧵

inner gorge
#

@rapid depot this covers a lot of what we were discussing yesterday regarding +defaultPath

#

No blockers, few questions

  • "Path is relative to workspace root. Use "." for the root.": Do we have the same matrix as defaultPath for workspace root vs repo root ("." vs "/")? do we allow ../.. until its invalid?
  • "An empty workspace is injected when The function is called from another module (module-to-module calls)": Only when the Workspace isn't passed through, right? I can still pass it to other functions?
  • "The CLI cannot determine a workspace root (no .git found, ... )": So without a workspace configuration we fall back to the git repo?
  • What might a workspace configuration look like? Does a .dagger/config.toml define exactly 1 workspace, or are there named workspaces?
rapid depot
#

which files to upload is determined dynamically by the function's directory() and file()

  1. Is .git always uploaded?
  2. How does this work for nested dependencies? For a (silly) example, say I have my tests in a nested tests/ folder. But that has a dependency on a file ../resources/test.txt. Do I have to sort of import/assign the tests.txt to a variable for it to be pulled in? With +defaultPath I'd set the root (and filter what's not needed) and run the test command inside tests/. But with workspaces, if I set root to a var it will always pull in all the files right? Is that the tradeoff? What about monorepos which may have a similar workflow.
solid ridge
#
  • "Path is relative to workspace root. Use "." for the root.": Do we have the same matrix as defaultPath for workspace root vs repo root ("." vs "/")?

The workspace root is the repo root (usually). So / would be that.

. could be actual workdir of the client within the workspace... or could be location of the workspace config file (not the same as workspace root). I'd vote for workdir of the client I think.

do we allow ../.. until its invalid?

Yes

  • "An empty workspace is injected when The function is called from another module (module-to-module calls)": Only when the Workspace isn't passed through, right? I can still pass it to other functions?

Yes 👍

  • "The CLI cannot determine a workspace root (no .git found, ... )": So without a workspace configuration we fall back to the git repo?

Unclear sorry... The workspace config is actually not needed for determining the workspace root. It's needed for configuring dagger within a certain directory of the workspace

  • What might a workspace configuration look like? Does a .dagger/config.toml define exactly 1 workspace, or are there named workspaces?

I think the workspace is the whole repo, and the config file determines how the workspace is configured