Commit Graph

118 Commits

Author SHA1 Message Date
Sebastian Poxhofer 5f91549447 feat(gitlab): merge MRs through merge trains via the platform merge queue API (#45722)
* feat(gitlab): merge MRs through merge trains via the platform merge queue API

* feat(gitlab): report MRs waiting on a merge train through isPrInMergeQueue

* test(gitlab): drop targetBranch from mergePr calls

* Apply suggestion from @secustor

* refactor(gitlab): validate the merge train car response with a Zod schema
2026-09-09 15:21:46 +00:00
Sebastian Poxhofer 97327c3d28 refactor(linters): add prefer-coerce-array rule (#45492)
* refactor(linters): add prefer-coerce-array rule

Refs #45217

`x ?? []` and `coerceArray(x)` say the same thing, but only the second
one is searchable and consistent. The rule flags a `??` whose default is
a bare `[]` literal; a non-empty default or an asserted `([] as Foo[])`
still passes.

Applying it across `lib/` surfaced three spots the helper cannot cover,
which keep `?? []` with a disable comment or a narrower fix:

- `package-files.ts` destructures a tuple, which `coerceArray()` widens
- `generate.spec.ts` defaults `matchAll()`, an iterator rather than an array
- `mise/upgradeable-tooling.ts` declares a `Record` return, so its
  `?? []` fallback was wrong to begin with and becomes `coerceObject()`

* refactor(platform/github): hoist the GHE version header lookup

`Object.entries(...).find()` returns a tuple, and defaulting it with
`?? []` only to destructure the second element reads as an array
default when it is not one. Name the found entry instead, which drops
the `?? []` rather than routing a tuple through `coerceArray()`.
2026-08-28 09:27:58 +00:00
Stephen Breakey 2f9735f249 feat(gitlab): add gitlab codeowners role support (#44621)
* feat(gitlab): add gitlab codeowners role support

* chore: use named group in roleRegex

* Update lib/config/options/index.ts

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

* Update lib/modules/platform/gitlab/roles.ts

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

* chore: rename getMembers to getGroupMembers

* chore: refactor getRoleMemberUsernames

* chore: adjust test chaining

---------

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2026-07-22 08:36:15 +00:00
Sebastian Poxhofer 91e068f1fd test(linters): add linting rule to enforce v8 ignore reason declaration (#44726)
* ci(linter): add renovate/v8-ignore-reason rule

Flag coverage-ignore comments ("v8 ignore") that carry no justification.
Accepted forms: "-- reason" / "--- reason" (recommended) and the legacy
colon form "v8 ignore <kind>[ <count>]: reason", which is already
widespread in the codebase (29 sites). Bare "v8 ignore stop" markers are
exempt because the justification lives on the paired "start" marker. The
"v8 ignore next <N>" count form remains allowed; this rule only requires
a justification.

Registered as "warn" instead of "error": the repo currently has 119
reason-less v8 ignore comments, too many to fix mechanically in one PR,
so existing sites are left untouched and can be fixed incrementally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): promote renovate/v8-ignore-reason to error

Record the empirical verdict on the contested "v8 ignore next <N>" count
semantics in the rule doc: verified against vitest 4 with
ast-v8-to-istanbul that the count is not honored - the ignore hint always
exempts exactly the next AST node regardless of N. Counts are therefore
inert and stay allowed; the rule keeps requiring only a justification.

Promoting to error so all remaining reason-less coverage-ignore comments
must be fixed; the burndown follows in subsequent commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor: add justifications to coverage-ignore comments (batch 1)

Give every reason-less "v8 ignore" comment outside the large platform
index files a site-specific justification explaining why the exempted
branch is untestable or defensive, as now required by the
renovate/v8-ignore-reason rule.

Also guard against a nullish comment.loc in the rule itself; the
merged-in stricter tools typechecking flagged the unguarded access.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor: add justifications to coverage-ignore comments (batch 2)

Cover the five large platform index files (github, bitbucket,
bitbucket-server, codecommit, gitlab) with site-specific reasons on
every "v8 ignore" comment, completing the renovate/v8-ignore-reason
burndown. Two meaningless ignore hints inside commented-out CodeCommit
mergePr code are dropped instead of annotated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* Apply suggestions from code review

Co-authored-by: Michael Kriese <michael.kriese@gmx.de>

* Update lib/util/regex.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-07-20 13:01:39 +00:00
Sebastian Poxhofer 58771bb183 refactor(linters): enabled oxlints func-style (#44691)
* refactor(oxlint): enable func-style

Enable the built-in func-style rule as ["warn", "declaration"] so that
named functions are written as function declarations instead of arrow or
function expressions assigned to variables, matching the convention in
docs/development/best-practices.md (Functions section). Inline arrow
callbacks are unaffected; prefer-arrow-callback continues to cover the
callback direction.

Severity is "warn" instead of "error" as a fallback: a repo-wide run
found 196 pre-existing violations (70 in spec files, 126 in production
code), exceeding the 80-violation fix threshold for this change, so no
violations were fixed here. Follow-up work can convert the offenders
(largest clusters: lib/modules/versioning/ruby, lib/util/cache/package,
lib/modules/versioning/maven, lib/modules/versioning/gradle) and then
raise the rule to "error". Note oxlint 1.72 also supports an
allowTypeAnnotation option if typed consts should remain arrows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce func-style at error

* refactor(func-style): convert const-arrow functions to declarations in with-cache spec and ruby versioning

* refactor(func-style): convert const-arrow functions to declarations in maven/gradle modules

* refactor(func-style): convert const-arrow functions to declarations in remaining versioning modules

* refactor(func-style): convert const-arrow functions to declarations in platform modules

Discriminated-union closures (ensureCommentRemoval byTopic/byContent
helpers in github, gitlab, bitbucket, bitbucket-server) needed the
narrowed field passed explicitly as a parameter, since function
declarations are hoisted and lose the outer if-narrowing that inline
arrow-function closures previously relied on.

* refactor(func-style): convert const-arrow functions to declarations across util/manager/datasource modules

One case (logger/renovate-logger.ts logOnceFn) is kept as an arrow
function with a documented oxlint-disable: it is stored on
this.logger.once[level] and relies on lexically-bound this, which a
hoisted function declaration would not preserve.

* refactor(func-style): convert remaining const-arrow test helpers to declarations

get-updated.spec.ts: hoisted expectPipCompilePackageAndLockFile to
module scope (it only closes over the module-level pipCompile mock)
and added a documented oxlint-disable for vitest/expect-expect on its
caller test, since oxlint's expect-expect check does not trace
assertions through an externally-defined helper function.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:14:22 +00:00
Sebastian Poxhofer 9717259ffc refactor(oxlint): enable no-else-return and unicorn/no-lonely-if (#44553)
Enable no-else-return (with allowElseIf: false) and unicorn/no-lonely-if
as errors in .oxlintrc.json and fix all 131 pre-existing violations
(91 no-else-return, 40 unicorn/no-lonely-if) across 98 files.

The no-else-return violations were fixed with the oxlint autofix
(iterated to a fixpoint, plus two else-if chains that required
--fix-dangerously) followed by Prettier formatting. One comment dropped
by the autofix in lib/modules/manager/pub/artifacts.ts was restored
manually. The unicorn/no-lonely-if violations were merged by hand,
preserving comments and coverage-ignore hints.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 12:11:21 +00:00
Aman Agrawal c8fcd63278 refactor(platform/gitlab): fetch detailed_merge_status (#44122)
* refactor(platform/gitlab): changed merge_request to detailed_merge_request.

* refactor(platform/gitlab): changed merge_request to detailed_merge_request in scehma.ts and in pr-cache-tests

* refactor(platform/gitlab): enums added for detailed_merge_requests #44114

* refactor(platform/gitlab): added enums for detailed_merge_status and unit tests modified #44114

* refactor(platform/gitlab): detailed_merge_status field added in pr-cache unit tests

* refactor(platform/gitlab): made detailed_merge_status optional and catch statement to handle newer status for future #44114
2026-07-13 21:28:36 +00:00
Pieter Willekens 0019a19858 fix(platform/gitlab): guard non-string error message in setBranchStatus (#44117)
GitLab can return a non-string `message` in error bodies (e.g. validation errors as an object), which crashed `message.startsWith` with "err.body?.message?.startsWith is not a function". Guard with an `isString` check.
2026-07-11 10:42:03 +00:00
Felipe Santos 392105b7c6 chore(oxlint): enable unicorn plugin and prefer-node-protocol (#43283)
chore(oxlint): enable unicorn plugin and prefer-node-protocol
2026-05-29 06:55:58 +00:00
Sebastian Poxhofer 73b90e958b refactor: remove string concetation for production code (#43442)
refactor: prefer templates rather than `+`
2026-05-19 13:31:27 +00:00
Sebastian Poxhofer 2247113d0a fix(gitlab): capture invalid endpoint early and improve error message (#43291)
* fix: capture invalid endpoint early and improve error message

* refactor: use template literal

* fixup! refactor: use template literal
2026-05-13 12:51:53 +00:00
Timo Hankamer 93e5c47de4 feat(platform/gitlab): add MRs to merge trains via merge_trains API (#43217)
When a GitLab project has merge trains enabled, automerged MRs are now added to the merge train via POST /projects/:id/merge_trains/merge_requests/:iid with auto_merge:true (GitLab 17.11+). Non-merge-train projects keep using the existing /merge endpoint, preserving Renovate's pipeline-success guarantee for free-tier users.
2026-05-11 10:19:11 +00:00
Sergei Zharinov b79ea931a3 refactor(lint): Enable oxlint correctness category (#42218) 2026-03-28 19:48:52 +00:00
Florian Greinacher 21c011ad44 fix(gitlab): skip branch status when no pipeline found, retry after PR creation (#41130)
* fix(gitlab): skip branch status when no pipeline found, retry after PR creation

On GitLab with MR pipelines, posting a commit status without a
pipeline_id causes GitLab to create an unwanted branch pipeline.

Skip posting the status in setBranchStatus() when no pipeline is found
after retries. Retry setting branch statuses after ensurePr() in the
with-pr block so that the MR pipeline created by GitLab can be found.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(gitlab): gate skip-status-without-pipeline behind experimental flag

Move the behavior that skips setting a branch status check when no
pipeline is found behind the RENOVATE_X_GITLAB_SKIP_STATUS_WITHOUT_PIPELINE
experimental environment variable. Without the flag, the original
behavior of always posting the status is preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(gitlab): restore original 'sets branch status' test case

Keep the original test that verifies branch status is set without
the experimental flag alongside the new skip-behavior test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): sort experimental env var headers alphabetically

Move RENOVATE_X_GITLAB_SKIP_STATUS_WITHOUT_PIPELINE after
RENOVATE_X_GITLAB_MERGE_REQUEST_DELAY to satisfy alphabetical
ordering requirement in self-hosted-experimental.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(gitlab): address PR review comments for skip-status-without-pipeline

Use strict `=== 'true'` check for env var, update docs wording, and
add test coverage for the new experimental flag behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-27 16:45:46 +00:00
Jamie Tanna 2eb1e1e706 chore(platforms): correct typo in "up-to-date" (#41460) 2026-02-24 16:13:17 +00:00
Adam Setch 579ff4c2ba feat: hyperlink warnings to dep dashboard (#40395)
* feat: hyperlink warnings to dep dashboard

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* feat: hyperlink warnings to dep dashboard

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* feat: hyperlink warnings to dep dashboard

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* feat: hyperlink warnings to dep dashboard

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* add tests

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* update tests

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* Merge branch 'main' into feat/hyperlink-dashboard

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* updated forgejo smartLinks

Signed-off-by: Adam Setch <adam.setch@outlook.com>

---------

Signed-off-by: Adam Setch <adam.setch@outlook.com>
2026-02-20 15:19:35 +00:00
Michael Kriese 912c623d60 test: full coverage for platforms (#41318)
chore: full coverage for platforms
2026-02-19 11:05:15 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Philippe GRANET 0f54593f44 fix(gitlab): skip automerge retry when merge_when_pipeline_succeeds already set (#39979)
Avoid unnecessary retry loops when merge_when_pipeline_succeeds is already
enabled on a merge request. This prevents wasting ~15 seconds per MR when
reattempting platform automerge on MRs with failed pipelines.

Co-authored-by: Ona <no-reply@ona.com>
2026-02-03 17:53:49 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
RahulGautamSingh 1413d5ac6d fix(gitlab): skip on unknown reviewers (#39619)
* skip on unknown reviewers instead of failing

* Update lib/modules/platform/gitlab/http.ts

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

* Update lib/modules/platform/gitlab/http.ts

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>

* skip of none reviewers could be fetched

---------

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2026-01-07 16:03:57 +00:00
Kyle Sferrazza 32befe2944 fix(gitlab): properly massage config migration MR links (#39474)
fix gitlab migration MR link

closes #32178
2025-12-15 08:20:36 +00:00
Jellyfrog 16ea48d86d feat(gitlab): add support for autodiscovery repo sort/order (#39680) 2025-12-04 16:04:17 +00:00
RahulGautamSingh 6dc48db8e1 refactor(gitlab): use http.getJson (#38688)
* use getJson

* fix schema and tests

* make updated_at & target_branch non-optional

* convert head_pipeline[sha] to LongCommitSha type

* make assignee object nullable

* make head_pipleline nullable

* fix: revert some changes

* fix schema definition

* Apply Suggestions

* fix test

---------

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-12-03 09:29:46 +00:00
Michael Kriese 32f73bb511 fix(platform): includeMirrors is a global only option (#39580) 2025-11-27 10:46:30 +00:00
Michael Kriese ad710ec6ea fix(platform): endpoint is a global only option (#39579) 2025-11-27 10:12:16 +00:00
Michael Kriese 0af770947b fix: ignorePrAuthor is a global repo config (#39578) 2025-11-27 09:05:15 +00:00
Michael Kriese 050ac8d23b chore: better code coverage (#39518) 2025-11-25 15:01:54 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Jamie Tanna 1fc5c91dc3 fix(gitlab): revert "use http.getJson" (#38477)
Revert "refactor(gitlab): use `http.getJson` (#37678)"

This reverts commit 3a04ef7218.
2025-10-08 18:04:43 +00:00
RahulGautamSingh 3a04ef7218 refactor(gitlab): use http.getJson (#37678)
* use getJson

* fix schema and tests

* make updated_at & target_branch non-optional

* convert head_pipeline[sha] to LongCommitSha type
2025-10-08 14:09:30 +00:00
Michael Kriese 798b7c7ab5 fix: use shared email type (#37512) 2025-08-14 13:34:03 +00:00
Michael Kriese 25f9c1c5ea refactor(gitlab): move code (#37483) 2025-08-13 15:36:59 +00:00
matteosilv 5136633811 feat(gitlab): allow overriding token used to set pr as approved (#36066)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-08-07 12:47:42 +00:00
Connor Pearson b890421f76 fix(gitlab): consider the merge train setting in getBranchForceRebase (#36960) 2025-07-14 19:05:51 +00:00
Maxime Morille 743ef8f29c feat: add support of Gitlab's sections for CODEOWNERS (#32061)
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2025-06-07 09:08:50 +00:00
RahulGautamSingh 03d27b3167 feat(gitlab): implement pr cache (#34747)
Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-06-05 07:01:50 +00:00
Rhys Arkins c7051dca31 chore(gitlab): debug log approveMr() function (#36122) 2025-05-24 19:26:26 +00:00
RahulGautamSingh 49fa1be464 feat(util): getEnv (#35161)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-06 18:37:28 +00:00
renovate[bot] fffd986fa7 chore(deps): update linters (main) (#35113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-04-02 14:28:27 +00:00
Sergei Zharinov db8dda2378 fix: Explicitly disable memCache when caching is switched on/off (#35060)
Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
2025-03-30 08:02:36 +00:00
Sergei Zharinov f977700649 feat(http): Switch to memory cache provider (#33901)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-03-24 08:02:47 +00:00
Sergei Zharinov f957ea8fec test: Fix coverage for platform code (#34719) 2025-03-23 07:06:52 +00:00
Sergei Zharinov b78eb9b73b fix(gitlab): Fix the platform test performance (#34410) 2025-02-23 14:17:02 +00:00
Rhys Arkins 8c2d438540 fix(platform/gitlab): Revert "feat(platform/gitlab): use Notes API for automerge to support merge trains" (#34353) 2025-02-20 14:23:27 +00:00
renovate[bot] 55845508b6 chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00
Florian S. d156938dbe feat(platform/gitlab): use Notes API for automerge to support merge trains (#34102)
Signed-off-by: Florian Ströger <stroeger@youniqx.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-02-20 00:44:53 +00:00
Philippe GRANET 78f389ac55 feat(gitlab): add branch status check attemps (#32692)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-31 08:11:49 +00:00
Sergei Zharinov 9b4e515024 refactor(http): Separate getJson and getJsonUnchecked (#33651) 2025-01-17 14:18:00 +00:00
RahulGautamSingh db31a1634c fix(gitlab): truncate comment (#33348) 2025-01-08 12:07:30 +00:00