You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Workspace.path does not always return the workspace path #13051
Workspace.path should return the path of the detected workspace. Today, in some cases, it returns the path where workspace detection started.
Repro:
cd PATH/TO/WORKSPACE/subdir
dagger core current-workspace path
# actual: subdir# expected: . or the detected workspace path
This is inconsistent with:
dagger core current-workspace directory --path=.
which loads the detected workspace, not subdir.
Likely cause: core/workspace/detect.go sets Path from the detection start:
Root: gitDir,
Path: relPath(gitDir, cwd),
Solution
Separate workspace identity from detection start:
extendtypeWorkspace {
"""The current working directory within the workspace."""cwd: WorkspaceCwd!
}
"""The current working directory within the workspace. This is set to the directory where workspace detection started, and cannot be changed."""typeWorkspaceCwd {
"""Location of the current working directory within the workspace, relative to the workspace root. Empty string means the workspace root."""path: String!"""Returns a Directory from the current working directory. Relative paths resolve from this cwd."""directory(path: String!, exclude: [String!], include: [String!], gitignore: Boolean = false): Directory!"""Returns a File from the current working directory. Relative paths resolve from this cwd."""file(path: String!): File!
}
Semantics:
Workspace.path always reports the detected workspace path.
Workspace.directory(".") keeps loading the detected workspace.
Workspace.cwd.path reports the cwd offset.
Workspace.cwd.directory(".") loads the cwd.
Explicit local and remote workspace refs follow the same model.
Activity
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
5 remaining items
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API
core: add workspace cwd API