Skip to content

Commit

Permalink
chore(acr): add backstage app to workspace
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
  • Loading branch information
christoph-jerolimov committed Nov 19, 2024
1 parent 8ae6a71 commit 373db9c
Show file tree
Hide file tree
Showing 68 changed files with 12,526 additions and 2,518 deletions.
5 changes: 5 additions & 0 deletions workspaces/acr/.changeset/gorgeous-moons-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-acr': patch
---

fix `react-use` compile issue and update plugin description
2 changes: 1 addition & 1 deletion workspaces/acr/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { root: true, };
module.exports = require('../../.eslintrc.cjs');
2 changes: 1 addition & 1 deletion workspaces/acr/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ coverage
# Dependencies
node_modules/

# Yarn 3 files
# Yarn files
.pnp.*
.yarn/*
!.yarn/patches
Expand Down
20 changes: 12 additions & 8 deletions workspaces/acr/app-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
app:
title: Scaffolded Backstage App
title: Azure Container Registry Plugin Example App
baseUrl: http://localhost:3000

organization:
name: My Company
name: Azure Container Registry Plugin Example

backend:
# Used for enabling authentication, secret is shared by all backend plugins
Expand Down Expand Up @@ -44,12 +44,16 @@ integrations:
# token: ${GHE_TOKEN}

proxy:
### Example for how to add a proxy endpoint for the frontend.
### A typical reason to do this is to handle HTTPS and CORS for internal services.
# endpoints:
# '/test':
# target: 'https://example.com'
# changeOrigin: true
endpoints:
'/acr/api':
target: 'https://${ACR_HOST}/acr/v1/'
credentials: require
changeOrigin: true
headers:
# If you use Bearer Token for authorization, please replace the 'Basic' with 'Bearer' in the following line.
Authorization: 'Basic ${ACR_AUTH_TOKEN}'
# Change to "false" in case of using self hosted artifactory instance with a self-signed certificate
secure: true

# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
Expand Down
13 changes: 5 additions & 8 deletions workspaces/acr/catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: acr
description: An example of a Backstage application.
# Example for optional annotations
# annotations:
# github.com/project-slug: backstage/backstage
# backstage.io/techdocs-ref: dir:.
name: backstage-plugin-acr-workspace
title: 'Azure Container Registry plugin for Backstage'
description: A Backstage plugin that displays information about your container images available in the Azure Container Registry
spec:
type: website
owner: john@example.com
lifecycle: experimental
type: backstage-plugin
owner: maintainers
45 changes: 45 additions & 0 deletions workspaces/acr/examples/entities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
name: backstage
spec:
owner: guests
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: acr-example
annotations:
azure-container-registry/repository-name: samples/hello-world
spec:
type: service
lifecycle: testing
owner: guests
system: backstage
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: acr-not-found-example
annotations:
azure-container-registry/repository-name: samples/container-not-found
spec:
type: service
lifecycle: testing
owner: guests
system: backstage
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: no-acr-annotation
spec:
type: service
lifecycle: testing
owner: guests
system: backstage
17 changes: 17 additions & 0 deletions workspaces/acr/examples/org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-user
apiVersion: backstage.io/v1alpha1
kind: User
metadata:
name: guest
spec:
memberOf: [guests]
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-group
apiVersion: backstage.io/v1alpha1
kind: Group
metadata:
name: guests
spec:
type: team
children: []
15 changes: 12 additions & 3 deletions workspaces/acr/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
{
"name": "@internal/acr",
"description": "A Backstage plugin that displays information about your container images available in the Azure Container Registry",
"version": "1.0.0",
"private": true,
"engines": {
"node": "18 || 20"
},
"scripts": {
"dev": "yarn workspaces foreach -A --include backend --include app --parallel -v -i run start",
"start": "yarn workspace app start",
"start-backend": "yarn workspace backend start",
"build:backend": "yarn workspace backend build",
"build-image": "yarn workspace backend build-image",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck true --incremental false",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"build:all": "backstage-cli repo build --all",
"build:api-reports": "yarn build:api-reports:only",
"build:api-reports:only": "backstage-repo-tools api-reports --allow-all-warnings -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
"build:api-reports": "yarn build:api-reports:only --tsc",
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test:all": "backstage-cli repo test --coverage",
"test:e2e": "playwright test",
"fix": "backstage-cli repo fix",
"lint": "backstage-cli repo lint --since origin/main",
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"new": "backstage-cli new --scope @backstage-community",
"postinstall": "cd ../../ && yarn install"
},
Expand All @@ -37,6 +45,7 @@
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.10.0",
"@changesets/cli": "^2.27.1",
"@playwright/test": "^1.32.3",
"@spotify/prettier-config": "^12.0.0",
"node-gyp": "^9.0.0",
"prettier": "^2.3.2",
Expand Down
9 changes: 9 additions & 0 deletions workspaces/acr/packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The Packages Folder

This is where your own applications and centrally managed libraries live, each
in a separate folder of its own.

From the start there's an `app` folder (for the frontend) and a `backend` folder
(for the Node backend), but you can also add more modules in here that house
your core additions and adaptations, such as themes, common React component
libraries, utilities, and similar.
1 change: 1 addition & 0 deletions workspaces/acr/packages/app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
1 change: 1 addition & 0 deletions workspaces/acr/packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
27 changes: 27 additions & 0 deletions workspaces/acr/packages/app/e2e-tests/app.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2020 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 { test, expect } from '@playwright/test';

test('App should render the welcome page', async ({ page }) => {
await page.goto('/');

const enterButton = page.getByRole('button', { name: 'Enter' });
await expect(enterButton).toBeVisible();
await enterButton.click();

await expect(page.getByText('My Company Catalog')).toBeVisible();
});
19 changes: 19 additions & 0 deletions workspaces/acr/packages/app/knip-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Knip report

## Unused dependencies (4)

| Name | Location | Severity |
| :------------------------------ | :----------- | :------- |
| @backstage-community/plugin-npm | package.json | error |
| react-router | package.json | error |
| react-use | package.json | error |
| history | package.json | error |

## Unused devDependencies (4)

| Name | Location | Severity |
| :-------------------------- | :----------- | :------- |
| @testing-library/user-event | package.json | error |
| @backstage/test-utils | package.json | error |
| @testing-library/dom | package.json | error |
| cross-env | package.json | error |
79 changes: 79 additions & 0 deletions workspaces/acr/packages/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "app",
"version": "0.0.3",
"private": true,
"bundled": true,
"repository": {
"type": "git",
"url": "https://github.com/backstage/community-plugins",
"directory": "workspaces/acr/packages/app"
},
"backstage": {
"role": "frontend"
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"clean": "backstage-cli package clean",
"test": "backstage-cli package test",
"lint": "backstage-cli package lint"
},
"dependencies": {
"@backstage-community/plugin-acr": "workspace:^",
"@backstage/app-defaults": "^1.5.12",
"@backstage/catalog-model": "^1.7.0",
"@backstage/cli": "^0.28.0",
"@backstage/core-app-api": "^1.15.1",
"@backstage/core-components": "^0.15.1",
"@backstage/core-plugin-api": "^1.10.0",
"@backstage/integration-react": "^1.2.0",
"@backstage/plugin-api-docs": "^0.11.11",
"@backstage/plugin-catalog": "^1.24.0",
"@backstage/plugin-catalog-common": "^1.1.0",
"@backstage/plugin-catalog-graph": "^0.4.11",
"@backstage/plugin-catalog-import": "^0.12.5",
"@backstage/plugin-catalog-react": "^1.14.0",
"@backstage/plugin-org": "^0.6.31",
"@backstage/plugin-permission-react": "^0.4.27",
"@backstage/plugin-scaffolder": "^1.26.1",
"@backstage/plugin-search": "^1.4.18",
"@backstage/plugin-search-react": "^1.8.1",
"@backstage/plugin-techdocs": "^1.11.0",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.16",
"@backstage/plugin-techdocs-react": "^1.2.9",
"@backstage/plugin-user-settings": "^0.8.14",
"@backstage/theme": "^0.6.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"history": "^5.0.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0"
},
"devDependencies": {
"@backstage/test-utils": "^1.7.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/react-dom": "*",
"cross-env": "^7.0.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"files": [
"dist"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workspaces/acr/packages/app/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workspaces/acr/packages/app/public/favicon.ico
Binary file not shown.
60 changes: 60 additions & 0 deletions workspaces/acr/packages/app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Backstage is an open source framework for building developer portals"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link
rel="manifest"
href="<%= publicPath %>/manifest.json"
crossorigin="use-credentials"
/>
<link rel="icon" href="<%= publicPath %>/favicon.ico" />
<link rel="shortcut icon" href="<%= publicPath %>/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="<%= publicPath %>/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="<%= publicPath %>/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="<%= publicPath %>/favicon-16x16.png"
/>
<link
rel="mask-icon"
href="<%= publicPath %>/safari-pinned-tab.svg"
color="#5bbad5"
/>
<title><%= config.getOptionalString('app.title') ?? 'Backstage' %></title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `yarn start`.
To create a production bundle, use `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions workspaces/acr/packages/app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Backstage",
"name": "Backstage",
"icons": [
{
"src": "favicon.ico",
"sizes": "48x48",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Loading

0 comments on commit 373db9c

Please sign in to comment.