devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
1.03k stars 263 forks source link

devcontainer config overwrites my dependabot.yml #274

Closed 3f6a closed 3 months ago

3f6a commented 8 months ago

When I create a new devcontainer, for some reason vscode always attempts to rewrite my dependabot.yml file. It is trying to add this:

version: 2
updates:
 - package-ecosystem: "devcontainers"
   directory: "/"
   schedule:
     interval: weekly

Is this necessary? Could this snippet be appended to dependabot.yml, instead of overwriting my existing file?

samruddhikhandale commented 8 months ago

Thanks for reporting! The snippet you mentioned will be helpful to ensure that your dev container remains up-to-date with the latest published Feature versions.

Is this necessary? Could this snippet be appended to dependabot.yml, instead of overwriting my existing file?

This request definitely makes sense and this looks like a bug; we should not attempt to overwrite an existing dependabot.yml file.

Looping in @joshspicer who has more context on ^

3f6a commented 8 months ago

The snippet you mentioned will be helpful to ensure that your dev container remains up-to-date with the latest published Feature versions.

Yes this is clear. My contention is that the original dependabot.yml should not be overwritten. So appending this would be fine.

joshspicer commented 8 months ago

Thanks for the suggestion. As you've seen, currently the tooling only knows how to prompt with the options 'keep existing file' or 'overwrite file' if there's any file conflicts. That behavior is working correctly for you, right?

We don't have special cases for merging files. I could see a case for special behavior for certain files (like dependabot.yaml) although it would require some work in the extension to special-case this (or potentially doing most of the heavy lifting in cli's template apply command 🤔

3f6a commented 8 months ago

currently the tooling only knows how to prompt with the options 'keep existing file' or 'overwrite file' if there's any file conflicts. That behavior is working correctly for you, right?

I never got this option. My dependabot.yaml was simply overwritten, without asking.

bramswenson commented 7 months ago

Can this feature be disabled completely by configuration @joshspicer? Thanks in advance.

joshspicer commented 7 months ago

@3f6a, @bramswenson - You both are applying these templates from the VS Code extension, not directly from the command line, right?

This is the prompt I see when trying to apply a templates when I already have a dependabot.yml

Image

If you folks confirm you're not seeing the prompt we'll look to get that fixed.

@bramswenson Perhaps a boolean configuration option 'Allow product-specific configuration?' could be added and passed through to filter such files? Would that solve this for you?

joshspicer commented 3 months ago

I think this sketch of a proposal may be a nice solution to provide Template authors a way to encode "optional" paths contained within the Template (eg: product-specific folders like .github, boilerplate code, etc...)

I'd then update the Templates repo to mark all .github directories as optional and the tooling would let one either include or exclude when applying the Template. Thoughts?

joshspicer commented 3 months ago

Completed, see https://github.com/microsoft/vscode-remote-release/issues/10095#issuecomment-2307570273