- Notifications
You must be signed in to change notification settings - Fork262
Add support for disabling SSL verification in GitLab client#1364
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
BB-steel wants to merge1 commit intopython-semantic-release:masterChoose a base branch fromBB-steel:allow_insecure_gitlab
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
Add support for disabling SSL verification in GitLab client#1364
BB-steel wants to merge1 commit intopython-semantic-release:masterfromBB-steel:allow_insecure_gitlab
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR adds SSL certificate verification configuration to the GitLab HVCS client by passing thessl_verify parameter to thegitlab.Gitlab constructor.
- Adds
ssl_verify=not allow_insecureparameter when initializing the GitLab client to properly handle SSL/TLS certificate verification
💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request fixes a bug where
python-semantic-releasefails to create releases on self-hosted GitLab instances that use self-signed or internally-issued SSL certificates.When the
insecure = trueflag is set inpyproject.toml, the release process currently fails with anSSLCertVerificationError, preventing users from publishing releases in their private GitLab environments. This PR ensures that theinsecureflag is correctly honored.Solves:
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failedwhen runningsemantic-release publishagainst a self-hosted GitLab instance.Rationale
The root cause of the issue is that the
allow_insecureparameter in thesemantic_release.hvcs.gitlab.Gitlabclass was not being passed down to the underlyingpython-gitlabclient.The
gitlab.Gitlabconstructor accepts anssl_verifyparameter, which defaults toTrue. Thepython-semantic-releasewrapper did not utilize theallow_insecureflag to modify this behavior. As a result, thepython-gitlabclient always attempted to verify SSL certificates, regardless of the user's configuration inpyproject.toml.The solution is to explicitly pass
ssl_verify=not allow_insecureduring the initialization of thegitlab.Gitlabclient withinsemantic_release/hvcs/gitlab.py. This directly connects the configuration option to the client's behavior, making theinsecureflag work as intended.Workarounds like setting
REQUESTS_CA_BUNDLEorGITLAB_SSL_VERIFYenvironment variables were considered but are less ideal as they require extra configuration in the user's CI/CD environment rather than fixing the bug at its source.How did you test?
This change was validated through manual end-to-end testing in a CI/CD environment that replicates the original issue.
Methodology:
python-semantic-releaseand applied the code change on a new branch.pyproject.tomlfile was configured with the following remote settings:python-semantic-releasedirectly from the forked Git repository and branch.-uv pip install "git+https://github.com/your-username/python-semantic-release.git@fix/gitlab-ssl-verify"semantic-release publishcommand.SSLCertVerificationError.publishstep, creating a new release in the self-hosted GitLab project.No edge cases were identified, as this change simply wires a boolean flag to its intended destination. Existing unit tests continue to pass.
How to Verify
A reviewer can verify this fix by following these steps:
pyproject.tomlas follows:python-semantic-release.semantic-release publish.mainbranch, which should fail with theSSLCertVerificationError.PR Completion Checklist