Conversation
| if err != nil || u.Hostname() == "" { | ||
| return false | ||
| } | ||
| return !strings.HasSuffix(u.Hostname(), "is.not.configured") |
There was a problem hiding this comment.
i think this should be shared constant
There was a problem hiding this comment.
Pull request overview
This PR fixes GitLab commit status updates failing when DetailsURL is a pipelines-as-code placeholder (e.g. https://dashboard.is.not.configured) by omitting target_url in that case, avoiding GitLab’s URL validation rejection and preserving status reporting.
Changes:
- Add
isResolvableTargetURLhelper to detect and exclude*.is.not.configuredplaceholder URLs fromtarget_url. - Update
CreateStatusto only setTargetURLwhen the details URL is not a placeholder. - Add unit tests verifying
target_urlis omitted for placeholder URLs and included for real URLs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/provider/gitlab/gitlab.go | Conditionally omits target_url for placeholder details URLs to prevent GitLab API 400s. |
| pkg/provider/gitlab/gitlab_test.go | Adds coverage to ensure placeholder vs real DetailsURL produces correct target_url behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/ok-to-test |
|
/paco review |
Paco Review ✅This PR adds a helper isResolvableTargetURL that filters out GitLab commit status target_url values that are pipelines-as-code's placeholder 'is.not.configured' URLs, since GitLab's API rejects target_urls with unresolvable hosts. CreateStatus now only sets TargetURL when the details URL passes this check, and two new table-driven tests cover the placeholder-omitted and real-url-sent cases. Review difficulty: 2/5 (Easy) — Small, localized change to a single function with matching test coverage and low blast radius. No new review comments found at this time. Nice work! Reviewed commit: a7761ac |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2915 +/- ##
==========================================
+ Coverage 69.07% 70.71% +1.64%
==========================================
Files 198 199 +1
Lines 16991 18012 +1021
==========================================
+ Hits 11736 12737 +1001
- Misses 4396 4408 +12
- Partials 859 867 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Good call. Pulled |
|
When convenient, could someone add |
|
can you please sqaush your commits and update your branch with upstream/main |
When a PipelineRun fails to start on GitLab (e.g. an admission webhook rejection) and no Tekton/OpenShift/custom dashboard has been configured, pipelines-as-code falls back to a placeholder details URL such as "https://dashboard.is.not.configured" (defined across pkg/consoleui/*.go). CreateStatus in the GitLab provider always sent this placeholder as the commit status target_url. GitLab validates target_url and rejects hosts that do not resolve via DNS with a 400 "target_url: [is blocked: URI is invalid]" error, which fails the whole SetCommitStatus call. For a push event (no merge request to comment on), CreateStatus has no other fallback in that case, so the status is silently lost and only visible in the controller logs. Add isResolvableTargetURL to only set opt.TargetURL on the GitLab commit status when the details URL parses to a non-empty hostname that does not end in the shared consoleui.NotConfiguredURLSuffix ("is.not.configured"), the suffix used by every placeholder across the console UI fallbacks. When the URL is a placeholder, target_url is simply omitted from the request instead of being sent, mirroring how the GitHub provider already guards DetailsURL before setting it. Per review feedback, the "is.not.configured" suffix is now exported as consoleui.NotConfiguredURLSuffix and reused by isResolvableTargetURL and by the other consoleui fallback URL builders (custom, openshift, tektondashboard), so there is a single source of truth instead of hardcoded copies. Report: tektoncd#2029 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
3b02a9f to
5887d41
Compare
|
Squashed the two commits into one and rebased on top of upstream/main. |
|
/ok-to-test |
|
in description you say that: But I tried this on main branch and |
|
/test go-testing |
|
Fair point, and I'd rather be straight about what I actually know than argue from the original report. #2029 does have a real captured log with |
|
@pujitha24 there is no issue in merging the changes but if URL is |
@pujitha24 also we expect contributions from real human assisted by AI (we're fine if everything is reviewed properly) so please review code, comments you're making from your AI agent. reviewers are spending their time in suggesting changes, and testing your PR code and AI hallucinations wastes time. |
|
can you please update about this if you think its still needed or do I close it? |
|
Thanks for following up — closing this one. You are right that the placeholder at least signals "no dashboard configured", which is more useful than an absent URL. And I could not reconcile the #2029 log ( Closing rather than leaving it open. |
|
Also on your earlier point — taken, and it was fair to raise. Concretely since then: I've closed this PR rather than have you spend more review time on it, and added the |
📝 Description of the Change
When a PipelineRun fails to start on GitLab (e.g. an admission webhook
rejection) and no Tekton/OpenShift/custom dashboard has been configured,
pipelines-as-code falls back to a placeholder details URL such as
https://dashboard.is.not.configured. The GitLab provider'sCreateStatusalways sent this placeholder as the commit status
target_url. In theoriginal report (#2029), this caused GitLab to return a 400
target_url: [is blocked: URI is invalid]error, which failed the wholeSetCommitStatuscall. For a push event (no merge request to comment on),there is no other fallback, so the status update was silently lost and only
visible in the controller logs. We haven't been able to reliably reproduce
this against current gitlab.com, so the exact conditions that trigger it
aren't fully clear, but the placeholder never pointed to anything useful
either way.
This change adds an
isResolvableTargetURLcheck in the GitLab provider sotarget_urlis only sent when the details URL is not one of the*.is.not.configuredplaceholders used across the console UI fallbacks.When it is a placeholder,
target_urlis simply omitted from the requestinstead of being sent.
🔗 Linked GitHub Issue
Fixes #
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.
AI assistance: this change was drafted with Claude Code.
Fixes #2029