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 modules: deprecate basic auth method #8383

Conversation

lgatellier
Copy link
Contributor

SUMMARY

This PR deprecates basic auth for GitLab modules, since this auth method has been removed from GitLab a long time ago (in GitLab 9.5, released in August 2017, if I'm right).

It will allow to remove some specific code from module_utils/gitlab.py and enhance maintainability.

ISSUE TYPE
  • Refactoring Pull Request
COMPONENT NAME

gitlab_deploy_key
gitlab_project_badge
gitlab_hook
gitlab_project_variable
gitlab_label
gitlab_instance_variable
gitlab_project_members
gitlab_project_access_token
gitlab_group_access_token
gitlab_merge_request
gitlab_branch
gitlab_project
gitlab_milestone
gitlab_runner
gitlab_protected_branch
gitlab_group_variable
gitlab_user
gitlab_group_members
gitlab_group
gitlab_issue

ADDITIONAL INFORMATION

Another PR will follow to remove this code in community.general v9.0.0

@ansibullbot

This comment was marked as outdated.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI gitlab module_utils module_utils needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR plugins plugin (any type) small_patch Hopefully easy to review labels May 18, 2024
@lgatellier lgatellier force-pushed the feat/deprecate-gitlab-basic-auth branch from 22ebefc to 1aff691 Compare May 18, 2024 10:22
@ansibullbot

This comment was marked as outdated.

Copy link
Contributor

@nejch nejch left a comment

Choose a reason for hiding this comment

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

LGTM. I seriously doubt there'd still be any GitLab instances out in the wild still supporting basic auth.

Personally I'm also not sure if job token auth makes sense, because none of the current GitLab API resources in the modules here support job token auth. Just for your consideration if you think it would simplify things more. See https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html.

gitlab_job_token = module.params['api_job_token']
.

(not sure if this also warrants a changelog entry)

@lgatellier lgatellier force-pushed the feat/deprecate-gitlab-basic-auth branch from 1aff691 to e30c53e Compare May 18, 2024 10:32
@ansibullbot ansibullbot added tests tests and removed ci_verified Push fixes to PR branch to re-run CI small_patch Hopefully easy to review labels May 18, 2024
@ansibullbot

This comment was marked as outdated.

@lgatellier
Copy link
Contributor Author

lgatellier commented May 18, 2024

Thanks for your review @nejch !

LGTM. I seriously doubt there'd still be any GitLab instances out in the wild still supporting basic auth.

I hope no one still run such old versions. 🤞

Personally I'm also not sure if job token auth makes sense, because none of the current GitLab API resources in the modules here support job token auth. Just for your consideration if you think it would simplify things more. See https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html.

gitlab_job_token = module.params['api_job_token']

.

You're right, but I don't know if it makes sense to remove a feature which would be re-added later for another module (like a gitlab release creation for example).

(not sure if this also warrants a changelog entry)

EDIT : I added a changelog fragment, since deprecated_features key is supported.

I'm also not sure about how to handle sanity issues on module.deprecate() call.

A collection maintainer may help us of the last 3 points.

@lgatellier lgatellier force-pushed the feat/deprecate-gitlab-basic-auth branch from e30c53e to 79b25d7 Compare May 18, 2024 10:52
@felixfontein felixfontein added the check-before-release PR will be looked at again shortly before release and merged if possible. label May 18, 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!

changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml Outdated Show resolved Hide resolved
plugins/module_utils/gitlab.py Outdated Show resolved Hide resolved
tests/sanity/ignore-2.13.txt Outdated Show resolved Hide resolved
@lgatellier lgatellier force-pushed the feat/deprecate-gitlab-basic-auth branch from 79b25d7 to bb27b90 Compare May 19, 2024 12:42
@lgatellier lgatellier force-pushed the feat/deprecate-gitlab-basic-auth branch from bb27b90 to 51ab10e Compare May 19, 2024 12:43
@lgatellier
Copy link
Contributor Author

lgatellier commented May 19, 2024

@felixfontein I just applied your remarks 😉

Should I open another PR removing the deprecated code now, or should I do it once 9.0.0 will be released ?

You're right, but I don't know if it makes sense to remove a feature which would be re-added later for another module (like a gitlab release creation for example).

What do you think about that (see details in the previous comments) ?

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label May 19, 2024
@felixfontein
Copy link
Collaborator

Should I open another PR removing the deprecated code now, or should I do it once 9.0.0 will be released ?

Once this is merged ;) It won't get merged until we have a stable-9 branch, but since that will happen tomorrow, feel free to already create it ;-)

@felixfontein
Copy link
Collaborator

Personally I'm also not sure if job token auth makes sense, because none of the current GitLab API resources in the modules here support job token auth. Just for your consideration if you think it would simplify things more. See https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html.

gitlab_job_token = module.params['api_job_token']

You're right, but I don't know if it makes sense to remove a feature which would be re-added later for another module (like a gitlab release creation for example).

That's a good question. It would probably be a good idea to move it to a separate docs fragment, and modify the argspec creation in module_utils to add this only when requested.

Then we can deprecate it from the current set of modules, but still use it later for specific modules where this is actually needed.

What do you think?

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label May 19, 2024
@felixfontein felixfontein merged commit 70c78c1 into ansible-collections:main May 19, 2024
132 checks passed
@felixfontein
Copy link
Collaborator

@lgatellier thanks for your contribution!
@nejch thanks for reviewing!

@lgatellier lgatellier deleted the feat/deprecate-gitlab-basic-auth branch May 19, 2024 19:00
@lgatellier
Copy link
Contributor Author

That's a good question. It would probably be a good idea to move it to a separate docs fragment, and modify the argspec creation in module_utils to add this only when requested.

Then we can deprecate it from the current set of modules, but still use it later for specific modules where this is actually needed.

What do you think?

Thats a nice solution, thanks for your advice !

austinlucaslake pushed a commit to austinlucaslake/community.general that referenced this pull request May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gitlab module_utils module_utils plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants