From f134cea34cdb2a3641fede26c0c30826f67ac02d Mon Sep 17 00:00:00 2001 From: Andy LADJADJ Date: Fri, 17 Jan 2025 16:02:45 +0100 Subject: [PATCH 1/9] feat(integration): add Gerrit option to activate the edit mode Signed-off-by: Andy LADJADJ --- .changeset/ten-spies-explode.md | 11 ++++++++ docs/integrations/gerrit/locations.md | 2 ++ packages/integration/config.d.ts | 5 ++++ packages/integration/report.api.md | 1 + .../src/gerrit/GerritIntegration.test.ts | 26 +++++++++++++++++-- .../src/gerrit/GerritIntegration.ts | 12 +++++++-- .../integration/src/gerrit/config.test.ts | 22 ++++++++++++++++ packages/integration/src/gerrit/config.ts | 14 ++++++---- packages/integration/src/gerrit/core.ts | 23 ++++++++++++++++ 9 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 .changeset/ten-spies-explode.md diff --git a/.changeset/ten-spies-explode.md b/.changeset/ten-spies-explode.md new file mode 100644 index 0000000000..ba7d406398 --- /dev/null +++ b/.changeset/ten-spies-explode.md @@ -0,0 +1,11 @@ +--- +'@backstage/integration': minor +--- + +Add Gerrit option to activate the edit mode for version >= 3.9 + +``` + enableEditUrl: true +``` + +The url pattern is `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` diff --git a/docs/integrations/gerrit/locations.md b/docs/integrations/gerrit/locations.md index 3f237fc9ba..79e7771bc6 100644 --- a/docs/integrations/gerrit/locations.md +++ b/docs/integrations/gerrit/locations.md @@ -22,6 +22,7 @@ integrations: gitilesBaseUrl: https://gerrit.company.com/gitiles baseUrl: https://gerrit.company.com/gerrit cloneUrl: https://gerrit.company.com/clone + enableEditUrl: true username: ${GERRIT_USERNAME} password: ${GERRIT_PASSWORD} ``` @@ -37,6 +38,7 @@ a structure with up to six elements: address here. This is the address that you would open in a browser. - `cloneUrl` (optional): The base URL for HTTP clones. Will default to `baseUrl` if not set. The address used to clone a repo is the `cloneUrl` plus the repo name. +- `enableEditUrl` (optional): Activate the edit mode for Gerrit >= 3.9 - `username` (optional): The Gerrit username to use in API requests. If neither a username nor password are supplied, anonymous access will be used. - `password` (optional): The password or http token for the Gerrit user. diff --git a/packages/integration/config.d.ts b/packages/integration/config.d.ts index 1e4c8d373d..fc4559f73a 100644 --- a/packages/integration/config.d.ts +++ b/packages/integration/config.d.ts @@ -161,6 +161,11 @@ export interface Config { * @visibility frontend */ cloneUrl?: string; + /** + * Activate the edit url feature available since Gerrit 3.9 + * @visibility frontend + */ + enableEditUrl?: boolean; /** * The username to use for authenticated requests. * @visibility secret diff --git a/packages/integration/report.api.md b/packages/integration/report.api.md index 6bb48b8185..ecf46b10f1 100644 --- a/packages/integration/report.api.md +++ b/packages/integration/report.api.md @@ -392,6 +392,7 @@ export type GerritIntegrationConfig = { host: string; baseUrl?: string; cloneUrl?: string; + enableEditUrl?: boolean; gitilesBaseUrl: string; username?: string; password?: string; diff --git a/packages/integration/src/gerrit/GerritIntegration.test.ts b/packages/integration/src/gerrit/GerritIntegration.test.ts index 2cfc748550..b415636072 100644 --- a/packages/integration/src/gerrit/GerritIntegration.test.ts +++ b/packages/integration/src/gerrit/GerritIntegration.test.ts @@ -47,6 +47,7 @@ describe('GerritIntegration', () => { it('returns the basics', () => { const integration = new GerritIntegration({ host: 'gerrit-review.example.com', + gitilesBaseUrl: 'https://gerrit-review.example.com/gitiles', } as any); expect(integration.type).toBe('gerrit'); expect(integration.title).toBe('gerrit-review.example.com'); @@ -70,6 +71,7 @@ describe('GerritIntegration', () => { it('handles line numbers', () => { const integration = new GerritIntegration({ host: 'gerrit-review.example.com', + gitilesBaseUrl: 'https://gerrit-review.example.com/gitiles', } as any); expect( @@ -85,6 +87,7 @@ describe('GerritIntegration', () => { describe('resolves with a relative url', () => { const integration = new GerritIntegration({ host: 'gerrit-review.example.com', + gitilesBaseUrl: 'https://gerrit-review.example.com/gitiles', } as any); it('works for valid urls pointing to a branch', () => { expect( @@ -144,8 +147,27 @@ describe('GerritIntegration', () => { // url as is. expect( integration.resolveEditUrl( - 'https://gerrit-review.example.com/catalog-info.yaml', + 'https://gerrit-review.example.com/gitiles/backstage/backstage/+/refs/heads/master/catalog-info.yaml', ), - ).toBe('https://gerrit-review.example.com/catalog-info.yaml'); + ).toBe( + 'https://gerrit-review.example.com/gitiles/backstage/backstage/+/refs/heads/master/catalog-info.yaml', + ); + }); + + it('resolve edit URL with editUrl', () => { + const integration = new GerritIntegration({ + host: 'gerrit-review.example.com', + baseUrl: 'https://gerrit-review.example.com', + enableEditUrl: true, + gitilesBaseUrl: 'https://gerrit-review.example.com/gitiles', + } as any); + + expect( + integration.resolveEditUrl( + 'https://gerrit-review.example.com/gitiles/backstage/backstage/+/refs/heads/master/catalog-info.yaml', + ), + ).toBe( + 'https://gerrit-review.example.com/admin/repos/edit/repo/backstage/backstage/branch/refs/heads/master/file/catalog-info.yaml', + ); }); }); diff --git a/packages/integration/src/gerrit/GerritIntegration.ts b/packages/integration/src/gerrit/GerritIntegration.ts index 7e2e757c6b..adca205ac7 100644 --- a/packages/integration/src/gerrit/GerritIntegration.ts +++ b/packages/integration/src/gerrit/GerritIntegration.ts @@ -20,7 +20,7 @@ import { GerritIntegrationConfig, readGerritIntegrationConfigs, } from './config'; -import { parseGitilesUrlRef } from './core'; +import { buildGerritEditUrl, parseGitilesUrlRef } from './core'; /** * A Gerrit based integration. @@ -75,7 +75,15 @@ export class GerritIntegration implements ScmIntegration { } resolveEditUrl(url: string): string { - // Not applicable for gerrit. + if (this.config.enableEditUrl) { + const parsed = parseGitilesUrlRef(this.config, url); + return buildGerritEditUrl( + this.config, + parsed.project, + parsed.ref, + parsed.path, + ); + } return url; } } diff --git a/packages/integration/src/gerrit/config.test.ts b/packages/integration/src/gerrit/config.test.ts index be31193f2e..8bf1a3d44c 100644 --- a/packages/integration/src/gerrit/config.test.ts +++ b/packages/integration/src/gerrit/config.test.ts @@ -57,6 +57,7 @@ describe('readGerritIntegrationConfig', () => { host: 'a.com', baseUrl: 'https://a.com/api', cloneUrl: 'https:a.com/clone', + enableEditUrl: false, gitilesBaseUrl: 'https://a.com/git', username: 'u', password: ' p ', @@ -66,12 +67,32 @@ describe('readGerritIntegrationConfig', () => { host: 'a.com', baseUrl: 'https://a.com/api', cloneUrl: 'https:a.com/clone', + enableEditUrl: false, gitilesBaseUrl: 'https://a.com/git', username: 'u', password: 'p', }); }); + it('activate Edit Url', () => { + const output = readGerritIntegrationConfig( + buildConfig({ + host: 'a.com', + enableEditUrl: true, + gitilesBaseUrl: 'https://a.com/gerrit/plugins/gitiles', + }), + ); + expect(output).toEqual({ + host: 'a.com', + baseUrl: 'https://a.com', + cloneUrl: 'https://a.com', + enableEditUrl: true, + gitilesBaseUrl: 'https://a.com/gerrit/plugins/gitiles', + username: undefined, + password: undefined, + }); + }); + it('can create a default value if the API base URL is missing', () => { const output = readGerritIntegrationConfig( buildConfig({ @@ -156,6 +177,7 @@ describe('readGerritIntegrationConfigs', () => { host: 'b.com', baseUrl: 'https://b.com/api', cloneUrl: 'https://b.com/api', + enableEditUrl: undefined, gitilesBaseUrl: 'https://b.com/gerrit/plugins/gitiles', username: undefined, password: undefined, diff --git a/packages/integration/src/gerrit/config.ts b/packages/integration/src/gerrit/config.ts index a5fdc8dabf..710e2847de 100644 --- a/packages/integration/src/gerrit/config.ts +++ b/packages/integration/src/gerrit/config.ts @@ -44,6 +44,11 @@ export type GerritIntegrationConfig = { */ cloneUrl?: string; + /** + * Activate the edit url feature available since Gerrit 3.9 + */ + enableEditUrl?: boolean; + /** * Base url for Gitiles. This is needed for creating a valid * user-friendly url that can be used for browsing the content of the @@ -75,6 +80,7 @@ export function readGerritIntegrationConfig( const host = config.getString('host'); let baseUrl = config.getOptionalString('baseUrl'); let cloneUrl = config.getOptionalString('cloneUrl'); + const enableEditUrl = config.getOptionalBoolean('enableEditUrl'); let gitilesBaseUrl = config.getString('gitilesBaseUrl'); const username = config.getOptionalString('username'); const password = config.getOptionalString('password')?.trim(); @@ -101,21 +107,19 @@ export function readGerritIntegrationConfig( } else { baseUrl = `https://${host}`; } - if (gitilesBaseUrl) { - gitilesBaseUrl = trimEnd(gitilesBaseUrl, '/'); - } else { - gitilesBaseUrl = `https://${host}`; - } if (cloneUrl) { cloneUrl = trimEnd(cloneUrl, '/'); } else { cloneUrl = baseUrl; } + gitilesBaseUrl = trimEnd(gitilesBaseUrl, '/'); + return { host, baseUrl, cloneUrl, + enableEditUrl, gitilesBaseUrl, username, password, diff --git a/packages/integration/src/gerrit/core.ts b/packages/integration/src/gerrit/core.ts index d44865881d..6b90bb28ef 100644 --- a/packages/integration/src/gerrit/core.ts +++ b/packages/integration/src/gerrit/core.ts @@ -208,6 +208,29 @@ export function buildGerritGitilesUrl( }/${project}/+/refs/heads/${branch}/${trimStart(filePath, '/')}`; } +/** + * Build a Gerrit Gitiles url that targets a specific path. + * + * @param config - A Gerrit provider config. + * @param project - The name of the git project + * @param branch - The branch we will target. + * @param filePath - The absolute file path. + * @public + */ +export function buildGerritEditUrl( + config: GerritIntegrationConfig, + project: string, + branch: string, + filePath: string, +): string { + return `${ + config.baseUrl + }/admin/repos/edit/repo/${project}/branch/refs/heads/${branch}/file/${trimStart( + filePath, + '/', + )}`; +} + /** * Build a Gerrit Gitiles archive url that targets a specific branch and path * From 86decb69d1aed022d8e64507cc610e1ee0f1cb8f Mon Sep 17 00:00:00 2001 From: Andy Ladjadj Date: Mon, 3 Feb 2025 19:07:58 +0100 Subject: [PATCH 2/9] docs: add link to the regex pattern Signed-off-by: Andy LADJADJ --- docs/integrations/gerrit/locations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/gerrit/locations.md b/docs/integrations/gerrit/locations.md index 79e7771bc6..a0c48692a8 100644 --- a/docs/integrations/gerrit/locations.md +++ b/docs/integrations/gerrit/locations.md @@ -38,7 +38,7 @@ a structure with up to six elements: address here. This is the address that you would open in a browser. - `cloneUrl` (optional): The base URL for HTTP clones. Will default to `baseUrl` if not set. The address used to clone a repo is the `cloneUrl` plus the repo name. -- `enableEditUrl` (optional): Activate the edit mode for Gerrit >= 3.9 +- `enableEditUrl` (optional): Activate the edit mode for Gerrit >= 3.9 following the [official pattern](https://gerrit-review.googlesource.com/Documentation/user-inline-edit.html#create_from_url) - `username` (optional): The Gerrit username to use in API requests. If neither a username nor password are supplied, anonymous access will be used. - `password` (optional): The password or http token for the Gerrit user. From f56ee499043feeaf147fb7d04b2858eb7658c4fa Mon Sep 17 00:00:00 2001 From: Andy LADJADJ Date: Mon, 24 Mar 2025 15:25:13 +0100 Subject: [PATCH 3/9] chore: activate gerrit editURL by default Signed-off-by: Andy LADJADJ --- .changeset/ten-spies-explode.md | 8 +++----- docs/integrations/gerrit/locations.md | 6 ++++-- packages/integration/report.api.md | 2 +- .../src/gerrit/GerritIntegration.test.ts | 5 +++-- .../src/gerrit/GerritIntegration.ts | 19 ++++++++++--------- .../integration/src/gerrit/config.test.ts | 10 +++++----- packages/integration/src/gerrit/config.ts | 8 ++++---- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.changeset/ten-spies-explode.md b/.changeset/ten-spies-explode.md index ba7d406398..6e6dac205a 100644 --- a/.changeset/ten-spies-explode.md +++ b/.changeset/ten-spies-explode.md @@ -2,10 +2,8 @@ '@backstage/integration': minor --- -Add Gerrit option to activate the edit mode for version >= 3.9 +Implement Edit URL feature for Gerrit 3.9+. Enabled by default due to 3.8 EOL -``` - enableEditUrl: true -``` +Details: - The Edit URL feature allows for direct editing of files in Gerrit through a specific URL pattern. - URL pattern: `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` -The url pattern is `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` +Caution: - To turn off this functionality, you can add the configuration `disableEditUrl: true` in the Gerrit integration section of your settings diff --git a/docs/integrations/gerrit/locations.md b/docs/integrations/gerrit/locations.md index a0c48692a8..16827dbf09 100644 --- a/docs/integrations/gerrit/locations.md +++ b/docs/integrations/gerrit/locations.md @@ -11,6 +11,8 @@ or registered with the [catalog-import](https://github.com/backstage/backstage/tree/master/plugins/catalog-import) plugin. +Gerrit 3.9+ supports inline editing via URL. the integration enables this by default, following Gerrit's [official URL pattern](https://gerrit-review.googlesource.com/Documentation/user-inline-edit.html#create_from_url) for inline edits. + ## Configuration To use this integration, add at least one Gerrit configuration to your root `app-config.yaml`: @@ -22,7 +24,7 @@ integrations: gitilesBaseUrl: https://gerrit.company.com/gitiles baseUrl: https://gerrit.company.com/gerrit cloneUrl: https://gerrit.company.com/clone - enableEditUrl: true + disableEditUrl: false username: ${GERRIT_USERNAME} password: ${GERRIT_PASSWORD} ``` @@ -38,7 +40,7 @@ a structure with up to six elements: address here. This is the address that you would open in a browser. - `cloneUrl` (optional): The base URL for HTTP clones. Will default to `baseUrl` if not set. The address used to clone a repo is the `cloneUrl` plus the repo name. -- `enableEditUrl` (optional): Activate the edit mode for Gerrit >= 3.9 following the [official pattern](https://gerrit-review.googlesource.com/Documentation/user-inline-edit.html#create_from_url) +- `disableEditUrl` (optional): Disable the edit mode for Gerrit < 3.9 - `username` (optional): The Gerrit username to use in API requests. If neither a username nor password are supplied, anonymous access will be used. - `password` (optional): The password or http token for the Gerrit user. diff --git a/packages/integration/report.api.md b/packages/integration/report.api.md index ecf46b10f1..9baabdd6ce 100644 --- a/packages/integration/report.api.md +++ b/packages/integration/report.api.md @@ -392,7 +392,7 @@ export type GerritIntegrationConfig = { host: string; baseUrl?: string; cloneUrl?: string; - enableEditUrl?: boolean; + disableEditUrl?: boolean; gitilesBaseUrl: string; username?: string; password?: string; diff --git a/packages/integration/src/gerrit/GerritIntegration.test.ts b/packages/integration/src/gerrit/GerritIntegration.test.ts index b415636072..0d4058d47e 100644 --- a/packages/integration/src/gerrit/GerritIntegration.test.ts +++ b/packages/integration/src/gerrit/GerritIntegration.test.ts @@ -138,9 +138,10 @@ describe('GerritIntegration', () => { }); }); - it('resolve edit URL', () => { + it('resolve Url when editUrl is disabled', () => { const integration = new GerritIntegration({ host: 'gerrit-review.example.com', + disableEditUrl: true, } as any); // Resolve edit URLs is not applicable for gerrit. Return the input @@ -158,8 +159,8 @@ describe('GerritIntegration', () => { const integration = new GerritIntegration({ host: 'gerrit-review.example.com', baseUrl: 'https://gerrit-review.example.com', - enableEditUrl: true, gitilesBaseUrl: 'https://gerrit-review.example.com/gitiles', + disableEditUrl: false, } as any); expect( diff --git a/packages/integration/src/gerrit/GerritIntegration.ts b/packages/integration/src/gerrit/GerritIntegration.ts index adca205ac7..ba2153c817 100644 --- a/packages/integration/src/gerrit/GerritIntegration.ts +++ b/packages/integration/src/gerrit/GerritIntegration.ts @@ -75,15 +75,16 @@ export class GerritIntegration implements ScmIntegration { } resolveEditUrl(url: string): string { - if (this.config.enableEditUrl) { - const parsed = parseGitilesUrlRef(this.config, url); - return buildGerritEditUrl( - this.config, - parsed.project, - parsed.ref, - parsed.path, - ); + if (this.config.disableEditUrl) { + return url; } - return url; + + const parsed = parseGitilesUrlRef(this.config, url); + return buildGerritEditUrl( + this.config, + parsed.project, + parsed.ref, + parsed.path, + ); } } diff --git a/packages/integration/src/gerrit/config.test.ts b/packages/integration/src/gerrit/config.test.ts index 8bf1a3d44c..7b6dc01e7e 100644 --- a/packages/integration/src/gerrit/config.test.ts +++ b/packages/integration/src/gerrit/config.test.ts @@ -57,7 +57,7 @@ describe('readGerritIntegrationConfig', () => { host: 'a.com', baseUrl: 'https://a.com/api', cloneUrl: 'https:a.com/clone', - enableEditUrl: false, + disableEditUrl: true, gitilesBaseUrl: 'https://a.com/git', username: 'u', password: ' p ', @@ -67,7 +67,7 @@ describe('readGerritIntegrationConfig', () => { host: 'a.com', baseUrl: 'https://a.com/api', cloneUrl: 'https:a.com/clone', - enableEditUrl: false, + disableEditUrl: true, gitilesBaseUrl: 'https://a.com/git', username: 'u', password: 'p', @@ -78,7 +78,7 @@ describe('readGerritIntegrationConfig', () => { const output = readGerritIntegrationConfig( buildConfig({ host: 'a.com', - enableEditUrl: true, + disableEditUrl: false, gitilesBaseUrl: 'https://a.com/gerrit/plugins/gitiles', }), ); @@ -86,7 +86,7 @@ describe('readGerritIntegrationConfig', () => { host: 'a.com', baseUrl: 'https://a.com', cloneUrl: 'https://a.com', - enableEditUrl: true, + disableEditUrl: false, gitilesBaseUrl: 'https://a.com/gerrit/plugins/gitiles', username: undefined, password: undefined, @@ -177,7 +177,7 @@ describe('readGerritIntegrationConfigs', () => { host: 'b.com', baseUrl: 'https://b.com/api', cloneUrl: 'https://b.com/api', - enableEditUrl: undefined, + disableEditUrl: undefined, gitilesBaseUrl: 'https://b.com/gerrit/plugins/gitiles', username: undefined, password: undefined, diff --git a/packages/integration/src/gerrit/config.ts b/packages/integration/src/gerrit/config.ts index 710e2847de..549842da9e 100644 --- a/packages/integration/src/gerrit/config.ts +++ b/packages/integration/src/gerrit/config.ts @@ -45,9 +45,9 @@ export type GerritIntegrationConfig = { cloneUrl?: string; /** - * Activate the edit url feature available since Gerrit 3.9 + * Disable the edit url feature for Gerrit <= 3.8. */ - enableEditUrl?: boolean; + disableEditUrl?: boolean; /** * Base url for Gitiles. This is needed for creating a valid @@ -80,7 +80,7 @@ export function readGerritIntegrationConfig( const host = config.getString('host'); let baseUrl = config.getOptionalString('baseUrl'); let cloneUrl = config.getOptionalString('cloneUrl'); - const enableEditUrl = config.getOptionalBoolean('enableEditUrl'); + const disableEditUrl = config.getOptionalBoolean('disableEditUrl'); let gitilesBaseUrl = config.getString('gitilesBaseUrl'); const username = config.getOptionalString('username'); const password = config.getOptionalString('password')?.trim(); @@ -119,7 +119,7 @@ export function readGerritIntegrationConfig( host, baseUrl, cloneUrl, - enableEditUrl, + disableEditUrl, gitilesBaseUrl, username, password, From aab955ddc790f6610e7f19bec11eb2a43099e677 Mon Sep 17 00:00:00 2001 From: Andy LADJADJ Date: Mon, 24 Mar 2025 15:28:55 +0100 Subject: [PATCH 4/9] style: update changeset format Signed-off-by: Andy LADJADJ --- .changeset/ten-spies-explode.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.changeset/ten-spies-explode.md b/.changeset/ten-spies-explode.md index 6e6dac205a..efbddef1be 100644 --- a/.changeset/ten-spies-explode.md +++ b/.changeset/ten-spies-explode.md @@ -4,6 +4,11 @@ Implement Edit URL feature for Gerrit 3.9+. Enabled by default due to 3.8 EOL -Details: - The Edit URL feature allows for direct editing of files in Gerrit through a specific URL pattern. - URL pattern: `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` +Details: -Caution: - To turn off this functionality, you can add the configuration `disableEditUrl: true` in the Gerrit integration section of your settings +- The Edit URL feature allows for direct editing of files in Gerrit through a specific URL pattern. +- URL pattern: `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` + +Caution: + +- To turn off this functionality, you can add the configuration `disableEditUrl: true` in the Gerrit integration section of your settings From f687ad4cbdcfb9e0083c3de0a69fbd7328b25ad0 Mon Sep 17 00:00:00 2001 From: Andy LADJADJ Date: Mon, 24 Mar 2025 15:28:55 +0100 Subject: [PATCH 5/9] chore: update config definition Signed-off-by: Andy LADJADJ --- packages/integration/config.d.ts | 4 ++-- packages/integration/src/gerrit/config.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/integration/config.d.ts b/packages/integration/config.d.ts index fc4559f73a..e819fb203f 100644 --- a/packages/integration/config.d.ts +++ b/packages/integration/config.d.ts @@ -162,10 +162,10 @@ export interface Config { */ cloneUrl?: string; /** - * Activate the edit url feature available since Gerrit 3.9 + * Disable the edit url feature for Gerrit version less than 3.9. * @visibility frontend */ - enableEditUrl?: boolean; + disableEditUrl?: boolean; /** * The username to use for authenticated requests. * @visibility secret diff --git a/packages/integration/src/gerrit/config.ts b/packages/integration/src/gerrit/config.ts index 549842da9e..0d1939dda8 100644 --- a/packages/integration/src/gerrit/config.ts +++ b/packages/integration/src/gerrit/config.ts @@ -45,7 +45,7 @@ export type GerritIntegrationConfig = { cloneUrl?: string; /** - * Disable the edit url feature for Gerrit <= 3.8. + * Disable the edit url feature for Gerrit version less than 3.9. */ disableEditUrl?: boolean; From 5081531ca4446d023dd2de30265ef645988eea95 Mon Sep 17 00:00:00 2001 From: Andy Ladjadj Date: Mon, 28 Apr 2025 10:52:02 +0200 Subject: [PATCH 6/9] docs: update .changeset/ten-spies-explode.md Co-authored-by: Vincenzo Scamporlino Signed-off-by: Andy Ladjadj --- .changeset/ten-spies-explode.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.changeset/ten-spies-explode.md b/.changeset/ten-spies-explode.md index efbddef1be..53a37fbd74 100644 --- a/.changeset/ten-spies-explode.md +++ b/.changeset/ten-spies-explode.md @@ -2,13 +2,6 @@ '@backstage/integration': minor --- -Implement Edit URL feature for Gerrit 3.9+. Enabled by default due to 3.8 EOL +Implement Edit URL feature for Gerrit 3.9+. -Details: - -- The Edit URL feature allows for direct editing of files in Gerrit through a specific URL pattern. -- URL pattern: `^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$` - -Caution: - -- To turn off this functionality, you can add the configuration `disableEditUrl: true` in the Gerrit integration section of your settings +It's possible to disable the edit url by adding the `disableEditUrl: true` config in the Gerrit integration. From 5727e7e0a65149d2df89f516c37b430d9ee30a47 Mon Sep 17 00:00:00 2001 From: Andy Ladjadj Date: Mon, 28 Apr 2025 10:52:16 +0200 Subject: [PATCH 7/9] docs: update docs/integrations/gerrit/locations.md Co-authored-by: Vincenzo Scamporlino Signed-off-by: Andy Ladjadj --- docs/integrations/gerrit/locations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/gerrit/locations.md b/docs/integrations/gerrit/locations.md index 16827dbf09..ffe24c8201 100644 --- a/docs/integrations/gerrit/locations.md +++ b/docs/integrations/gerrit/locations.md @@ -40,7 +40,7 @@ a structure with up to six elements: address here. This is the address that you would open in a browser. - `cloneUrl` (optional): The base URL for HTTP clones. Will default to `baseUrl` if not set. The address used to clone a repo is the `cloneUrl` plus the repo name. -- `disableEditUrl` (optional): Disable the edit mode for Gerrit < 3.9 +- `disableEditUrl` (optional): Disable the edit mode. - `username` (optional): The Gerrit username to use in API requests. If neither a username nor password are supplied, anonymous access will be used. - `password` (optional): The password or http token for the Gerrit user. From 221474c980797f4f806c8a070759a723aad32688 Mon Sep 17 00:00:00 2001 From: Andy Ladjadj Date: Mon, 28 Apr 2025 10:52:26 +0200 Subject: [PATCH 8/9] docs: update packages/integration/config.d.ts Co-authored-by: Vincenzo Scamporlino Signed-off-by: Andy Ladjadj --- packages/integration/config.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration/config.d.ts b/packages/integration/config.d.ts index beca642594..429645d11b 100644 --- a/packages/integration/config.d.ts +++ b/packages/integration/config.d.ts @@ -182,7 +182,7 @@ export interface Config { */ cloneUrl?: string; /** - * Disable the edit url feature for Gerrit version less than 3.9. + * Disable the edit url feature. * @visibility frontend */ disableEditUrl?: boolean; From b7cba28da6ba6d83d84a6fdfdf53e79295e90d66 Mon Sep 17 00:00:00 2001 From: Andy LADJADJ Date: Mon, 28 Apr 2025 15:29:12 +0200 Subject: [PATCH 9/9] docs: update locations.md Signed-off-by: Andy LADJADJ --- docs/integrations/gerrit/locations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/gerrit/locations.md b/docs/integrations/gerrit/locations.md index ffe24c8201..b69aee9016 100644 --- a/docs/integrations/gerrit/locations.md +++ b/docs/integrations/gerrit/locations.md @@ -11,7 +11,7 @@ or registered with the [catalog-import](https://github.com/backstage/backstage/tree/master/plugins/catalog-import) plugin. -Gerrit 3.9+ supports inline editing via URL. the integration enables this by default, following Gerrit's [official URL pattern](https://gerrit-review.googlesource.com/Documentation/user-inline-edit.html#create_from_url) for inline edits. +Gerrit 3.9+ supports inline editing via URL. The integration enables this by default, following Gerrit's [official URL pattern](https://gerrit-review.googlesource.com/Documentation/user-inline-edit.html#create_from_url) for inline edits. ## Configuration