Resolve status update issue for GitLab instances with relative paths #1881
+6
−5
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.
Issue: https://issues.redhat.com/browse/SRVKP-6899
For GitLab instances hosted under a relative path
(e.g., https://example.servehttp.com/gitlab),
status updates on MR fail to propagate correctly.
Although initial events like Repository CR creation, starting PipelineRuns based on webhooks from GitLab, reporting status on Pipeline start works fine.
subsequent updates (e.g., marking the PipelineRun as Finished) do not reflect in GitLab, leaving the status stuck on Running state.
Though pipelinerun is completed
on GitLab UI it shows running state only
below is the error we got on pac watcher pod
Root Cause:
When we have /gitlab relative path in the API we are getting
the wrong organization info because there is a function which
get Organization and Repository info again from URL
so for a GitLab API https://example.servehttp.com/gitlab/root/testpac
initially Organization and Repository value from GitLab coming
as root and testpac
But later in the event.go file we are refetching Organization and
Repository from event.URL because of that
Organization is coming as gitlab/root and
Repository as testpac.
that's why getting project info api call ex:
(https://example.servehttp.com/gitlab/api/v4/projects/gitlab/root/testpac)
is failing with 404 error
With this PR changes now status is getting updated successfully.
VERIFIED with and without relative path
Changes
Submitter Checklist
📝 Please ensure your commit message is clear and informative. For guidance on crafting effective commit messages, refer to the How to write a git commit message guide. We prefer the commit message to be included in the PR body itself rather than a link to an external website (ie: Jira ticket).
♽ Before submitting a PR, run make test lint to avoid unnecessary CI processing. For an even more efficient workflow, consider installing pre-commit and running pre-commit install in the root of this repository.
✨ We use linters to maintain clean and consistent code. Please ensure you've run make lint before submitting a PR. Some linters offer a --fix mode, which can be executed with the command make fix-linters (ensure markdownlint and golangci-lint tools are installed first).
📖 If you're introducing a user-facing feature or changing existing behavior, please ensure it's properly documented.
🧪 While 100% coverage isn't a requirement, we encourage unit tests for any code changes where possible.
🎁 If feasible, please check if an end-to-end test can be added. See README for more details.
🔎 If there's any flakiness in the CI tests, don't necessarily ignore it. It's better to address the issue before merging, or provide a valid reason to bypass it if fixing isn't possible (e.g., token rate limitations).
If you are adding a provider feature, please fill up the following details which provider this feature supports:
(make sure to update the documentation accordingly)