cytomining / pycytominer

Python package for processing image-based profiling data
https://pycytominer.readthedocs.io
BSD 3-Clause "New" or "Revised" License
78 stars 35 forks source link

fix: add workspaceDir to git safe directories for devcontainers #379

Closed shntnu closed 7 months ago

shntnu commented 7 months ago

Description

When creating the container via VSCode v1.87.2 on my local OSX 14.2.1 (23C71), I got the error Detected Git repository, but failed because of dubious ownership

I found a fix here: https://sam.hooke.me/note/2023/08/poetry-fixing-dubious-ownership-error/

What is the nature of your change?

Checklist

Please ensure that all boxes are checked before indicating that a pull request is ready for review.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.96%. Comparing base (9dd98ac) to head (a36b9ca). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #379 +/- ## ======================================= Coverage 94.96% 94.96% ======================================= Files 56 56 Lines 3136 3137 +1 ======================================= + Hits 2978 2979 +1 Misses 158 158 ``` | [Flag](https://app.codecov.io/gh/cytomining/pycytominer/pull/379/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cytomining) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/cytomining/pycytominer/pull/379/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cytomining) | `94.96% <ø> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cytomining#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shntnu commented 7 months ago

Looks good! Thanks!

Unfortunately that's failing locally. Is it possible workspaceFolder is not defined in that context? I have no idea how the configs work

[2024-03-23T21:28:12.150Z]   • Installing poetry-dynamic-versioning (1.2.0): Pending...
[2024-03-23T21:28:12.178Z]   • Installing poetry-dynamic-versioning (1.2.0): Downloading... 0%
[2024-03-23T21:28:12.180Z]   • Installing poetry-dynamic-versioning (1.2.0): Downloading... 100%
[2024-03-23T21:28:12.181Z]   • Installing poetry-dynamic-versioning (1.2.0): Installing...
[2024-03-23T21:28:12.188Z]   • Installing poetry-dynamic-versioning (1.2.0)
[2024-03-23T21:28:12.476Z] 
Writing lock file
[2024-03-23T21:28:12.707Z] error: wrong number of arguments, should be 2
usage: git config [<options>]

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
    --worktree            use per-worktree config file
    -f, --file <file>     use given config file
    --blob <blob-id>      read config from given blob object

Action
    --get                 get value: name [value-pattern]
    --get-all             get all values: key [value-pattern]
    --get-regexp          get values for regexp: name-regex [value-pattern]
    --get-urlmatch        get value specific for the URL: section[.var] URL
    --replace-all         replace all matching variables: name value [value-pattern]
    --add                 add a new variable: name value
    --unset               remove a variable: name [value-pattern]
    --unset-all           remove all matches: name [value-pattern]
    --rename-section      rename sec
[2024-03-23T21:28:12.707Z] tion: old-name new-name
    --remove-section      remove a section: name
    -l, --list            list all
    --fixed-value         use string equality when comparing values to 'value-pattern'
    -e, --edit            open an editor
    --get-color           find the color configured: slot [default]
[2024-03-23T21:28:12.708Z] 
    --get-colorbool       find the color setting: slot [stdout-is-tty]

Type
    -t, --type <type>     value is given this type
    --bool                value is "true" or "false"
    --int                 value is decimal number
    --bool-or-int         value is --bool or --int
    --bool-or-str         value is --bool or string
    --path                value is a path (file or directory name)
    --expiry-date         value is an expiry date

Other
    -z, --null            terminate values with NUL byte
    --name-only           show variable names only
    --includes            respect include directives on lookup
[2024-03-23T21:28:12.708Z]     --show-origin         show origin of config (file, standard input, blob, command line)
    --show-scope          show scope of config (worktree, local, global, system, command)
    --default <value>     with --get, use default value when missing entry

[2024-03-23T21:28:12.736Z] Stop (20219 ms): Run in container: /bin/sh -c sudo /usr/local/py-utils/bin/poetry self add "poetry-dynamic-versioning[plugin]" && git config --global --add safe.directory ${workspaceFolder}
[2024-03-23T21:28:12.737Z] onCreateCommand failed with exit code 129. Skipping any further user-provided commands.
[2024-03-23T21:28:12.751Z] Error: Command failed: /bin/sh -c sudo /usr/local/py-utils/bin/poetry self add "poetry-dynamic-versioning[plugin]" && git config --global --add safe.directory ${workspaceFolder}
[2024-03-23T21:28:12.751Z]     at uP (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:235:130)
[2024-03-23T21:28:12.751Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-03-23T21:28:12.751Z]     at async rh (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:227:4393)
[2024-03-23T21:28:12.752Z]     at async eh (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:227:3738)
[2024-03-23T21:28:12.752Z]     at async ih (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:227:2745)
[2024-03-23T21:28:12.752Z]     at async QrA (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:614:30774)
[2024-03-23T21:28:12.752Z]     at async ErA (/Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js:614:27992)
[2024-03-23T21:28:12.769Z] Stop (20979 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js run-user-commands --user-data-folder /Users/shsingh/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-6b9daa74-cdf1-4bc4-8a54-e509e23903501711229264654 --workspace-folder /Users/shsingh/Documents/GitHub/pycytominer --id-label devcontainer.local_folder=/Users/shsingh/Documents/GitHub/pycytominer --id-label devcontainer.config_file=/Users/shsingh/Documents/GitHub/pycytominer/.devcontainer/devcontainer.json --container-id 9cbd6faf46b1618871bbcc4d8a67dd23211746dd82a532bc9955144a4c716833 --log-level debug --log-format json --config /Users/shsingh/Documents/GitHub/pycytominer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --skip-non-blocking-commands true --prebuild false --stop-for-personalization true --remote-env REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-bcb47d16-3f47-4e6d-9f73-3a295aee1b83.sock --remote-env SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-bcb47d16-3f47-4e6d-9f73-3a295aee1b83.sock --remote-env REMOTE_CONTAINERS=true --mount-workspace-git-root --dotfiles-target-path ~/dotfiles
[2024-03-23T21:28:12.770Z] Exit code 1
[2024-03-23T21:28:12.781Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/shsingh/.vscode/extensions/ms-vscode-remote.remote-containers-0.348.0/dist/spec-node/devContainersSpecCLI.js run-user-commands --user-data-folder /Users/shsingh/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-6b9daa74-cdf1-4bc4-8a54-e509e23903501711229264654 --workspace-folder /Users/shsingh/Documents/GitHub/pycytominer --id-label devcontainer.local_folder=/Users/shsingh/Documents/GitHub/pycytominer --id-label devcontainer.config_file=/Users/shsingh/Documents/GitHub/pycytominer/.devcontainer/devcontainer.json --container-id 9cbd6faf46b1618871bbcc4d8a67dd23211746dd82a532bc9955144a4c716833 --log-level debug --log-format json --config /Users/shsingh/Documents/GitHub/pycytominer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --skip-non-blocking-commands true --prebuild false --stop-for-personalization true --remote-env REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-bcb47d16-3f47-4e6d-9f73-3a295aee1b83.sock --remote-env SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-bcb47d16-3f47-4e6d-9f73-3a295aee1b83.sock --remote-env REMOTE_CONTAINERS=true --mount-workspace-git-root --dotfiles-target-path ~/dotfiles
[2024-03-23T21:28:12.781Z] Exit code 1
kenibrewer commented 7 months ago

Can you try '${containerWorkspaceFolder}'?

shntnu commented 7 months ago

Can you try '${containerWorkspaceFolder}'?

Success! Worked on VSCode v1.87.2 on my local OSX 14.2.1 (23C71)

kenibrewer commented 7 months ago

I'll double check that it doesn't cause errors in Codespaces and then merge.