Skip to content

Commit

Permalink
Merge pull request #24892 from backstage/patch-release-pr-24838-24862…
Browse files Browse the repository at this point in the history
…-24865

Patch release of #24838, #24862, #24865
  • Loading branch information
benjdlambert committed May 27, 2024
2 parents fe4b090 + 80e40f3 commit 013a080
Show file tree
Hide file tree
Showing 12 changed files with 197 additions and 61 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "1.27.3",
"version": "1.27.4",
"private": true,
"repository": {
"type": "git",
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @backstage/cli

## 0.26.6

### Patch Changes

- f481835: Fix issue with `esm` loaded dependencies being different from the `cjs` import for Vite dependencies

## 0.26.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@backstage/cli",
"version": "0.26.5",
"version": "0.26.6",
"description": "CLI for developing Backstage plugins and apps",
"backstage": {
"role": "cli"
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/lib/bundler/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
});

if (process.env.EXPERIMENTAL_VITE) {
const vite = await import('vite');
const { default: viteReact } = await import('@vitejs/plugin-react');
const { nodePolyfills: viteNodePolyfills } = await import(
'vite-plugin-node-polyfills'
);
const { createHtmlPlugin: viteHtml } = await import('vite-plugin-html');
const vite = require('vite');
const { default: viteReact } = require('@vitejs/plugin-react');
const {
nodePolyfills: viteNodePolyfills,
} = require('vite-plugin-node-polyfills');
const { createHtmlPlugin: viteHtml } = require('vite-plugin-html');
viteServer = await vite.createServer({
define: {
global: 'window',
Expand Down
7 changes: 7 additions & 0 deletions plugins/catalog-backend-module-gitlab/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @backstage/plugin-catalog-backend-module-gitlab

## 0.3.16

### Patch Changes

- c6db9d7: Fixed an issue in `GitlabOrgDiscoveryEntityProvider` where a missing `orgEnabled` config key was throwing an error.
- 2e9a0ae: Fixed an issue in `GitlabDiscoveryEntityProvider` where the fallback branch was taking precedence over the GitLab default branch.

## 0.3.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion plugins/catalog-backend-module-gitlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
]
}
},
"version": "0.3.15"
"version": "0.3.16"
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ const httpProjectCatalogDynamic = all_projects_response.map(project => {
`${apiBaseUrl}/projects/${path}/repository/files/catalog-info.yaml`,
(req, res, ctx) => {
const branch = req.url.searchParams.get('ref');
if (branch === project.default_branch) {
if (
branch === project.default_branch ||
branch === 'main' ||
branch === 'develop'
) {
return res(ctx.status(200));
}
return res(ctx.status(404, 'Not Found'));
Expand Down
120 changes: 112 additions & 8 deletions plugins/catalog-backend-module-gitlab/src/__testUtils__/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const config_github_host: MockObject = {
},
};

export const config_single_integration_branch: MockObject = {
export const config_single_integration: MockObject = {
integrations: {
gitlab: [
{
Expand All @@ -178,7 +178,6 @@ export const config_single_integration_branch: MockObject = {
'test-id': {
host: 'example.com',
group: 'group1',
branch: 'main',
skipForkedRepos: false,
schedule: {
frequency: 'PT30M',
Expand All @@ -190,6 +189,33 @@ export const config_single_integration_branch: MockObject = {
},
};

export const config_single_integration_specific_branch: MockObject = {
integrations: {
gitlab: [
{
host: 'example.com',
apiBaseUrl: 'https://example.com/api/v4',
token: '1234',
},
],
},
catalog: {
providers: {
gitlab: {
'test-id': {
host: 'example.com',
group: 'group1',
branch: 'develop',
skipForkedRepos: false,
schedule: {
frequency: 'PT30M',
timeout: 'PT3M',
},
},
},
},
},
};
export const config_single_integration_group: MockObject = {
integrations: {
gitlab: [
Expand Down Expand Up @@ -234,7 +260,7 @@ export const config_fallbackBranch_branch: MockObject = {
'test-id': {
host: 'example.com',
group: 'group1',
fallbackBranch: 'staging',
fallbackBranch: 'main',
skipForkedRepos: false,
schedule: {
frequency: 'PT30M',
Expand Down Expand Up @@ -634,7 +660,7 @@ export const all_projects_response: GitLabProject[] = [
web_url: 'https://example.com/group1/test-repo5-staging',
path_with_namespace: 'group1/test-repo5-staging',
},
// diffrent group
// different group
{
id: 6,
description: 'Project Six Description',
Expand All @@ -646,6 +672,17 @@ export const all_projects_response: GitLabProject[] = [
web_url: 'https://example.com/group1/test-repo6',
path_with_namespace: 'awesome-group/test-repo6',
},
// no default branch
{
id: 7,
description: 'Project Seven Description',
name: 'test-repo7',
path: 'test-repo7',
archived: false,
last_activity_at: new Date().toString(),
web_url: 'https://example.com/group1/test-repo7',
path_with_namespace: 'group1/test-repo7',
},
];

export const all_users_response: GitLabUser[] = [
Expand Down Expand Up @@ -686,7 +723,7 @@ export const all_users_response: GitLabUser[] = [
avatar_url: 'https://secure.gravatar.com/',
web_url: 'https://gitlab.example/luigi_mario',
},
// malfomed email address
// malformed email address
{
id: 5,
username: 'MarioMario',
Expand Down Expand Up @@ -1299,9 +1336,43 @@ export const push_modif_event: EventParams = {
/**
* Expected Backstage entities
*/
export const expected_location_entities: MockObject[] =

// includes only projects that have a default branch (for when the branch and fallback branch were not set in the config)
export const expected_location_entities_default_branch: MockObject[] =
all_projects_response
.filter(project => project.default_branch)
.map(project => {
const targetUrl = `https://example.com/${project.path_with_namespace}/-/blob/${project.default_branch}/catalog-info.yaml`;

return {
entity: {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Location',
metadata: {
annotations: {
'backstage.io/managed-by-location': `url:${targetUrl}`,
'backstage.io/managed-by-origin-location': `url:${targetUrl}`,
},
name: locationSpecToMetadataName({
target: targetUrl,
type: 'url',
}),
},
spec: {
presence: 'optional',
target: targetUrl,
type: 'url',
},
},
locationKey: 'GitlabDiscoveryEntityProvider:test-id',
};
});

// includes every GitLab project that has a default branch and the fallback declared in the config
export const expected_location_entities_fallback_branch: MockObject[] =
all_projects_response.map(project => {
const targetUrl = `https://example.com/${project.path_with_namespace}/-/blob/${project.default_branch}/catalog-info.yaml`;
const branch = project.default_branch || 'main';
const targetUrl = `https://example.com/${project.path_with_namespace}/-/blob/${branch}/catalog-info.yaml`;

return {
entity: {
Expand All @@ -1312,7 +1383,40 @@ export const expected_location_entities: MockObject[] =
'backstage.io/managed-by-location': `url:${targetUrl}`,
'backstage.io/managed-by-origin-location': `url:${targetUrl}`,
},
name: locationSpecToMetadataName({ target: targetUrl, type: 'url' }),
name: locationSpecToMetadataName({
target: targetUrl,
type: 'url',
}),
},
spec: {
presence: 'optional',
target: targetUrl,
type: 'url',
},
},
locationKey: 'GitlabDiscoveryEntityProvider:test-id',
};
});

// includes ONLY the projects with the branch declared in the config
export const expected_location_entities_specific_branch: MockObject[] =
all_projects_response.map(project => {
const branch = 'develop';
const targetUrl = `https://example.com/${project.path_with_namespace}/-/blob/${branch}/catalog-info.yaml`;

return {
entity: {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Location',
metadata: {
annotations: {
'backstage.io/managed-by-location': `url:${targetUrl}`,
'backstage.io/managed-by-origin-location': `url:${targetUrl}`,
},
name: locationSpecToMetadataName({
target: targetUrl,
type: 'url',
}),
},
spec: {
presence: 'optional',
Expand Down
Loading

0 comments on commit 013a080

Please sign in to comment.