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

Entities marked as delete are remove and then added again when not present #684

Open
KrystianOcado opened this issue Feb 15, 2024 · 3 comments

Comments

@KrystianOcado
Copy link
Contributor

Describe the bug

When you mark an entity, e.g.: a project variable, with delete: true, GitLabForm tries to add it, if it doesn't find in the project and fail because it is missing required properties.

Consider this config:

variables:
  foobar:
    key: FOOBAR
    delete: true
  1. If the project has a variable called FOOBAR, on first run it will be removed. This is corect.
  2. However, on the second run, there is no FOOBAR variale and GitLabForm will try to add FOOBAR variable. But it will fail, because value property is missing.

GitLabForm version

Output of gitlabform -V

3.8.0

GitLab version

GitLab Enterprise Edition v16.7.5-ee

@amimas
Copy link
Collaborator

amimas commented Feb 18, 2024

If the project has a variable called FOOBAR, on first run it will be removed. This is corect.
However, on the second run, there is no FOOBAR variale and GitLabForm will try to add FOOBAR variable. But it will fail, because value property is missing.

Sounds like a bug. Thanks for the details. Maybe we have a missing acceptance test for the delete feature.

As an alternative, have you tried using the enforce config instead of delete for individual variable removal? Also, you mentioned "when you mark an entity with delete: true...", does that mean this issue happens with other entities or you only ran into the issue with variables config?

@KrystianOcado
Copy link
Contributor Author

Hi @amimas !

Thanks for your comment. I can't use enforce, because I don't want to remove other variables from my config, and I don't want to list them all in my GitLabForm config.

As for other entity types, I don't use other types of entities, but I believe this applies to other entities, because the code is common for many entity types.

@amimas
Copy link
Collaborator

amimas commented Feb 19, 2024

Thanks for clarifying. I personally haven't used the delete feature. So not sure if it's expected to remove that config after the first run. Also a little skeptical if the issue applies to all entities. My understanding is that this key is not supported on all types of config key. I could be wrong.

Anyways, you're already trying to provide a fix via PR. Thanks for that. If you can continue with it, that'd be great. Currently that PR is not mergeable though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants