🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

fix(gitlabsearch): add structure squash to keep custom parameters - #11518

Merged
olblak merged 3 commits into
updatecli:mainfrom
XinHan9:fix/gitlabsearch-on-custom-gitlab-instance
Dec 2, 2026
Merged

olblak merged 3 commits into
updatecli:mainfrom
XinHan9:fix/gitlabsearch-on-custom-gitlab-instance

Conversation

@XinHan9

@XinHan9 XinHan9 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

This modification is done to send to each gitlab SCM created from a gitlabsearch the correct parameters ( e.g. custom URL ) provided by the operator.

Currently, if you put a custom gitlab url like this:

  projects:
    kind: gitlabsearch
    spec:
      url: {{ $config.gitlabUrl | quote }}
      group: {{ $config.projects.group | quote }}

And a config file like this:

gitlabUrl: gitlab.custom.example
projects:
  group: xxx
  branch: "^(main|master)$"
  limit: 0

Assuming that $config is the config you give in input of updatecli, doing a updatecli diff or a updatecli apply will detect repositories from your group correctly but will try to pull not on your custom gitlab url, instead it will call the default value gitlab.com.

Test

To test this pull request, you can run the following commands:

> updatecli pipeline diff --values .\fleet.yaml --debug

DEBUG: Default Updatecli manifest detected "updatecli.yaml"
Loading Pipeline "updatecli.yaml"
DEBUG: Processing gitlabsearch scm "projects" for potential multiple repository discovery
DEBUG: Processing GitLab project: awsome-project-test
DEBUG: Loaded 2 pipeline configuration(s) from "updatecli.yaml"

SCM repository retrieved: 1
DEBUG: cloning git repository: https://gitlab.com/xxx/awsome-project-test.git in Temp\1/updatecli/xxx/awsome-project-test
ERROR: failed cloning GitLab repository "https://gitlab.com/xxx/awsome-project-test.git"
ERROR: err - cloning: authentication required: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. If a token was provided, it was either incorrect, expired, or improperly scoped. See https://gitlab.com/help/topics/git/troubleshooting_git.md#error-on-git-fetch-http-basic-access-denied

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.
  • I have tested this pull request manually with a custom Updatecli build and it works as expected.

Tradeoff

Potential improvement

Summary by CodeRabbit

  • Bug Fixes
    • Improved how embedded GitLab settings are decoded from configuration, helping ensure values are recognized consistently.

This modification is done to send to each gitlab SCM created from a gitlabsearch the correct parameters ( e.g. custom URL ) provided by the operator

Signed-off-by: Valentin Lebourg <valentin.lebourg@sofrecom.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1369a630-acfb-436d-b7f2-960c904c62fb
Commits

Reviewing files that changed from the base of the PR and between 5aa6cb2 and 470faa9.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The GitLab Spec field retains its YAML inline tag and gains a mapstructure squash tag.

Changes: GitLab Spec decoding

Layer / File(s) Summary
Embedded Spec decoding
pkg/plugins/scms/gitlab/main.go
The embedded client.Spec field gains the mapstructure:",squash" tag. Its YAML inline tag remains unchanged.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: olblak

Merge Risk: Minimal · previous review ccdb1

This change makes GitLab SCMs created from gitlabsearch keep operator-supplied settings such as a custom GitLab URL. The change is small and touches only a decoding tag. No remaining merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the gitlabsearch fix and the squash tag that keeps custom parameters. The change adds mapstructure:",squash" to the embedded client.Spec in the GitLab SCM Spec, so the title matches th…
Description check Passed The description explains the problem clearly: a custom GitLab URL set in gitlabsearch is ignored, and clones fall back to gitlab.com. It includes a reproduction config, a test section with command and…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the gitlabsearch fix and the squash tag that keeps custom parameters. The change adds mapstructure:",squash" to the embedded client.Spec in the GitLab SCM Spec, so the title matches the single-line change. It follows the conventional-commit style and is specific enough for a teammate scanning history. Minor issue: 'structure squash' is slightly unusual wording for a mapstructure squash tag, but the meaning is clear.

Full details: Description check

Explanation

The description explains the problem clearly: a custom GitLab URL set in gitlabsearch is ignored, and clones fall back to gitlab.com. It includes a reproduction config, a test section with command and output, and a checked manual-testing box. The template's Fix # line is missing, and the tradeoff and potential improvement sections are left as placeholders. The test output shows a failed clone against gitlab.com, which does not confirm the fix works, so the test evidence is weak. The description is mostly complete, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48056700-bf42-4744-a284-9c3730ca42ae
Commits

Reviewing files that changed from the base of the PR and between 80d7640 and ccdb1ef.

Files selected for processing: 1

  • pkg/plugins/scms/gitlab/main.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@olblak
olblak enabled auto-merge (squash) December 2, 2026 17:02
@olblak olblak added bug Something isn't working scm-gitlabsearch labels Dec 2, 2026
olblak added a commit that referenced this pull request Dec 2, 2026
…les (#11599)

Specs generated by azuredevopssearch reach azuredevops.New as a Spec
struct. Without a squash tag, mapstructure nested the embedded client
spec, so the first decode returned an empty client spec. The fallbacks
then restored each field, but a username or token set in the spec was
overridden by UPDATECLI_AZURE_DEVOPS_USERNAME and
UPDATECLI_AZURE_DEVOPS_TOKEN, unlike a spec written in a manifest.

Squash the embedded client spec, as done for GitLab in #11518, and add
regression tests for both struct and manifest input.

Signed-off-by: Olblak <me@olblak.com>
@olblak
olblak merged commit 4db84af into updatecli:main Dec 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working scm-gitlabsearch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants