Skip to content

Commit

Permalink
Merge branch 'main' into remember-last-conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikjeeyar authored Jan 7, 2025
2 parents a2d5aa9 + 1b4c664 commit b1f10b1
Show file tree
Hide file tree
Showing 773 changed files with 80,691 additions and 5,433 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,7 @@ module.exports = {
'notice/notice': [
'error',
{
mustMatch: /Copyright (The Backstage Authors|Red Hat, Inc.)/,
templateFile: path.resolve(
// eslint-disable-next-line no-restricted-syntax
__dirname,
Expand Down
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
/workspaces/openshift-image-registry @christoph-jerolimov @debsmita1 @divyanshiGupta
/workspaces/theme @christoph-jerolimov @ciiay @debsmita1
/workspaces/lightspeed @karthikjeeyar @yangcao77 @rohitkrai03
/workspaces/orchestrator @batzionb @mareklibra @gciavarrini
/workspaces/orchestrator @batzionb @mareklibra @gciavarrini
/workspaces/global-header @christoph-jerolimov @ciiay
/workspaces/global-floating-action-button @christoph-jerolimov @debsmita1
48 changes: 48 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,50 @@
"npm": {
"minimumReleaseAge": "3 days"
},
"major": {
"dependencyDashboardApproval": true
},
"packageRules": [
{
"groupName": "DevDependencies (minor)",
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["minor"]
},
{
"groupName": "DevDependencies (patch)",
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["patch"]
},
{
"groupName": "Test packages (minor)",
"matchDepNames": ["@playwright/{/,}**", "msw", "@testing-library/{/,}**"],
"matchUpdateTypes": ["minor"]
},
{
"groupName": "Test packages (patch)",
"matchDepNames": ["@playwright/{/,}**", "msw", "@testing-library/{/,}**"],
"matchUpdateTypes": ["patch"]
},
{
"groupName": "Kie Tools (minor)",
"matchDepNames": ["@kie-tools-core/{/,}**", "@kie-tools/{/,}**"],
"matchUpdateTypes": ["minor"]
},
{
"groupName": "Kie Tools (patch)",
"matchDepNames": ["@kie-tools-core/{/,}**", "@kie-tools/{/,}**"],
"matchUpdateTypes": ["patch"]
},
{
"groupName": "types (minor)",
"matchPackageNames": ["@types/{/,}**"],
"matchUpdateTypes": ["minor"]
},
{
"matchUpdateTypes": ["patch"],
"groupName": "types (patch)",
"matchPackageNames": ["@types/{/,}**"]
},
{
"matchManagers": ["github-actions"],
"groupName": "GitHub Actions"
Expand All @@ -34,6 +77,11 @@
{
"matchPackageNames": ["yn"],
"allowedVersions": "<5.0.0"
},
{
"groupName": "Core Backstage packages",
"dependencyDashboardApproval": true,
"matchDepNames": ["/^@backstage//"]
}
],
"ignorePaths": ["**/dist-dynamic/**"]
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/automate_renovate_changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Automate Renovate changeset
on:
pull_request_target:
paths:
- '.github/workflows/automate_renovate_changesets.yml'
- '**/yarn.lock'

jobs:
generate-changeset:
runs-on: ubuntu-latest
if: github.actor == 'renovate[bot]' && github.repository == 'redhat-developer/rhdh-plugins'
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
token: ${{ secrets.RHDH_BOT_TOKEN }}

- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/ # Needed for auth

- name: Configure Git
run: |
git config --global user.email [email protected]
git config --global user.name 'Github changeset workflow'
- name: Generate changesets
run: node ./scripts/ci/generate-bump-changesets.js
783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

875 changes: 875 additions & 0 deletions .yarn/releases/yarn-3.8.7.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarnPath: .yarn/releases/yarn-3.8.7.cjs
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ The `redhat-developer/rhdh-plugins` repository is designed as a collaborative sp
- [Migrating a plugin](#migrating-a-plugin)
- [Manual migration steps](#manual-migration-steps)
- [Using the cli to migrate plugins from janus-idp/backstage-plugins](#using-the-cli-to-migrate-plugins-from-janus-idpbackstage-plugins)
- [Next steps](#next-steps)
- [Maintenance of older versions](#maintenance-of-older-versions)
- [API Reports](#api-reports)
- [Keeping Workspaces Upto Date with Backstage](#keeping-workspaces-upto-date-with-backstage)
- [Submitting a Pull Request](#submitting-a-pull-request)

## License
Expand Down Expand Up @@ -251,6 +254,28 @@ There are two ways you can do this:

Each plugin/package has its own API Report which means you might see more than one file updated or created depending on your changes. These changes will then need to be committed as well.

## Keeping Workspaces Upto Date with Backstage

To keep plugins in the various workspaces up to date with Backstage we have a [Version Bump Workflow](https://github.com/redhat-developer/rhdh-plugins/actions/workflows/version-bump.yml) in place, similar to the one that is used in the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository.

> [!NOTE]
> To run this workflow, you will need write access to the repository. If you are a plugin owner and do not have write access, please reach out to one of the repository admins (@bethgriggs, @nickboldt, @04kash).

### Process

When a Plugin Owner wants to upgrade their workspace(s) to the latest version of Backstage they will simply need to do the following:

1. Navigate to the [Version Bump](https://github.com/redhat-developer/rhdh-plugins/actions/workflows/version-bump.yml) workflow
2. On the right hand side click on the "Run workflow" button
3. In the menu that appears use the following:
1. For "Use workflow from" use the default "Branch: main"
2. For "Release Line" use the default "main"
3. For "Workspace (this much be a JSON array)" you will enter the name(s) of the workspace(s). For example for a single workspace it would look like this: `["bulk-import"]` and for multiple workspaces it would look like this: `["lightspeed", "homepage", "marketplace"]`
4. For "Specifies the type of version update to apply" use the default "minor"
4. Now click the "Run workflow" button
5. The workflow will then run and create a PR to upgrade each of the specified workspaces to the latest `main` release of Backstage
6. Review and merge the generated PR(s)

## Submitting a Pull Request

When you've got your contribution working, tested, and committed to your branch it's time to create a Pull Request (PR). If you are unsure how to do this GitHub's [Creating a pull request from a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) documentation will help you with that.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prettier:fix": "prettier --write ."
},
"type": "module",
"packageManager": "yarn@3.2.3",
"packageManager": "yarn@3.8.7",
"devDependencies": {
"@backstage/cli": "^0.27.0",
"@backstage/cli-node": "^0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/check-if-release.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable @backstage/no-undeclared-imports */
/*
* Copyright 2020 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/create-tag.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
128 changes: 128 additions & 0 deletions scripts/ci/generate-bump-changesets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { promisify } from 'util';
import { exec as execOriginal } from 'child_process';
import fs from 'fs/promises';
import path from 'path';

const exec = promisify(execOriginal);

async function main() {
console.log('Generating changesets for package.json dependency bumps...');
const { stdout: diffOutput } = await exec('git diff --name-only HEAD~1');

const diffFiles = diffOutput.split('\n');
if (diffFiles.find(f => path.matchesGlob(f, 'workspaces/*/.changeset/*'))) {
console.log('Changeset already exists, skipping');
return;
}
const files = diffFiles
.filter(file => file !== 'package.json') // skip root package.json
.filter(file =>
path.matchesGlob(file, 'workspaces/*/plugins/*/package.json'),
);

const workspaces = await getPackagesNamesByWorkspace(files);
if (!Object.keys(workspaces).length) {
console.log('No package.json changes found, skipping');
return;
}

const packageBumps = await getBumps(files);
if (packageBumps.size === 0) {
console.log('No bumps in published packages, skipping');
return;
}

const { stdout: shortHash } = await exec('git rev-parse --short HEAD');

for (const workspace of Object.keys(workspaces)) {
const fileName = `workspaces/${workspace}/.changeset/renovate-${shortHash.trim()}.md`;
console.log(`Creating changeset ${fileName}`);
await createChangeset(fileName, packageBumps, workspaces[workspace]);
await exec(`git add ${fileName}`);
}
await exec('git commit --amend --no-edit');
await exec('git push -f');
console.log(`Added changeset for commit ${shortHash.trim()}`);
}

// Parses package.json files and returns the package names
async function getPackagesNamesByWorkspace(files) {
const workspaces = {};
for (const file of files) {
const data = JSON.parse(await fs.readFile(file, 'utf8'));
const workspace = path
.dirname(path.resolve(file, '../..'))
.split(path.sep)
.pop();

if (!data.private) {
const names = workspaces[workspace] || [];
if (!workspaces[workspace]) {
workspaces[workspace] = names;
}
names.push(data.name);
}
}
return workspaces;
}

async function getBumps(files) {
const bumps = new Map();
for (const file of files) {
const { stdout: changes } = await exec(`git show ${file}`);
const packageDef = JSON.parse(
await fs.readFile(path.join(process.cwd(), file), 'utf8'),
);
for (const change of changes.split('\n')) {
if (!change.startsWith('+ ')) {
continue;
}

const match = change.match(/"(.*?)"/g);
const pkg = match[0].replace(/"/g, '');
const version = match[1].replace(/"/g, '');

// Only generate changesets for published packages
if (packageDef.private) {
console.log(`Ignoring bump in private package ${packageDef.name}`);
continue;
}

bumps.set(pkg, version);
}
}

return bumps;
}

async function createChangeset(fileName, packageBumps, packages) {
let message = '';
for (const [pkg, bump] of packageBumps) {
message = `${message}Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
}

const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n');
const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
await fs.writeFile(fileName, body);
}

main().catch(error => {
console.error(error.stack || error);
process.exit(1);
});
2 changes: 1 addition & 1 deletion scripts/ci/generate-knip-report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/generate-version-bump-changeset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable @backstage/no-undeclared-imports */
/*
* Copyright 2025 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/list-workspaces-with-changes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/set-release-name.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable @backstage/no-undeclared-imports */
/*
* Copyright 2020 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/verify-changesets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright 2020 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/verify-lockfile-duplicates.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright 2020 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/list-backend-feature.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/list-compatibility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion scripts/list-frontend-feature.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright 2024 The Backstage Authors
* Copyright The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit b1f10b1

Please sign in to comment.