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

gitlab_instance_variable: Add support for 'raw' property #9425

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

KBjorndal-VizRT
Copy link
Contributor

SUMMARY

Adds support for the "raw" property on CI variables, which also makes the module idempotent when used against GitLab versions that support this property. Fixes #9424

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request
COMPONENT NAME

gitlab_instance_variable

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Dec 27, 2024
@KBjorndal-VizRT KBjorndal-VizRT marked this pull request as ready for review December 27, 2024 10:30
@ansibullbot ansibullbot removed the WIP Work in progress label Dec 27, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Dec 27, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added some first comments.

plugins/modules/gitlab_instance_variable.py Outdated Show resolved Hide resolved
plugins/modules/gitlab_instance_variable.py Show resolved Hide resolved
@@ -160,6 +166,7 @@ def create_variable(self, var_obj):
"value": var_obj.get('value'),
"masked": var_obj.get('masked'),
"protected": var_obj.get('protected'),
"raw": var_obj.get('raw'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does happen if the version of python-gitlab and/or GitLab itself do not support raw?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see python-gitlab just passes everything through from the API, so version of that would be irrelevant. If the gitlab instance is so old it doesn't support raw it's severely out of date (a couple of years) and long out of support.

That said I think what would happen is that you would get the same idempotence issue that currently exists for up to date versions.

Not sure if there is a very easy way to make this backwards compatible. And the gitlab_group_variable and gitlab_project_variable plugins do the exact same thing without trying to do any backwards compatibility handling.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The support for these modules was added in e7d8ef4. Since the PR is doing basically the same as here, let's assume this is fine as well.

KBjorndal-VizRT and others added 2 commits December 27, 2024 14:50
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 30, 2024
@felixfontein felixfontein merged commit f8bfd5d into ansible-collections:main Dec 30, 2024
129 checks passed
Copy link

patchback bot commented Dec 30, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/f8bfd5df0dfb46afd23bf29a0c5f8c3e7c1d264c/pr-9425

Backported as #9477

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 30, 2024
* gitlab_instance_variable: Add support for 'raw' property

* Changelog fragment

* Add missing punctuation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add version_added

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f8bfd5d)
@felixfontein
Copy link
Collaborator

@KBjorndal-VizRT thanks for implementing this!
@russoz thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Dec 30, 2024
… support for 'raw' property (#9477)

gitlab_instance_variable: Add support for 'raw' property (#9425)

* gitlab_instance_variable: Add support for 'raw' property

* Changelog fragment

* Add missing punctuation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add version_added

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f8bfd5d)

Co-authored-by: KBjorndal-VizRT <83645484+KBjorndal-VizRT@users.noreply.github.com>
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…lections#9425)

* gitlab_instance_variable: Add support for 'raw' property

* Changelog fragment

* Add missing punctuation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add version_added

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for raw variables in gitlab_instance_variable
3 participants