Skip to content

Commit

Permalink
feat(core): upgrade backstage (#199)
Browse files Browse the repository at this point in the history
upgrade backstage

ARC-157

## Description

SF backstage was using outdated backstage packages. So this is the step
to upgrade backstage accordingly using version bump

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Intermediate change (work in progress)

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Test A
- [ ] Test B

## Checklist:

- [ ] Performed a self-review of my own code
- [ ] npm test passes on your machine
- [ ] New tests added or existing tests modified to cover all changes
- [ ] Code conforms with the style guide
- [ ] API Documentation in code was updated
- [ ] Any dependent changes have been merged and published in downstream
modules
  • Loading branch information
sadarunnisa-sf authored Sep 30, 2024
1 parent 19fb512 commit 83e9508
Show file tree
Hide file tree
Showing 48 changed files with 10,204 additions and 7,125 deletions.
80 changes: 61 additions & 19 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@ backend:
integrations:
github:
- host: github.com
# token: ${GITHUB_TOKEN}
# orgs: [ sourcefuse ]
token: ${GITHUB_TOKEN}
orgs: [ sourcefuse ]
apps:
- appId: ${INTEGRATION_GITHUB_APP_ID}
webhookUrl: ${INTEGRATION_GITHUB_WEBHOOK_URL}
clientId: ${INTEGRATION_GITHUB_CLIENT_ID}
clientSecret: ${INTEGRATION_GITHUB_CLIENT_SECRET}
webhookSecret: ${INTEGRATION_GITHUB_WEBHOOK_SECRET}
privateKey: ${INTEGRATION_GITHUB_PRIVATE_KEY}
# signIn:
# resolvers:
# - resolver: usernameMatchingUserEntityName

# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
Expand All @@ -64,35 +67,66 @@ techdocs:
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.

# auth:
# # see https://backstage.io/docs/auth/ to learn about auth providers
# environment: production
# providers:
# github:
# production:
# clientId: ${AUTH_GITHUB_CLIENT_ID}
# clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
# #below lines are extra in new backend system
# # signIn:
# # resolvers:
# # - resolver: usernameMatchingUserEntityName
# # See https://backstage.io/docs/auth/guest/provider
# guest: {}
auth:
# see https://backstage.io/docs/auth/ to learn about auth providers
environment: production
environment: development
providers:
github:
production:
development:
clientId: ${AUTH_GITHUB_CLIENT_ID}
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
organization: 'sourcefuse'
## uncomment if using GitHub Enterprise
# enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL}
signIn:
resolvers:
# Matches the GitHub username with the Backstage user entity name.
# See https://backstage.io/docs/auth/github/provider#resolvers for more resolvers.
- resolver: usernameMatchingUserEntityName
# - resolver: emailMatchingUserEntityProfileEmail
# - resolver: emailLocalPartMatchingUserEntityName

scaffolder:
# see https://backstage.io/docs/features/software-templates/configuration for software template options

proxy:
'/snyk':
target: https://api.snyk.io/
headers:
User-Agent: tech-services/backstage-plugin/1.0
Authorization: token ${SNYK_TOKEN}
'/sonarqube':
target: https://sonarcloud.io/api
allowedMethods: ['GET']
auth: "${SONARCLOUD_TOKEN}:"
endpoints:
'/snyk':
target: https://api.snyk.io
headers:
User-Agent: tech-services/backstage-plugin/1.0
Authorization: token ${SNYK_TOKEN}
credentials: require

'/sonarqube':
target: https://sonarcloud.io/api
allowedMethods: ['GET']
auth: "${SONARCLOUD_TOKEN}:"
credentials: require

catalog:
# providers:
# github:
# # the provider ID can be any camelCase string
# providerId:
# organization: 'sourcefuse' # string
providers:
githubOrg:
- id: production
githubUrl: 'https://github.com'
orgs: ['sourcefuse']
github:
# the provider ID can be any camelCase string
providerId:
organization: 'sourcefuse' # string
# catalogPath: '/catalog-info.yaml' # string
# filters:
# branch: 'main' # string
Expand All @@ -109,6 +143,7 @@ catalog:
# # branch: 'main' # string
# # repository: '.*' # Regex
# validateLocationsExist: true # optional boolean

rules:
- allow: [ Component, System, API, Group, User, Resource, Location ]
locations:
Expand Down Expand Up @@ -263,3 +298,10 @@ catalog:
target: https://github.com/sourcefuse/telemed-app-api/blob/main/template.yaml
rules:
- allow: [ Template ]

# kubernetes:
# see https://backstage.io/docs/features/kubernetes/configuration for kubernetes configuration options
# see https://backstage.io/docs/permissions/getting-started for more on the permission framework
# permission:
# # setting this to `false` will disable permissions
# enabled: true
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.14.0"
"version": "1.31.1"
}
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"packages": ["packages/*", "plugins/*"],
"npmClient": "yarn",
"version": "0.1.0"
"version": "0.1.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
28 changes: 16 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"engines": {
"node": "16 || 18"
"node": "18 || 20"
},
"scripts": {
"dev": "concurrently \"yarn start\" \"yarn start-backend\"",
Expand All @@ -29,7 +29,9 @@
"infra:apply": "cd terraform && terraform apply",
"infra:destroy": "cd terraform && terraform destroy",
"prepare": "husky install",
"postinstall": "patch-package"
"postinstall": "patch-package",
"test:e2e": "playwright test",
"fix": "backstage-cli repo fix"
},
"workspaces": {
"packages": [
Expand All @@ -38,21 +40,23 @@
]
},
"devDependencies": {
"@backstage/cli": "^0.22.7",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@commitlint/config-lerna-scopes": "^17.0.0",
"@spotify/prettier-config": "^12.0.0",
"concurrently": "^6.0.0",
"cz-conventional-changelog": "^3.3.0",
"cz-format-extension": "^1.5.0",
"husky": "^8.0.1",
"lerna": "^4.0.0",
"node-gyp": "^9.0.0",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"@backstage/cli": "^0.27.1",
"@backstage/e2e-test-utils": "^0.1.1",
"@playwright/test": "^1.32.3",
"@spotify/prettier-config": "^12.0.0",
"concurrently": "^8.0.0",
"lerna": "^7.3.0",
"node-gyp": "^10.0.0",
"prettier": "^2.3.2",
"typescript": "~5.0.0"
"typescript": "~5.4.0"
},
"prettier": "@spotify/prettier-config",
"lint-staged": {
Expand All @@ -78,9 +82,9 @@
},
"dependencies": {},
"resolutions": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"@types/react": "17.0.2",
"@types/react-dom": "^17.0.2"
"react": "^18",
"react-dom": "^18",
"@types/react": "^18",
"@types/react-dom": "^18"
}
}
23 changes: 23 additions & 0 deletions packages/app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// module.exports = {

// presets: [

// [

// '@babel/preset-env',

// {

// targets: {

// node: 'current',

// },

// },

// ],

// ],

// };
10 changes: 0 additions & 10 deletions packages/app/cypress.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/app/cypress/.eslintrc.json

This file was deleted.

6 changes: 0 additions & 6 deletions packages/app/cypress/integration/app.js

This file was deleted.

Empty file added packages/app/jest
Empty file.
72 changes: 37 additions & 35 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,52 @@
"cy:run": "cypress run --browser chrome"
},
"dependencies": {
"@backstage-community/plugin-github-actions": "^0.6.16",
"@backstage-community/plugin-github-pull-requests-board": "^0.2.1",
"@backstage-community/plugin-sonarqube": "^0.8.0",
"@backstage/app-defaults": "^1.3.1",
"@backstage/catalog-model": "^1.3.0",
"@backstage/cli": "^0.22.7",
"@backstage/core-app-api": "^1.8.0",
"@backstage/core-components": "^0.13.1",
"@backstage/core-plugin-api": "^1.5.1",
"@backstage/integration-react": "^1.1.13",
"@backstage/plugin-api-docs": "^0.9.3",
"@backstage/plugin-catalog": "^1.11.0",
"@backstage/plugin-catalog-common": "^1.0.13",
"@backstage/plugin-catalog-graph": "^0.2.30",
"@backstage/plugin-catalog-import": "^0.9.8",
"@backstage/plugin-catalog-react": "^1.6.0",
"@backstage/plugin-github-actions": "^0.5.18",
"@backstage/plugin-github-pull-requests-board": "^0.1.14",
"@backstage/plugin-org": "^0.6.8",
"@backstage/plugin-permission-react": "^0.4.12",
"@backstage/plugin-scaffolder": "^1.13.1",
"@backstage/plugin-search": "^1.3.0",
"@backstage/plugin-search-react": "^1.6.0",
"@backstage/plugin-tech-radar": "^0.6.4",
"@backstage/plugin-techdocs": "^1.6.2",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.0.13",
"@backstage/plugin-techdocs-react": "^1.1.6",
"@backstage/plugin-user-settings": "^0.7.3",
"@backstage/theme": "^0.3.0",
"@backstage-community/plugin-tech-radar": "^0.7.4",
"@backstage/app-defaults": "^1.5.11",
"@backstage/catalog-model": "^1.7.0",
"@backstage/cli": "^0.27.1",
"@backstage/core-app-api": "^1.15.0",
"@backstage/core-components": "^0.15.0",
"@backstage/core-plugin-api": "^1.9.4",
"@backstage/integration-react": "^1.1.31",
"@backstage/plugin-api-docs": "^0.11.9",
"@backstage/plugin-catalog": "^1.23.0",
"@backstage/plugin-catalog-common": "^1.1.0",
"@backstage/plugin-catalog-graph": "^0.4.9",
"@backstage/plugin-catalog-import": "^0.12.3",
"@backstage/plugin-catalog-react": "^1.13.0",
"@backstage/plugin-kubernetes": "^0.11.14",
"@backstage/plugin-org": "^0.6.29",
"@backstage/plugin-permission-react": "^0.4.26",
"@backstage/plugin-scaffolder": "^1.25.0",
"@backstage/plugin-search": "^1.4.16",
"@backstage/plugin-search-react": "^1.8.0",
"@backstage/plugin-techdocs": "^1.10.9",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.14",
"@backstage/plugin-techdocs-react": "^1.2.8",
"@backstage/plugin-user-settings": "^0.8.12",
"@backstage/theme": "^0.5.7",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@roadiehq/backstage-plugin-github-pull-requests": "^2.5.14",
"backstage-plugin-snyk": "^2.0.1",
"backstage-plugin-snyk": "^2.5.0",
"history": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-idle-timer": "^5.7.2",
"react-router": "6.11.2",
"react-router-dom": "6.11.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/test-utils": "^1.3.1",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@backstage/test-utils": "^1.6.0",
"@playwright/test": "^1.32.3",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.0.0",
"@types/jest": "^26.0.7",
"@types/node": "^16.11.26",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
href="<%= publicPath %>/safari-pinned-tab.svg"
color="#5bbad5"
/>
<title><%= config.getString('app.title') %></title>
<title><%= config.getOptionalString('app.title') ?? 'Backstage' %></title>
<% if (config.has('app.googleAnalyticsTrackingId')) { %>
<script
async
Expand Down
11 changes: 8 additions & 3 deletions packages/app/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { renderWithEffects } from '@backstage/test-utils';
// import { renderWithEffects } from '@backstage/test-utils';
import { render, waitFor } from '@testing-library/react';
import App from './App';

describe('App', () => {
Expand All @@ -20,7 +21,11 @@ describe('App', () => {
] as any,
};

const rendered = await renderWithEffects(<App />);
expect(rendered.baseElement).toBeInTheDocument();

const rendered = render(<App />);
await waitFor(() => {
expect(rendered.baseElement).toBeInTheDocument();
});

});
});
Loading

0 comments on commit 83e9508

Please sign in to comment.