Merge branch 'backstage:master' into removetrunc
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-notifications-backend-module-email': patch
|
||||
'@backstage/plugin-notifications-backend': patch
|
||||
---
|
||||
|
||||
Fixed email processor `esm` issue and config reading
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-common': patch
|
||||
---
|
||||
|
||||
Added `HarnessURLReader` with `readUrl` support.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/repo-tools': minor
|
||||
---
|
||||
|
||||
Adds 2 new commands `repo schema openapi diff` and `package schema openapi diff`. `repo schema openapi diff` is intended to power a new breaking changes check on pull requests and the package level command allows plugin developers to quickly see new API breaking changes. They're intended to be used in complement with the existing `repo schema openapi verify` command to validate your OpenAPI spec against a variety of things.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-notifications-backend-module-email': patch
|
||||
---
|
||||
|
||||
Support relative links in notifications sent via email
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-common': patch
|
||||
---
|
||||
|
||||
Added config prop `ensureSchemaExists` to support postgres instances where user can create schemas but not databases.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
The `versions:bump` command will no longer exit with a non-zero status if the version bump fails due to forbidden duplicate package installations. It will now also provide more information about how to troubleshoot such an error. The set of forbidden duplicates has also been expanded to include all `@backstage/*-app-api` packages.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-auth-backend-module-aws-alb-provider': patch
|
||||
'@backstage/plugin-auth-backend-module-github-provider': patch
|
||||
'@backstage/plugin-auth-backend': patch
|
||||
---
|
||||
|
||||
fix: Move config declarations to appropriate auth backend modules
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-notifications': patch
|
||||
---
|
||||
|
||||
Increase default and allow modifying notification snackbar auto hide duration
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/core-components': patch
|
||||
---
|
||||
|
||||
Add `alignGauge` prop to the `GaugeCard`, and a small size version. When `alignGauge` is `'bottom'` the gauge will vertically align the gauge in the cards, even when the card titles span across multiple lines.
|
||||
Add `alignContent` prop to the `InfoCard`, defaulting to `'normal'` with the option of `'bottom'` which vertically aligns the content to the bottom of the card.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Fixed an issue causing the `repo fix` command to set an incorrect `workspace` property using Windows
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Avoiding pre-loading display total count undefined for table counts
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-gitlab': minor
|
||||
---
|
||||
|
||||
Add examples for `gitlab:projectVariable:create` scaffolder action & improve related tests
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/integration': minor
|
||||
---
|
||||
|
||||
Added `HarnessIntegration` via the `ScmIntegrations` interface.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-search': patch
|
||||
---
|
||||
|
||||
Added `aria-label` attribute to DialogTitle element and set `aria-modal` attribute to `true` for improved accessibility in the search modal.
|
||||
@@ -62,6 +62,10 @@
|
||||
matchPackageNames: ['p-limit'],
|
||||
allowedVersions: '<4.0.0',
|
||||
},
|
||||
{
|
||||
matchPackageNames: ['p-throttle'],
|
||||
allowedVersions: '<4.0.0',
|
||||
},
|
||||
{
|
||||
matchPackageNames: ['p-queue'],
|
||||
allowedVersions: '<7.0.0',
|
||||
|
||||
@@ -152,6 +152,8 @@ graphviz
|
||||
Hackathons
|
||||
haproxy
|
||||
hardcoded
|
||||
Harness
|
||||
harness
|
||||
Helidon
|
||||
Henneke
|
||||
Heroku
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
name: API Breaking Changes (comment)
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- 'API Breaking Changes (Trigger)'
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
name: Add values from previous step
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
permissions:
|
||||
# "If you specify the access for any of these scopes, all of those that are not specified are set to none."
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
||||
actions: read # Access cache
|
||||
outputs:
|
||||
git-ref: ${{ steps.event.outputs.GIT_REF }}
|
||||
pr-number: ${{ steps.event.outputs.PR_NUMBER }}
|
||||
action: ${{ steps.event.outputs.ACTION }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
allowed-endpoints: >
|
||||
api.github.com:443
|
||||
|
||||
- name: 'Download artifacts'
|
||||
# Fetch output (zip archive) from the workflow run that triggered this workflow.
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "preview-spec"
|
||||
})[0];
|
||||
if (matchArtifact === undefined) {
|
||||
throw TypeError('Build Artifact not found!');
|
||||
}
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/preview-spec.zip`, Buffer.from(download.data));
|
||||
|
||||
- name: 'Accept event from first stage'
|
||||
run: unzip preview-spec.zip event.json
|
||||
|
||||
- name: Read Event into ENV
|
||||
id: event
|
||||
run: |
|
||||
echo PR_NUMBER=$(jq '.number | tonumber' < event.json) >> $GITHUB_OUTPUT
|
||||
echo ACTION=$(jq --raw-output '.action | tostring | [scan("\\w+")][0]' < event.json) >> $GITHUB_OUTPUT
|
||||
echo GIT_REF=$(jq --raw-output '.pull_request.head.sha | tostring | [scan("\\w+")][0]' < event.json) >> $GITHUB_OUTPUT
|
||||
|
||||
- name: DEBUG - Print Job Outputs
|
||||
if: ${{ runner.debug }}
|
||||
run: |
|
||||
echo "PR number: ${{ steps.event.outputs.PR_NUMBER }}"
|
||||
echo "Git Ref: ${{ steps.event.outputs.GIT_REF }}"
|
||||
echo "Action: ${{ steps.event.outputs.ACTION }}"
|
||||
cat event.json
|
||||
|
||||
- name: Get Comment
|
||||
id: get-comment
|
||||
run: |
|
||||
unzip preview-spec.zip comment.md
|
||||
ls
|
||||
grep
|
||||
|
||||
add-comment:
|
||||
name: Write comment about issues
|
||||
needs:
|
||||
- setup
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
|
||||
# Identify comment to be updated
|
||||
- name: Find comment for API Changes
|
||||
uses: peter-evans/find-comment@d5fe37641ad8451bdd80312415672ba26c86575e # v3
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ needs.setup.outputs.pr-number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: API changes
|
||||
direction: last
|
||||
|
||||
- name: Create or Update Comment with API Changes
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-path: comment.md
|
||||
edit-mode: replace
|
||||
@@ -0,0 +1,56 @@
|
||||
name: API Breaking Changes (Trigger)
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
paths:
|
||||
- '**/openapi.yaml'
|
||||
|
||||
jobs:
|
||||
get-backstage-changes:
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
name: Build PR image
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
# Fetch the commit that's merged into the base rather than the target ref
|
||||
# This will let us diff only the contents of the PR, without fetching more history
|
||||
ref: 'refs/pull/${{ github.event.pull_request.number }}/merge'
|
||||
- name: fetch base
|
||||
run: git fetch --depth 1 origin ${{ github.base_ref }}
|
||||
|
||||
- name: setup-node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
with:
|
||||
node-version: 18.x
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: yarn install
|
||||
uses: backstage/actions/yarn-install@a674369920067381b450d398b27df7039b7ef635 # v0.6.5
|
||||
with:
|
||||
cache-prefix: linux-v18
|
||||
|
||||
- name: breaking changes check
|
||||
run: |
|
||||
yarn backstage-repo-tools repo schema openapi check --since origin/${{ github.base_ref }} > comment.md
|
||||
|
||||
- name: Upload Rendered Comment as Artifact
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
|
||||
with:
|
||||
name: preview-spec
|
||||
path: comment.md
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload PR Event as Artifact
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: preview-spec
|
||||
path: ${{ github.event_path }}
|
||||
retention-days: 2
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
# Fetch the commit that's merged into the base rather than the target ref
|
||||
# This will let us diff only the contents of the PR, without fetching more history
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
ref: '${{ github.event.pull_request.merge_commit_sha }}'
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
@@ -197,7 +197,7 @@ jobs:
|
||||
INTEGRATION_TEST_AZURE_TOKEN: ${{ secrets.INTEGRATION_TEST_AZURE_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- name: fetch master branch
|
||||
run: git fetch origin master
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
path: backstage
|
||||
ref: ${{ github.event.client_payload.version && env.RELEASE_VERSION || github.ref }}
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
INTEGRATION_TEST_AZURE_TOKEN: ${{ secrets.INTEGRATION_TEST_AZURE_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
@@ -148,7 +148,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -66,6 +66,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: 'Upload to code-scanning'
|
||||
uses: github/codeql-action/upload-sarif@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
# Fetch changes to previous commit - required for 'only_changed' in Prettier action
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
run: npm install semver@7.3.5 fs-extra@10.0.0 @manypkg/get-packages@1.1.1
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
path: backstage
|
||||
# 'v' prefix is added here for the tag, we keep it out of the manifest logic
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
# Checkout backstage/versions into /backstage/versions, which is where store the output
|
||||
- name: Checkout versions
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
repository: backstage/versions
|
||||
path: backstage/versions
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- name: Monitor and Synchronize Snyk Policies
|
||||
uses: snyk/actions/node@8349f9043a8b7f0f3ee8885bf28f0b388d2446e8 # master
|
||||
with:
|
||||
@@ -58,6 +58,6 @@ jobs:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
NODE_OPTIONS: --max-old-space-size=7168
|
||||
- name: Upload Snyk report
|
||||
uses: github/codeql-action/upload-sarif@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
|
||||
with:
|
||||
sarif_file: snyk.sarif
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
fetch-depth: 20000
|
||||
fetch-tags: true
|
||||
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: setup-node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout git repo
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- name: Render Compose File
|
||||
run: |
|
||||
# update image after the build above
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
with:
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
uses: github/codeql-action/autobuild@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -80,4 +80,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
uses: github/codeql-action/analyze@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
# Vale does not support file excludes, so we use the script to generate a list of files instead
|
||||
# The action also does not allow args or a local config file to be passed in, so the files array
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: Install Fossa
|
||||
run: "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash"
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
with:
|
||||
fetch-depth: 0 # Required to retrieve git history
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
||||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
|
||||
- name: use node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
diff --git a/dist/changesets-assemble-release-plan.cjs.js b/dist/changesets-assemble-release-plan.cjs.js
|
||||
index ee5c0f67fabadeb112e9f238d8b144a4d125830f..9b0e1a156dd88cee35f82faf718d82a8a8f80325 100644
|
||||
--- a/dist/changesets-assemble-release-plan.cjs.js
|
||||
+++ b/dist/changesets-assemble-release-plan.cjs.js
|
||||
@@ -179,12 +179,23 @@ function getDependencyVersionRanges(dependentPkgJSON, dependencyRelease) {
|
||||
if (!versionRange) continue;
|
||||
|
||||
if (versionRange.startsWith("workspace:")) {
|
||||
+ // intentionally keep other workspace ranges untouched
|
||||
+ // this has to be fixed but this should only be done when adding appropriate tests
|
||||
+ let workspaceRange = versionRange.replace(/^workspace:/, "");
|
||||
+ switch (workspaceRange) {
|
||||
+ case "*":
|
||||
+ // workspace:* actually means the current exact version, and not a wildcard similar to a reguler * range
|
||||
+ workspaceRange = dependencyRelease.oldVersion;
|
||||
+ break;
|
||||
+ case "~":
|
||||
+ case "^":
|
||||
+ // Use ^oldVersion for workspace:^ or ~oldVersion for workspace:~.
|
||||
+ // The version range might have changed in dependent package, but that should have its own changeset bumping that package.
|
||||
+ workspaceRange += dependencyRelease.oldVersion;
|
||||
+ }
|
||||
dependencyVersionRanges.push({
|
||||
depType: type,
|
||||
- versionRange: // intentionally keep other workspace ranges untouched
|
||||
- // this has to be fixed but this should only be done when adding appropriate tests
|
||||
- versionRange === "workspace:*" ? // workspace:* actually means the current exact version, and not a wildcard similar to a reguler * range
|
||||
- dependencyRelease.oldVersion : versionRange.replace(/^workspace:/, "")
|
||||
+ versionRange: workspaceRange,
|
||||
});
|
||||
} else {
|
||||
dependencyVersionRanges.push({
|
||||
-233
@@ -1,233 +0,0 @@
|
||||
# Project Areas
|
||||
|
||||
The Backstage project is divided into several project areas, each covering particular parts of the project. The main driver for each area is ownership of code in the main Backstage repository, as well as other repositories in the Backstage GitHub organization. Each area has a set of maintainers and repository content that they own. There may be no overlap in ownership between areas, which means that any given line in the GitHub code owners file should have only one owner specified. Each area is represented by a team in the Backstage GitHub organization. Apart from certain project-wide concerns, such as the release process, each area is self-governing and chooses their own ways of working. Project areas may also have special interest groups (SIGs) related to their area, but this is not required.
|
||||
|
||||
The project areas as well as their maintainers are listed in the [OWNERS.md](./OWNERS.md) file.
|
||||
|
||||
Each project area must have at least one maintainer. Project area maintainers may have shared ownership with the core maintainers, which in that case is considered an incubating area. The project area maintainers help drive work forward in the area, but they might not yet feel ready to take on ownership. The goal should generally be that these project area maintainers eventually become sole maintainers of the project area. This is to allow for a more smooth onboarding and transition of ownership, where members of the community might for example be new to open source maintainership.
|
||||
|
||||
## Adding new project areas
|
||||
|
||||
Project areas are added by nominating new maintainers for that area. See the sections for becoming a [Project Area Maintainer](#project-area-maintainer).
|
||||
|
||||
Project areas may also by added by splitting existing areas. Every area that is created through this process must have at least one maintainer.
|
||||
|
||||
## Removing project areas
|
||||
|
||||
Project areas are removed by removing all maintainers for that area and removing the corresponding team from the Backstage GitHub organization. The project area can be re-added later if there is a need for it. Reasons for removal may include lack of activity, lack of maintainers, or lack of relevance to the project.
|
||||
|
||||
# Project Roles
|
||||
|
||||
## Contributor
|
||||
|
||||
A Contributor contributes directly to the project and adds value to it. Contributions need not be code. People at the Contributor level may be new contributors, or they may only contribute occasionally.
|
||||
|
||||
### Responsibilities
|
||||
|
||||
- Follow the [CNCF CoC](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)
|
||||
- Follow the project [contributing guide](CONTRIBUTING.md)
|
||||
|
||||
### How to get involved
|
||||
|
||||
- Participate in community discussions
|
||||
- Help other users
|
||||
- Submit bug reports
|
||||
- Comment on issues
|
||||
- Try out new releases
|
||||
- Attend community events
|
||||
|
||||
### How to contribute
|
||||
|
||||
- Report and sometimes resolve issues
|
||||
- Occasionally submit PRs
|
||||
- Contribute to the documentation
|
||||
- Show up at meetings, take notes
|
||||
- Answer questions from other community members
|
||||
- Submit feedback on issues and PRs
|
||||
- Test releases and patches and submit reviews
|
||||
- Run or help run events
|
||||
- Promote the project in public
|
||||
|
||||
## Organization Member
|
||||
|
||||
An org member is a frequent contributor that has become a member of the Backstage GitHub organization. In addition to the responsibilities of contributors, an org member is also expected to be reasonably active in the community through continuous contributions of any type.
|
||||
|
||||
An Organization Member must meet the responsibilities and has the requirements of a Contributor.
|
||||
|
||||
### Responsibilities
|
||||
|
||||
- Continues to contribute regularly, as demonstrated by having at least 10 GitHub contributions per year in [Devstats](https://backstage.devstats.cncf.io/d/48/users-statistics-by-repository-group?orgId=1&var-period=y&var-metric=contributions&var-repogroup_name=All&from=now-1y&to=now&var-users=All), or contributions of a similar effort that might not be captured in Devstats.
|
||||
|
||||
### Requirements
|
||||
|
||||
- Must have at least 10 contributions to the projects in the form of:
|
||||
- Accepted PRs
|
||||
- Helpful PR reviews
|
||||
- Resolving GitHub issues
|
||||
- Or some equivalent contributions to the project
|
||||
- Must have been contributing for at least 3 months
|
||||
- Or is the member of a team that owns a project area, in which case the above requirements do not apply and the member is instead vetted by the project area maintainers
|
||||
|
||||
### Becoming an Organization Member
|
||||
|
||||
Open an issue towards [the community repository](https://github.com/backstage/community) using the [org membership request template](https://github.com/backstage/community/issues/new?template=org_member.yaml&title=Org+Member%3A+%3Cyour-github-login%3E).
|
||||
|
||||
### Privileges
|
||||
|
||||
- Membership in the Backstage GitHub organization
|
||||
|
||||
## Plugin Maintainer
|
||||
|
||||
A Plugin Maintainer is responsible for maintaining an individual Backstage plugin or module. This includes reviewing contributions and responding to issues towards an individual plugin, as well as keeping the plugin up to date.
|
||||
|
||||
Plugin Maintainer is a lightweight form of ownership that is primarily reflected though code owners of the plugin packages in the [CODEOWNERS](./.github/CODEOWNERS) file. Each plugin can have one or more maintainers. If a plugin becomes a significant part of the Backstage ecosystem, it may be promoted to be a distinct project area instead.
|
||||
|
||||
A Plugin Maintainer has all the rights and responsibilities of an Organization Member.
|
||||
|
||||
### Responsibilities
|
||||
|
||||
- Review the majority of PRs towards the plugin
|
||||
- Respond to GitHub issues related to the plugin
|
||||
- Keep the plugin up-to-date with Backstage libraries and other dependencies
|
||||
- Follow the [reviewing guide](REVIEWING.md)
|
||||
|
||||
### Requirements
|
||||
|
||||
- Is an Organization Member
|
||||
- Display knowledge of Backstage's review process and best practices for plugin design
|
||||
- Is supportive of new and occasional contributors and helps get useful PRs in shape to merge
|
||||
|
||||
### Privileges
|
||||
|
||||
- GitHub code owner of the plugin directory, with rights to approve and merge PRs towards the plugin
|
||||
|
||||
### Becoming a Plugin Maintainer
|
||||
|
||||
To become a Plugin Maintainer, you first need to be an Organization Member. You can then file a pull request towards [CODEOWNERS.md](./.github/CODEOWNERS) requesting to be added as a code owner of the plugin directory. Existing code owners of that plugin alongside the core maintainers will then review the request.
|
||||
|
||||
## Project Area Maintainer
|
||||
|
||||
Project Area Maintainers are owners of a particular project area. They are expected to review and merge pull requests towards their area, and also drive development and manage tech health. A Project Area Maintainer also need to commit a certain number of hours per month towards the project, and exercise judgment for the good of the project, independent of their employer. Project Area Maintainers should also mentor new maintainers and participate in and lead community meetings related to their area. New Project Area Maintainers need to be approved by the existing project area maintainers, or the core maintainers if it is a new area.
|
||||
|
||||
The maintainers of a project area may be represented by a team in external organization. In this case, the state as a project area maintainer is tied to the membership in that team. New members of the team may automatically be added as maintainers, as well as removed when they leave. This process is governed autonomously by the team of project area maintainers.
|
||||
|
||||
A Project Area Maintainer has all the rights and responsibilities of an Organization Member.
|
||||
|
||||
### Responsibilities
|
||||
|
||||
- Review PRs towards their project area. Project area maintainers are expected to review at least 20 PRs per year, or the majority of all PRs towards the area, if it is less than 20
|
||||
- Follow the [reviewing guide](REVIEWING.md)
|
||||
- Triage and respond to issues related to their project area
|
||||
- Mentor new project area maintainers
|
||||
- Write refactoring PRs
|
||||
- Determine strategy and policy for the project area
|
||||
- Participate in or leading community meetings related to their project area
|
||||
|
||||
### Requirements
|
||||
|
||||
- Is an Organization Member
|
||||
- Have made at least 5 meaningful contributions towards the project area
|
||||
- Demonstrates knowledge of their project area, and how it fits into the larger Backstage project
|
||||
- Is able to exercise judgment for the good of the project, independent of their employer, friends, or team
|
||||
- Mentors other contributors and project area maintainers
|
||||
- Can commit to spending at least 16 hours per month working on the project, preferably distributed evenly across the month
|
||||
|
||||
### Privileges
|
||||
|
||||
- Approve and merge PRs towards their project area
|
||||
- Drive the direction and roadmap of their project area
|
||||
|
||||
### Becoming a Project Area Maintainer
|
||||
|
||||
If you are interested in becoming a project area maintainer, reach out to the existing maintainers for that area. If you wish to become a maintainer for a new area, reach out to the core maintainers.
|
||||
|
||||
Any current project area maintainer or core maintainer may nominate a new project area maintainer by opening a PR towards the [OWNERS.md](OWNERS.md) file. A majority of the project area maintainers for that area must approve the PR. If there are no existing maintainers for that area, the PR must be approved by a majority of the core maintainers.
|
||||
|
||||
## Core Maintainer
|
||||
|
||||
Core Maintainers are responsible for the Backstage project as a whole. They help review and merge project-level pull requests as well as coordinate work affecting multiple project areas. A core maintainer needs to commit the majority of their working time towards the project, and exercise judgment for the good of the project, independent of their employer. Core maintainers should also mentor and seek out new maintainers, lead community meetings, and communicate with the CNCF on behalf of the project. To become a core maintainer one needs to have been the maintainer of a number of different project areas, demonstrate a deep knowledge of large parts of the Backstage project, and be backed by the existing core maintainers.
|
||||
|
||||
A Core Maintainer have all the rights and responsibilities of a Project Area Maintainer.
|
||||
|
||||
### Responsibilities
|
||||
|
||||
- Take part in the incoming issue and PR triage and review process. PRs are shared equally among all maintainers
|
||||
- Mentor new Project Area Maintainers and Plugin Maintainers
|
||||
- Drive refactoring and manage tech health across the entire project
|
||||
- Participate in CNCF maintainer activities
|
||||
- Respond to security incidents in accordance to our [security policy](./SECURITY.md)
|
||||
- Determine strategy and policy for the project
|
||||
- Participate in or leading community meetings
|
||||
|
||||
### Requirements
|
||||
|
||||
- Experience as a Project Area Maintainer for at least 6 months
|
||||
- Demonstrates a broad knowledge of the project across multiple areas
|
||||
- Is able to exercise judgment for the good of the project, independent of their employer, friends, or team
|
||||
- Mentors other contributors
|
||||
- Can commit to spending at least 10 days per month working on the project
|
||||
|
||||
### Privileges
|
||||
|
||||
- Approve PRs that fall outside any specific project area
|
||||
- Merge PRs to any area of the project
|
||||
- Represent the project in public as a Maintainer
|
||||
- Communicate with the CNCF on behalf of the project
|
||||
- Have a vote in Maintainer decision-making meetings
|
||||
|
||||
### Becoming a Core Maintainer
|
||||
|
||||
Any core maintainer or end user sponsor may nominate a new core maintainer by opening a PR towards the [OWNERS.md](OWNERS.md) file. Core maintainers must be approved by a majority of the existing core maintainers and end user sponsors.
|
||||
|
||||
## End User Sponsors
|
||||
|
||||
### Role of a Backstage End User Sponsor
|
||||
|
||||
- Provide support for Backstage by removing blockers, securing funding, providing advocacy, feedback, and ensuring project continuity and long term success
|
||||
- Assist Backstage maintainers in prioritizing upcoming roadmap items and planned work
|
||||
- Provide neutral mediation for any disputes that arise as part of the project
|
||||
|
||||
### Backstage End User Sponsor Membership
|
||||
|
||||
The End User Sponsors group comprises at most 5 people. To be eligible for membership in the group, you or the company where you work you must:
|
||||
|
||||
- Be responsible for and end user of a production Backstage deployment of non-trivial size
|
||||
- Be active contributors to the open source project
|
||||
- Be willing and able to attend regularly-scheduled End User Sponsor meetings
|
||||
- Abide by [CNCF CoC](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)
|
||||
|
||||
Candidates for membership will be nominated by current Sponsor members or by Backstage maintainers. If there are more nominations than Sponsor seats remaining, existing sponsors shall vote on the candidates, and the candidates with the most votes will become Sponsors. Any ties will be broken by current Backstage sponsors.
|
||||
|
||||
# Conflict resolution and voting
|
||||
|
||||
In general, we prefer that technical issues and membership are amicably worked out between the persons involved. If a dispute cannot be decided independently, the sponsors and core maintainers can be called in to decide an issue. If the sponsors and maintainers themselves cannot decide an issue, the issue will be resolved by voting.
|
||||
|
||||
In all cases in this document where voting is mentioned, the voting process is a simple majority in which each sponsor receives two votes and each core maintainer receives one vote. If such a majority is reached, the vote is said to have _passed_.
|
||||
|
||||
## Inactivity
|
||||
|
||||
It is important for contributors to be and stay active to set an example and show commitment to the project. Inactivity is harmful to the project as it may lead to unexpected delays, contributor attrition, and a loss of trust in the project.
|
||||
|
||||
Inactivity is measured by periods of no contributions without explanation, for longer than:
|
||||
|
||||
- Core Maintainer: 2 months
|
||||
- Project Area Maintainer: 4 months
|
||||
- Plugin Maintainer: 6 months
|
||||
- Organization Member: 12 months
|
||||
|
||||
Consequences of being inactive include:
|
||||
|
||||
- Involuntary removal or demotion
|
||||
- Being asked to move to Emeritus status
|
||||
|
||||
## Involuntary Removal or Demotion
|
||||
|
||||
Involuntary removal/demotion of a contributor happens when responsibilities and requirements aren't being met. This may include repeated patterns of inactivity, extended period of inactivity, a period of failing to meet the requirements of your role, and/or a violation of the Code of Conduct. This process is important because it protects the community and its deliverables while also opens up opportunities for new contributors to step in.
|
||||
|
||||
Involuntary removal or demotion is handled through a vote by a majority of the current Core Maintainers. Some aspects of this process may be automated, such as removal after periods of inactivity.
|
||||
|
||||
## Stepping Down/Emeritus Process
|
||||
|
||||
If and when contributors' commitment levels change, contributors can consider stepping down (moving down the contributor ladder) vs moving to emeritus status (completely stepping away from the project).
|
||||
|
||||
Contact the Maintainers about changing to Emeritus status, or reducing your contributor level.
|
||||
@@ -5,3 +5,4 @@ Portions of this software were developed by third-party software vendors:
|
||||
|
||||
- Tech Radar Plugin (https://opensource.zalando.com/tech-radar/), Copyright (c) 2017 Zalando SE
|
||||
- [OpenAPI Generator Templates](./packages/repo-tools/templates), Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) Copyright 2018 SmartBear Software
|
||||
- Optic CLI (https://github.com/opticdev/optic), Copyright 2022, Optic Labs Corporation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- See [CONTRIBUTING.md](CONTRIBUTING.md) for general contribution guidelines.
|
||||
- See [GOVERNANCE.md](GOVERNANCE.md) for governance guidelines and responsibilities.
|
||||
- See [GOVERNANCE.md](https://github.com/backstage/community/blob/main/GOVERNANCE.md) for governance guidelines and responsibilities.
|
||||
|
||||
## Core Maintainers
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ app:
|
||||
# applicationId: qwerty
|
||||
# site: # datadoghq.eu default = datadoghq.com
|
||||
# env: # optional
|
||||
# sessionSampleRate: 100
|
||||
# sessionReplaySampleRate: 0
|
||||
|
||||
support:
|
||||
url: https://github.com/backstage/backstage/issues # Used by common ErrorPage
|
||||
items: # Used by common SupportButton component
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 72 KiB |
+1
-1
@@ -37,7 +37,7 @@ more, read our blog post,
|
||||
|
||||
Yes, we've already started releasing open source versions of some of the plugins
|
||||
we use here, and we'll continue to do so.
|
||||
[Plugins](#what-is-a-plugin-in-backstage) are the building blocks of
|
||||
[Plugins](technical.md#what-is-a-plugin-in-backstage) are the building blocks of
|
||||
functionality in Backstage. We have over 120 plugins inside Spotify — many of
|
||||
those are specialized for our use, so will remain internal and proprietary to
|
||||
us. But we estimate that about a third of our existing plugins make good open
|
||||
|
||||
@@ -154,7 +154,7 @@ maintains Backstage in your own environment.
|
||||
|
||||
For more information, see our
|
||||
[Owners](https://github.com/backstage/backstage/blob/master/OWNERS.md) and
|
||||
[Governance](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md).
|
||||
[Governance](https://github.com/backstage/community/blob/main/GOVERNANCE.md).
|
||||
|
||||
### Does Spotify provide a managed version of Backstage?
|
||||
|
||||
|
||||
@@ -6,4 +6,50 @@ sidebar_label: Configuring Extensions
|
||||
description: Documentation for how to configure extensions in a Backstage app
|
||||
---
|
||||
|
||||
TODO
|
||||
All extensions in a Backstage app can be configured through static configuration. This configuration is all done under the `app.extensions` configuration key. For more general information on how to write configuration for Backstage, see the section on [writing configuration](../../conf/writing.md).
|
||||
|
||||
## Extension Configuration Schema
|
||||
|
||||
This section focuses on the format of the `app.extensions` configuration and the various shorthands that are available.
|
||||
|
||||
The most complete and verbose format for configuring an individual extensions is as follows:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
extensions:
|
||||
- <id>:
|
||||
attachTo:
|
||||
id: <parent-id>
|
||||
input: <input-name>
|
||||
disabled: <true/false>
|
||||
config: <extension-specific-config->
|
||||
```
|
||||
|
||||
All of the top-level fields are optional: `attachTo`, `disabled`, and `config`. Every extension implementation must provide defaults for all of these fields that will be used if they are not provided in the configuration.
|
||||
|
||||
Note that `app.extensions` is always an array rather than an object. For example, the following is invalid:
|
||||
|
||||
```yaml title="INVALID"
|
||||
app:
|
||||
extensions:
|
||||
<id>: # Invalid, this should be an array item, `app.extensions` is now an object
|
||||
config: ...
|
||||
```
|
||||
|
||||
In addition to this schema, there are a number of shorthands available:
|
||||
|
||||
Rather than a full object, you can specify just the ID of the extension as a string. This is equivalent to setting `disabled` to `false`:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
extensions:
|
||||
- ‘<id>’
|
||||
```
|
||||
|
||||
You can enable/disable individual extension by ID, in this case the value is a boolean:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
extensions:
|
||||
- <id>: <true/false>
|
||||
```
|
||||
|
||||
@@ -117,7 +117,7 @@ You can then also add any additional extensions that you may need to create as p
|
||||
|
||||
[Utility API](../utility-apis/01-index.md) factories are now installed as extensions instead. Pass the existing factory to `createApiExtension` and install it in the app. For more information, see the section on [configuring Utility APIs](../utility-apis/04-configuring.md).
|
||||
|
||||
For example, the following API configuration:
|
||||
For example, the following `apis` configuration:
|
||||
|
||||
```ts
|
||||
const app = createApp({
|
||||
@@ -151,15 +151,75 @@ Icons are currently installed through the usual options to `createApp`, but will
|
||||
|
||||
Plugins are now passed through the `features` options instead.
|
||||
|
||||
For example, the following `plugins` configuration:
|
||||
|
||||
```tsx
|
||||
import { homePlugin } from '@backstage/plugin-home';
|
||||
|
||||
createApp({
|
||||
// ...
|
||||
plugins: [homePlugin],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Can be converted to the following `features` configuration:
|
||||
|
||||
```tsx
|
||||
// plugins are now default exported via alpha subpath
|
||||
import homePlugin from '@backstage/plugin-home/alpha';
|
||||
|
||||
createApp({
|
||||
// ...
|
||||
features: [homePlugin],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Plugins don't even have to be imported manually after installing their package if [features discovery](../architecture/02-app.md#feature-discovery) is enabled.
|
||||
|
||||
```yaml title="in app-config.yaml"
|
||||
app:
|
||||
# Enabling plugin and override features discovery
|
||||
experimental: 'all'
|
||||
```
|
||||
|
||||
### `featureFlags`
|
||||
|
||||
Declaring features flags in the app is no longer supported, move these declarations to the appropriate plugins instead.
|
||||
|
||||
For example, the following app feature flags configuration:
|
||||
|
||||
```tsx
|
||||
createApp({
|
||||
// ...
|
||||
featureFlags: [
|
||||
{
|
||||
pluginId: '',
|
||||
name: 'tech-radar',
|
||||
description: 'Enables the tech radar plugin',
|
||||
},
|
||||
],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Can be converted to the following plugin configuration:
|
||||
|
||||
```tsx
|
||||
createPlugin({
|
||||
id: 'tech-radar',
|
||||
// ...
|
||||
featureFlags: [{ name: 'tech-radar' }],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### `components`
|
||||
|
||||
Many app components are now installed as extensions instead using `createComponentExtension`. See the section on [configuring app components](./01-index.md#configure-your-app) for more information.
|
||||
|
||||
The `Router` component is now a built-in extension that you can override using `createRouterExtension`.
|
||||
The `Router` component is now a built-in extension that you can [override](../architecture/05-extension-overrides.md) using `createRouterExtension`.
|
||||
|
||||
The Sign-in page is now installed as an extension using the `createSignInPageExtension` instead.
|
||||
|
||||
@@ -277,6 +337,35 @@ const app = createApp({
|
||||
|
||||
Translations are now installed as extensions, using `createTranslationExtension`.
|
||||
|
||||
For example, the following translations configuration:
|
||||
|
||||
```tsx
|
||||
import { catalogTranslationRef } from '@backstage/plugin-catalog/alpha';
|
||||
createApp({
|
||||
// ...
|
||||
__experimentalTranslations: {
|
||||
resources: [
|
||||
createTranslationMessages({
|
||||
ref: catalogTranslationRef,
|
||||
catalog_page_create_button_title: 'Create Software',
|
||||
}),
|
||||
],
|
||||
},
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Can be converted to the following extension:
|
||||
|
||||
```tsx
|
||||
createTranslationExtension({
|
||||
resource: createTranslationMessages({
|
||||
ref: catalogTranslationRef,
|
||||
catalog_page_create_button_title: 'Create Software',
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
## Gradual Migration
|
||||
|
||||
After updating all `createApp` options as well as using `convertLegacyApp` to use your existing app structure, you should be able to start up the app and see that it still works. If that is not the case, make sure you read any error messages that you may see in the app as they can provide hints on what you need to fix. If you are still stuck, you can check if anyone else ran into the same issue in our [GitHub issues](https://github.com/backstage/backstage/issues), or ask for help in our [community Discord](https://discord.gg/backstage-687207715902193673).
|
||||
@@ -368,7 +457,7 @@ The entity pages are typically defined in `packages/app/src/components/catalog`
|
||||
|
||||
New apps feature a built-in sidebar extension (`app/nav`) that will render all nav item extensions provided by plugins. This is a placeholder implementation and not intended as a long-term solution. In the future we will aim to provide a more flexible sidebar extension that allows for more customization out of the box.
|
||||
|
||||
Because the built-in sidebar is quite limited you may want to override the sidebar with your own custom implementation. To do so, use `createExtension` directly and refer to the [original sidebar implementation](https://github.com/backstage/backstage/blob/master/packages/frontend-app-api/src/extensions/AppNav.tsx). The following is an example of how to take your existing sidebar from the `Root` component that you typically find in `packages/app/src/components/Root.tsx`, and use it in an extension override:
|
||||
Because the built-in sidebar is quite limited you may want to override the sidebar with your own custom implementation. To do so, use `createExtension` directly and refer to the [original sidebar implementation](https://github.com/backstage/backstage/blob/master/packages/frontend-app-api/src/extensions/AppNav.tsx). The following is an example of how to take your existing sidebar from the `Root` component that you typically find in `packages/app/src/components/Root.tsx`, and use it in an [extension override](../architecture/05-extension-overrides.md):
|
||||
|
||||
```tsx
|
||||
const nav = createExtension({
|
||||
@@ -435,3 +524,24 @@ export default app.createRoot(
|
||||
```
|
||||
|
||||
Any app root wrapper needs to be migrated to be an extension, using `createAppRootWrapperExtension`. Note that if you have multiple wrappers they must be completely independent of each other, i.e. the order in which they the appear in the React tree should not matter. If that is not the case then you should group them into a single wrapper.
|
||||
|
||||
Here is an example converting the `CustomAppBarrier` into extension:
|
||||
|
||||
```tsx
|
||||
createApp({
|
||||
// ...
|
||||
features: [
|
||||
createExtensionOverrides({
|
||||
extensions: [
|
||||
createAppRootWrapperExtension({
|
||||
name: 'CustomAppBarrier',
|
||||
// Whenever your component uses legacy core packages, wrap it with "compatWrapper"
|
||||
// e.g. props => compatWrapper(<CustomAppBarrier {...props} />)
|
||||
Component: CustomAppBarrier,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
@@ -22,6 +22,8 @@ app:
|
||||
applicationId: qwerty
|
||||
# site: datadoghq.eu
|
||||
# env: 'staging'
|
||||
# sessionSampleRate: 100
|
||||
# sessionReplaySampleRate: 0
|
||||
```
|
||||
|
||||
If your [`app-config.yaml`](https://github.com/backstage/backstage/blob/e0506af8fc54074a160fb91c83d6cae8172d3bb3/app-config.yaml#L5) file does not have this configuration, you may have to adjust your [`packages/app/public/index.html`](https://github.com/backstage/backstage/blob/e0506af8fc54074a160fb91c83d6cae8172d3bb3/packages/app/public/index.html#L69) to include the Datadog RUM `init()` section manually.
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
id: locations
|
||||
title: Harness Locations
|
||||
sidebar_label: Locations
|
||||
description: Integrating source code stored in Harness Code into the Backstage catalog
|
||||
---
|
||||
|
||||
The Harness Code integration supports loading catalog entities from a hosted repository. Entities can be added to
|
||||
[static catalog configuration](../../features/software-catalog/configuration.md),
|
||||
registered with the
|
||||
[catalog-import](https://github.com/backstage/backstage/tree/master/plugins/catalog-import)
|
||||
plugin.
|
||||
|
||||
## Configuration
|
||||
|
||||
To use this integration, add configuration to your root `app-config.yaml`:
|
||||
|
||||
```yaml
|
||||
integrations:
|
||||
harness:
|
||||
- host: app.harness.io
|
||||
token: ${HARNESS_CODE_BEARER_TOKEN}
|
||||
apiKey: ${HARNESS_CODE_APIKEY}
|
||||
```
|
||||
|
||||
Directly under the `harness` key is a list of provider configurations, where you
|
||||
can list the Harness instances you want to be able to fetch
|
||||
|
||||
check out https://developer.harness.io/docs/platform/automation/api/add-and-manage-api-keys/ for more information
|
||||
|
||||
- `host`: The host of the Harness Code instance that you want to match on.
|
||||
- `token` (optional): The password or api token to authenticate with.
|
||||
- `apiKey` (optional): The apiKey to authenticate with.
|
||||
@@ -20,7 +20,7 @@ info:
|
||||
|
||||
### Generating your client
|
||||
|
||||
1. Run `yarn backstage-repo-tools schema openapi generate client --output-package <directory>`. This will create a new folder in `<directory>/src/generated` to house the generated content.
|
||||
1. Run `yarn backstage-repo-tools package schema openapi generate client --client-package <directory>`. This will create a new folder in `<directory>/src/generated` to house the generated content.
|
||||
2. You should use the generated files as follows,
|
||||
|
||||
- `apis/DefaultApi.client.ts` - this is the client that you should use. It has types for all of the various operations on your API.
|
||||
|
||||
@@ -81,19 +81,21 @@ In order for Backstage to function properly the following versioning rules must
|
||||
be followed. The rules are referring to the
|
||||
[Package Architecture](https://backstage.io/docs/overview/architecture-overview#package-architecture).
|
||||
|
||||
- The versions of all the packages in the `Frontend App Core` must be from the
|
||||
same release, and it is recommended to keep `Common Tooling` on that release
|
||||
too.
|
||||
- The Backstage dependencies of any given plugin should be from the same
|
||||
release. This includes the packages from `Common Libraries`,
|
||||
`Frontend Plugin Core`, and `Frontend Libraries`, or alternatively the
|
||||
`Backend Libraries`.
|
||||
- There must be no package that is from a newer release than the
|
||||
`Frontend App Core` packages in the app.
|
||||
- The versions of all packages for each of the "App Core" groups must be from the
|
||||
same Backstage release.
|
||||
- For each frontend and backend setup, the "App Core" packages must be ahead of or on the same Backstage release as the "Plugin Core" packages, including transitive dependencies of all installed plugins and modules.
|
||||
- For any given plugin, the versions of all packages from the "Plugin Core" and
|
||||
"Library" groups must be from the same Backstage release.
|
||||
- Frontend plugins with a corresponding backend plugin should be from the same
|
||||
release. The update to the backend plugin **MUST** be deployed before or
|
||||
together with the update to the frontend plugin.
|
||||
|
||||
It is allowed and often expected that the "Plugin Core" and "Library" packages
|
||||
are from older releases than the "App Core" packages. It is also allowed to have
|
||||
duplicate installations of the "Plugin Core" and "Library" packages. This is all
|
||||
to make sure that upgrading Backstage is as smooth as possible and allows for
|
||||
more flexibility across the entire plugin ecosystem.
|
||||
|
||||
## Package Versioning Policy
|
||||
|
||||
Every individual package is versioned according to [semver](https://semver.org).
|
||||
|
||||
@@ -66,9 +66,9 @@ Speaking of reviewers and maintainers…
|
||||
|
||||
## Adding reviewers and maintainers
|
||||
|
||||
[](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md#reviewers)
|
||||
[](https://github.com/backstage/community/blob/main/GOVERNANCE.md#reviewers)
|
||||
|
||||
We have introduced [reviewers](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md#reviewers) to the project! By adding this new role, we’ve expanded the number of people who are permitted to approve and merge pull requests. This will offload some of the review work from the maintainers, simplifying and speeding up the review process for contributors.
|
||||
We have introduced [reviewers](https://github.com/backstage/community/blob/main/GOVERNANCE.md#reviewers) to the project! By adding this new role, we’ve expanded the number of people who are permitted to approve and merge pull requests. This will offload some of the review work from the maintainers, simplifying and speeding up the review process for contributors.
|
||||
|
||||
Of course, with these new efforts, we expect even more companies to adopt Backstage, which means the platform will continue to grow, and the number of PRs will continue to grow with it. As that happens, we hope to add to both the maintainer and reviewer teams in the future.
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ On Tuesday the Backstage maintainers hosted a jam-packed project meeting. The co
|
||||
|
||||

|
||||
|
||||
Core maintainers [Ben Lambert](https://github.com/benjdlambert) and [Patrik Oldsberg](https://github.com/Rugvip) took center stage on Wednesday for the Backstage Maintainer Track: State of Backstage in 2023 talk. Backstage has officially hit over 1,000 adopters and 1,000 contributors – so it’s apt timing to modernize the governance model for the project. Taking pointers from the [CNCF Contributor Ladder Governance Template](https://contribute.cncf.io/maintainers/templates/), a new [Backstage Governance Model](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md) is now in effect! Patrik walked us through the new ladder model which introduces a number of changes, one being the addition of [project area maintainers](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md#project-area-maintainer). This role lets members of the community take increased ownership over a specific area of interest, like Catalog, Discoverability, TechDocs, Helm Charts, and Kubernetes. New project areas that will be added include Permissions and Software Templates. New project areas can be proposed by nominating a project area maintainer for the area. The new model also adds an organization member role for contributors who want to take a more active role in the Backstage community. You can open an issue to become an organization member [here](https://github.com/backstage/community/issues/new/choose).
|
||||
Core maintainers [Ben Lambert](https://github.com/benjdlambert) and [Patrik Oldsberg](https://github.com/Rugvip) took center stage on Wednesday for the Backstage Maintainer Track: State of Backstage in 2023 talk. Backstage has officially hit over 1,000 adopters and 1,000 contributors – so it’s apt timing to modernize the governance model for the project. Taking pointers from the [CNCF Contributor Ladder Governance Template](https://contribute.cncf.io/maintainers/templates/), a new [Backstage Governance Model](https://github.com/backstage/community/blob/main/GOVERNANCE.md) is now in effect! Patrik walked us through the new ladder model which introduces a number of changes, one being the addition of [project area maintainers](https://github.com/backstage/community/blob/main/GOVERNANCE.md#project-area-maintainer). This role lets members of the community take increased ownership over a specific area of interest, like Catalog, Discoverability, TechDocs, Helm Charts, and Kubernetes. New project areas that will be added include Permissions and Software Templates. New project areas can be proposed by nominating a project area maintainer for the area. The new model also adds an organization member role for contributors who want to take a more active role in the Backstage community. You can open an issue to become an organization member [here](https://github.com/backstage/community/issues/new/choose).
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ For those who depended on these plugins, migrating is as simple as `yarn backsta
|
||||
|
||||
## The community plugins repo
|
||||
|
||||
Some of you who have been around a while, or have seen our [Maintainer Track talks](https://www.youtube.com/watch?v=ONMBYnhxnNU) at KubeCon, might have seen [this RFC](https://github.com/backstage/backstage/issues/20266) which outlines some issues with the scale of the `backstage/backstage` monorepo, and us as maintainers being the de facto owners of all plugins without a [project area](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md#project-area) or [plugin maintainer](https://github.com/backstage/backstage/blob/master/GOVERNANCE.md#project-area-maintainer).
|
||||
Some of you who have been around a while, or have seen our [Maintainer Track talks](https://www.youtube.com/watch?v=ONMBYnhxnNU) at KubeCon, might have seen [this RFC](https://github.com/backstage/backstage/issues/20266) which outlines some issues with the scale of the `backstage/backstage` monorepo, and us as maintainers being the de facto owners of all plugins without a [project area](https://github.com/backstage/community/blob/main/GOVERNANCE.md#project-area) or [plugin maintainer](https://github.com/backstage/community/blob/main/GOVERNANCE.md#project-area-maintainer).
|
||||
|
||||
There was some great discussion in this issue, and some great ideas. One of the ideas was to create a dedicated home for community plugins, with all the burden of release tooling and workspace tooling already set up, which is a pretty big barrier for people wanting to create plugins for Backstage in their own organization or personal account. These plugins would then have the ability to release independently of the main monorepo, and have their own release cadence, which is something that we've been looking at exploring for a while.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ author: Marcin Kozlowski
|
||||
authorUrl: https://betterscan.io
|
||||
category: Security
|
||||
description: View security scanned vulnerabilities in Code and Cloud scanned using Open Source and proprietary scanners directly in Backstage.
|
||||
documentation: https://github.com/marcinguy/betterscan-ce
|
||||
documentation: https://www.npmjs.com/package/@marcinguy/backstage-plugin-betterscan
|
||||
iconUrl: https://uploads-ssl.webflow.com/6339e3b81867539b5fe2498d/633a1643dcb06d3029867161_g4.svg
|
||||
npmPackageName: '@marcinguy/backstage-plugin-betterscan'
|
||||
addedDate: '2022-12-08'
|
||||
|
||||
@@ -238,6 +238,11 @@
|
||||
"label": "Gitea",
|
||||
"items": ["integrations/gitea/locations"]
|
||||
},
|
||||
{
|
||||
"type": "category",
|
||||
"label": "Harness",
|
||||
"items": ["integrations/harness/locations"]
|
||||
},
|
||||
{
|
||||
"type": "category",
|
||||
"label": "Google GCS",
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
},
|
||||
"prettier": "@spotify/prettier-config",
|
||||
"resolutions": {
|
||||
"@changesets/assemble-release-plan@^6.0.0": "patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch",
|
||||
"@material-ui/pickers@^3.2.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
|
||||
"@material-ui/pickers@^3.3.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
|
||||
"@types/react": "^18",
|
||||
|
||||
@@ -72,7 +72,10 @@
|
||||
site: '<%= config.getOptionalString("app.datadogRum.site") || "datadoghq.com" %>',
|
||||
service: 'backstage',
|
||||
env: '<%= config.getString("app.datadogRum.env") %>',
|
||||
sampleRate: 100,
|
||||
sampleRate:
|
||||
'<%= config.getOptionalNumber("app.datadogRum.sessionSampleRate") || 100 %>',
|
||||
sessionReplaySampleRate:
|
||||
'<%= config.getOptionalNumber("app.datadogRum.sessionReplaySampleRate") || 0 %>',
|
||||
trackInteractions: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,7 +72,10 @@
|
||||
site: '<%= config.getOptionalString("app.datadogRum.site") || "datadoghq.com" %>',
|
||||
service: 'backstage',
|
||||
env: '<%= config.getString("app.datadogRum.env") %>',
|
||||
sampleRate: 100,
|
||||
sampleRate:
|
||||
'<%= config.getOptionalNumber("app.datadogRum.sessionSampleRate") || 100 %>',
|
||||
sessionReplaySampleRate:
|
||||
'<%= config.getOptionalNumber("app.datadogRum.sessionReplaySampleRate") || 0 %>',
|
||||
trackInteractions: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,6 +22,17 @@ function msg(info: TransformableInfo): TransformableInfo {
|
||||
}
|
||||
|
||||
describe('WinstonLogger', () => {
|
||||
it('creates a winston logger instance with default options', () => {
|
||||
const logger = WinstonLogger.create({});
|
||||
expect(logger).toBeInstanceOf(WinstonLogger);
|
||||
});
|
||||
|
||||
it('creates a child logger', () => {
|
||||
const logger = WinstonLogger.create({});
|
||||
const childLogger = logger.child({ plugin: 'test-plugin' });
|
||||
expect(childLogger).toBeInstanceOf(WinstonLogger);
|
||||
});
|
||||
|
||||
it('redacter should redact and escape regex', () => {
|
||||
const redacter = WinstonLogger.redacter();
|
||||
const log = {
|
||||
@@ -47,4 +58,24 @@ describe('WinstonLogger', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('redacter should redact nested object', () => {
|
||||
const redacter = WinstonLogger.redacter();
|
||||
const log = {
|
||||
level: 'error',
|
||||
message: {
|
||||
nested: 'hello (world) from nested object',
|
||||
},
|
||||
};
|
||||
|
||||
redacter.add(['hello']);
|
||||
expect(redacter.format.transform(msg(log))).toEqual(
|
||||
msg({
|
||||
...log,
|
||||
message: {
|
||||
nested: '[REDACTED] (world) from nested object',
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ import { GiteaIntegration } from '@backstage/integration';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { GithubIntegration } from '@backstage/integration';
|
||||
import { GitLabIntegration } from '@backstage/integration';
|
||||
import { HarnessIntegration } from '@backstage/integration';
|
||||
import { HostDiscovery as HostDiscovery_2 } from '@backstage/backend-app-api';
|
||||
import { HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import { IdentityService } from '@backstage/backend-plugin-api';
|
||||
@@ -512,6 +513,23 @@ export class GitlabUrlReader implements UrlReader {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class HarnessUrlReader implements UrlReader {
|
||||
constructor(integration: HarnessIntegration);
|
||||
// (undocumented)
|
||||
static factory: ReaderFactory;
|
||||
// (undocumented)
|
||||
read(url: string): Promise<Buffer>;
|
||||
// (undocumented)
|
||||
readTree(): Promise<ReadTreeResponse>;
|
||||
// (undocumented)
|
||||
readUrl(url: string, options?: ReadUrlOptions): Promise<ReadUrlResponse>;
|
||||
// (undocumented)
|
||||
search(): Promise<SearchResponse>;
|
||||
// (undocumented)
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const HostDiscovery: typeof HostDiscovery_2;
|
||||
|
||||
|
||||
Vendored
+14
@@ -111,6 +111,13 @@ export interface Config {
|
||||
* Defaults to true if unspecified.
|
||||
*/
|
||||
ensureExists?: boolean;
|
||||
/**
|
||||
* Whether to ensure the given database schema exists by creating it if it does not.
|
||||
* Defaults to false if unspecified.
|
||||
*
|
||||
* NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
|
||||
*/
|
||||
ensureSchemaExists?: boolean;
|
||||
/**
|
||||
* How plugins databases are managed/divided in the provided database instance.
|
||||
*
|
||||
@@ -147,6 +154,13 @@ export interface Config {
|
||||
* Defaults to base config if unspecified.
|
||||
*/
|
||||
ensureExists?: boolean;
|
||||
/**
|
||||
* Whether to ensure the given database schema exists by creating it if it does not.
|
||||
* Defaults to false if unspecified.
|
||||
*
|
||||
* NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
|
||||
*/
|
||||
ensureSchemaExists?: boolean;
|
||||
/**
|
||||
* Arbitrary config object to pass to knex when initializing
|
||||
* (https://knexjs.org/#Installation-client). Most notable is the
|
||||
|
||||
@@ -321,7 +321,10 @@ export class PgConnector implements Connector {
|
||||
let schemaOverrides;
|
||||
if (this.getPluginDivisionModeConfig() === 'schema') {
|
||||
schemaOverrides = this.getSchemaOverrides(pluginId);
|
||||
if (this.getEnsureExistsConfig(pluginId)) {
|
||||
if (
|
||||
this.getEnsureSchemaExistsConfig(pluginId) ||
|
||||
this.getEnsureExistsConfig(pluginId)
|
||||
) {
|
||||
try {
|
||||
await pgConnector.ensureSchemaExists!(pluginConfig, pluginId);
|
||||
} catch (error) {
|
||||
@@ -437,6 +440,16 @@ export class PgConnector implements Connector {
|
||||
);
|
||||
}
|
||||
|
||||
private getEnsureSchemaExistsConfig(pluginId: string): boolean {
|
||||
const baseConfig =
|
||||
this.config.getOptionalBoolean('ensureSchemaExists') ?? false;
|
||||
return (
|
||||
this.config.getOptionalBoolean(
|
||||
`${pluginPath(pluginId)}.getEnsureSchemaExistsConfig`,
|
||||
) ?? baseConfig
|
||||
);
|
||||
}
|
||||
|
||||
private getPluginDivisionModeConfig(): string {
|
||||
return this.config.getOptionalString('pluginDivisionMode') ?? 'database';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright 2024 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 { setupRequestMockHandlers } from '@backstage/backend-test-utils';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { HarnessIntegration, readHarnessConfig } from '@backstage/integration';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { getVoidLogger } from '../logging';
|
||||
import { UrlReaderPredicateTuple } from './types';
|
||||
import { DefaultReadTreeResponseFactory } from './tree';
|
||||
import getRawBody from 'raw-body';
|
||||
import { HarnessUrlReader } from './HarnessUrlReader';
|
||||
|
||||
const treeResponseFactory = DefaultReadTreeResponseFactory.create({
|
||||
config: new ConfigReader({}),
|
||||
});
|
||||
|
||||
jest.mock('../scm', () => ({
|
||||
Git: {
|
||||
fromAuth: () => ({
|
||||
clone: jest.fn(() => Promise.resolve({})),
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
const harnessProcessor = new HarnessUrlReader(
|
||||
new HarnessIntegration(
|
||||
readHarnessConfig(
|
||||
new ConfigReader({
|
||||
host: 'app.harness.io',
|
||||
token: 'p',
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const createReader = (config: JsonObject): UrlReaderPredicateTuple[] => {
|
||||
return HarnessUrlReader.factory({
|
||||
config: new ConfigReader(config),
|
||||
logger: getVoidLogger(),
|
||||
treeResponseFactory,
|
||||
});
|
||||
};
|
||||
const responseBuffer = Buffer.from('Apache License');
|
||||
const harnessApiResponse = (content: any) => {
|
||||
return content;
|
||||
};
|
||||
|
||||
const handlers = [
|
||||
rest.get(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/raw/all-apis.yaml',
|
||||
(_req, res, ctx) => {
|
||||
return res(ctx.status(500), ctx.json({ message: 'Error!!!' }));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/raw/404error.yaml',
|
||||
(_req, res, ctx) => {
|
||||
return res(ctx.status(404), ctx.json({ message: 'File not found.' }));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/raw/stream.TXT',
|
||||
(_req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(harnessApiResponse(responseBuffer.toString())),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
rest.get(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/raw/buffer.TXT',
|
||||
(_req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(harnessApiResponse(responseBuffer.toString())),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
describe('HarnessUrlReader', () => {
|
||||
const worker = setupServer(...handlers);
|
||||
setupRequestMockHandlers(worker);
|
||||
beforeAll(() => worker.listen({ onUnhandledRequest: 'bypass' }));
|
||||
afterAll(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('reader factory', () => {
|
||||
it('creates a reader.', () => {
|
||||
const readers = createReader({
|
||||
integrations: {
|
||||
harness: [{ host: 'app.harness.io' }],
|
||||
},
|
||||
});
|
||||
expect(readers).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should not create a default entry.', () => {
|
||||
const readers = createReader({
|
||||
integrations: {},
|
||||
});
|
||||
expect(readers).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('predicates', () => {
|
||||
it('returns true for the configured host', () => {
|
||||
const readers = createReader({
|
||||
integrations: {
|
||||
harness: [{ host: 'app.harness.io' }],
|
||||
},
|
||||
});
|
||||
const predicate = readers[0].predicate;
|
||||
|
||||
expect(predicate(new URL('https://app.harness.io/path'))).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for a different host.', () => {
|
||||
const readers = createReader({
|
||||
integrations: {
|
||||
harness: [{ host: 'app.harness.io' }],
|
||||
},
|
||||
});
|
||||
const predicate = readers[0].predicate;
|
||||
|
||||
expect(predicate(new URL('https://github.com/path'))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('readUrl part 1', () => {
|
||||
it('should be able to read file contents as buffer', async () => {
|
||||
const result = await harnessProcessor.readUrl(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/buffer.TXT',
|
||||
);
|
||||
const buffer = await result.buffer();
|
||||
expect(buffer.toString()).toBe(responseBuffer.toString());
|
||||
});
|
||||
|
||||
it('should be able to read file contents as stream', async () => {
|
||||
const result = await harnessProcessor.readUrl(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/stream.TXT',
|
||||
);
|
||||
const fromStream = await getRawBody(result.stream!());
|
||||
expect(fromStream.toString()).toBe(responseBuffer.toString());
|
||||
});
|
||||
|
||||
it('should raise NotFoundError on 404.', async () => {
|
||||
await expect(
|
||||
harnessProcessor.readUrl(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/404error.yaml',
|
||||
),
|
||||
).rejects.toThrow(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/404error.yaml x https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/raw/404error.yaml?routingId=accountId&git_ref=refMain, 404 Not Found',
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw an error on non 404 errors.', async () => {
|
||||
await expect(
|
||||
harnessProcessor.readUrl(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml',
|
||||
),
|
||||
).rejects.toThrow(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml x https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/raw/all-apis.yaml?routingId=accountId&git_ref=refMain, 500 Internal Server Error',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright 2025 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 {
|
||||
getHarnessRequestOptions,
|
||||
getHarnessFileContentsUrl,
|
||||
HarnessIntegration,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { ReadUrlOptions, ReadUrlResponse } from './types';
|
||||
import {
|
||||
ReaderFactory,
|
||||
ReadTreeResponse,
|
||||
SearchResponse,
|
||||
UrlReader,
|
||||
} from './types';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
import { ReadUrlResponseFactory } from './ReadUrlResponseFactory';
|
||||
import {
|
||||
AuthenticationError,
|
||||
NotFoundError,
|
||||
NotModifiedError,
|
||||
} from '@backstage/errors';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
/**
|
||||
* Implements a {@link @backstage/backend-plugin-api#UrlReaderService} for the Harness code v1 api.
|
||||
*
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class HarnessUrlReader implements UrlReader {
|
||||
static factory: ReaderFactory = ({ config }) => {
|
||||
return ScmIntegrations.fromConfig(config)
|
||||
.harness.list()
|
||||
.map(integration => {
|
||||
const reader = new HarnessUrlReader(integration);
|
||||
const predicate = (url: URL) => {
|
||||
return url.host === integration.config.host;
|
||||
};
|
||||
return { reader, predicate };
|
||||
});
|
||||
};
|
||||
|
||||
constructor(private readonly integration: HarnessIntegration) {}
|
||||
|
||||
async read(url: string): Promise<Buffer> {
|
||||
const response = await this.readUrl(url);
|
||||
return response.buffer();
|
||||
}
|
||||
|
||||
async readUrl(
|
||||
url: string,
|
||||
options?: ReadUrlOptions,
|
||||
): Promise<ReadUrlResponse> {
|
||||
let response: Response;
|
||||
const blobUrl = getHarnessFileContentsUrl(this.integration.config, url);
|
||||
|
||||
try {
|
||||
response = await fetch(blobUrl, {
|
||||
method: 'GET',
|
||||
...getHarnessRequestOptions(this.integration.config),
|
||||
signal: options?.signal as any,
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(`Unable to read ${blobUrl}, ${e}`);
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
// Harness Code returns the raw content object
|
||||
const jsonResponse = { data: response.body };
|
||||
if (jsonResponse) {
|
||||
return ReadUrlResponseFactory.fromReadable(
|
||||
Readable.from(jsonResponse.data),
|
||||
{
|
||||
etag: response.headers.get('ETag') ?? undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
throw new Error(`Unknown json: ${jsonResponse}`);
|
||||
}
|
||||
|
||||
const message = `${url} x ${blobUrl}, ${response.status} ${response.statusText}`;
|
||||
if (response.status === 404) {
|
||||
throw new NotFoundError(message);
|
||||
}
|
||||
|
||||
if (response.status === 304) {
|
||||
throw new NotModifiedError();
|
||||
}
|
||||
|
||||
if (response.status === 403) {
|
||||
throw new AuthenticationError();
|
||||
}
|
||||
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
readTree(): Promise<ReadTreeResponse> {
|
||||
throw new Error('HarnessUrlReader readTree not implemented.');
|
||||
}
|
||||
search(): Promise<SearchResponse> {
|
||||
throw new Error('HarnessUrlReader search not implemented.');
|
||||
}
|
||||
|
||||
toString() {
|
||||
const { host } = this.integration.config;
|
||||
return `harness{host=${host},authed=${Boolean(
|
||||
this.integration.config.token || this.integration.config.apiKey,
|
||||
)}}`;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import { GoogleGcsUrlReader } from './GoogleGcsUrlReader';
|
||||
import { AwsS3UrlReader } from './AwsS3UrlReader';
|
||||
import { GiteaUrlReader } from './GiteaUrlReader';
|
||||
import { AwsCodeCommitUrlReader } from './AwsCodeCommitUrlReader';
|
||||
import { HarnessUrlReader } from './HarnessUrlReader';
|
||||
|
||||
/**
|
||||
* Creation options for {@link @backstage/backend-plugin-api#UrlReaderService}.
|
||||
@@ -61,7 +62,6 @@ export class UrlReaders {
|
||||
const treeResponseFactory = DefaultReadTreeResponseFactory.create({
|
||||
config,
|
||||
});
|
||||
|
||||
for (const factory of factories ?? []) {
|
||||
const tuples = factory({ config, logger: logger, treeResponseFactory });
|
||||
|
||||
@@ -94,6 +94,7 @@ export class UrlReaders {
|
||||
GiteaUrlReader.factory,
|
||||
GitlabUrlReader.factory,
|
||||
GoogleGcsUrlReader.factory,
|
||||
HarnessUrlReader.factory,
|
||||
AwsS3UrlReader.factory,
|
||||
AwsCodeCommitUrlReader.factory,
|
||||
FetchUrlReader.factory,
|
||||
|
||||
@@ -22,6 +22,7 @@ export { GerritUrlReader } from './GerritUrlReader';
|
||||
export { GithubUrlReader } from './GithubUrlReader';
|
||||
export { GitlabUrlReader } from './GitlabUrlReader';
|
||||
export { GiteaUrlReader } from './GiteaUrlReader';
|
||||
export { HarnessUrlReader } from './HarnessUrlReader';
|
||||
export { AwsS3UrlReader } from './AwsS3UrlReader';
|
||||
export { FetchUrlReader } from './FetchUrlReader';
|
||||
export { ReadUrlResponseFactory } from './ReadUrlResponseFactory';
|
||||
|
||||
+36
-26
@@ -1,34 +1,46 @@
|
||||
{
|
||||
"name": "@backstage/cli",
|
||||
"description": "CLI for developing Backstage plugins and apps",
|
||||
"version": "0.26.5-next.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "CLI for developing Backstage plugins and apps",
|
||||
"backstage": {
|
||||
"role": "cli"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"keywords": [
|
||||
"backstage"
|
||||
],
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/backstage/backstage",
|
||||
"directory": "packages/cli"
|
||||
},
|
||||
"keywords": [
|
||||
"backstage"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/index.cjs.js",
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"clean": "backstage-cli package clean",
|
||||
"start": "nodemon --"
|
||||
},
|
||||
"bin": {
|
||||
"backstage-cli": "bin/backstage-cli"
|
||||
},
|
||||
"files": [
|
||||
"asset-types",
|
||||
"templates",
|
||||
"config",
|
||||
"bin",
|
||||
"dist/**/*.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"clean": "backstage-cli package clean",
|
||||
"lint": "backstage-cli package lint",
|
||||
"start": "nodemon --",
|
||||
"test": "backstage-cli package test"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"exec": "bin/backstage-cli",
|
||||
"ext": "ts",
|
||||
"watch": "./src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/cli-common": "workspace:^",
|
||||
@@ -197,18 +209,6 @@
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"asset-types",
|
||||
"templates",
|
||||
"config",
|
||||
"bin",
|
||||
"dist/**/*.js"
|
||||
],
|
||||
"nodemonConfig": {
|
||||
"watch": "./src",
|
||||
"exec": "bin/backstage-cli",
|
||||
"ext": "ts"
|
||||
},
|
||||
"configSchema": {
|
||||
"$schema": "https://backstage.io/schema/config-v1",
|
||||
"title": "@backstage/cli",
|
||||
@@ -248,6 +248,16 @@
|
||||
"type": "string",
|
||||
"visibility": "frontend",
|
||||
"description": "site for Datadog RUM events"
|
||||
},
|
||||
"sessionSampleRate": {
|
||||
"type": "number",
|
||||
"visibility": "frontend",
|
||||
"description": "sample rate of Datadog RUM events"
|
||||
},
|
||||
"sessionReplaySampleRate": {
|
||||
"type": "number",
|
||||
"visibility": "frontend",
|
||||
"description": "sample rate of session replays based upon already sampled Datadog RUM events"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -22,11 +22,7 @@ import {
|
||||
} from '@backstage/cli-node';
|
||||
import { OptionValues } from 'commander';
|
||||
import fs from 'fs-extra';
|
||||
import {
|
||||
resolve as resolvePath,
|
||||
join as joinPath,
|
||||
relative as relativePath,
|
||||
} from 'path';
|
||||
import { resolve as resolvePath, posix, relative as relativePath } from 'path';
|
||||
import { paths } from '../../lib/paths';
|
||||
|
||||
/**
|
||||
@@ -205,7 +201,7 @@ export function createRepositoryFieldFixer() {
|
||||
const rootDir = rootRepoField.directory || '';
|
||||
|
||||
return (pkg: FixablePackage) => {
|
||||
const expectedPath = joinPath(
|
||||
const expectedPath = posix.join(
|
||||
rootDir,
|
||||
relativePath(paths.targetRoot, pkg.dir),
|
||||
);
|
||||
|
||||
@@ -894,30 +894,19 @@ describe('bump', () => {
|
||||
newVersions: [],
|
||||
newRanges: [
|
||||
{
|
||||
name: 'first-duplicate',
|
||||
oldRange: 'first-duplicate',
|
||||
newRange: 'first-duplicate',
|
||||
oldVersion: '1.0.0',
|
||||
newVersion: '2.0.0',
|
||||
},
|
||||
{
|
||||
name: 'second-duplicate',
|
||||
oldRange: 'second-duplicate',
|
||||
newRange: 'second-duplicate',
|
||||
oldVersion: '1.0.0',
|
||||
newVersion: '2.0.0',
|
||||
},
|
||||
{
|
||||
name: 'third-duplicate',
|
||||
oldRange: 'third-duplicate',
|
||||
newRange: 'third-duplicate',
|
||||
name: '@backstage/backend-app-api',
|
||||
oldRange: '^1.0.0',
|
||||
newRange: '^2.0.0',
|
||||
oldVersion: '1.0.0',
|
||||
newVersion: '2.0.0',
|
||||
},
|
||||
],
|
||||
});
|
||||
mockDir.setContent({
|
||||
'yarn.lock': lockfileMock,
|
||||
'yarn.lock': `${HEADER}
|
||||
"@backstage/backend-app-api@^1.0.0":
|
||||
version "1.0.0"
|
||||
`,
|
||||
'package.json': JSON.stringify({
|
||||
workspaces: {
|
||||
packages: ['packages/*'],
|
||||
@@ -928,16 +917,7 @@ describe('bump', () => {
|
||||
'package.json': JSON.stringify({
|
||||
name: 'a',
|
||||
dependencies: {
|
||||
'@backstage/core': '^1.0.5',
|
||||
},
|
||||
}),
|
||||
},
|
||||
b: {
|
||||
'package.json': JSON.stringify({
|
||||
name: 'b',
|
||||
dependencies: {
|
||||
'@backstage/core': '^1.0.3',
|
||||
'@backstage/theme': '^1.0.0',
|
||||
'@backstage/backend-app-api': '^1.0.0',
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -952,7 +932,12 @@ describe('bump', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
packages: [],
|
||||
packages: [
|
||||
{
|
||||
name: '@backstage/backend-app-api',
|
||||
version: '2.0.0',
|
||||
},
|
||||
],
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -962,24 +947,20 @@ describe('bump', () => {
|
||||
});
|
||||
expectLogsToMatch(logs, [
|
||||
'Using default pattern glob @backstage/*',
|
||||
'Checking for updates of @backstage/core',
|
||||
'Checking for updates of @backstage/theme',
|
||||
'Checking for updates of @backstage/core-api',
|
||||
'Checking for updates of @backstage/backend-app-api',
|
||||
'Checking for updates of @backstage/backend-app-api',
|
||||
'Some packages are outdated, updating',
|
||||
'unlocking @backstage/core@^1.0.3 ~> 1.0.6',
|
||||
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
|
||||
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
|
||||
'bumping @backstage/core in a to ^1.0.6',
|
||||
'bumping @backstage/core in b to ^1.0.6',
|
||||
'bumping @backstage/theme in b to ^2.0.0',
|
||||
'bumping @backstage/backend-app-api in a to ^2.0.0',
|
||||
'Running yarn install to install new versions',
|
||||
'Checking for moved packages to the @backstage-community namespace...',
|
||||
'⚠️ The following packages may have breaking changes:',
|
||||
' @backstage/theme : 1.0.0 ~> 2.0.0',
|
||||
' https://github.com/backstage/backstage/blob/master/packages/theme/CHANGELOG.md',
|
||||
' @backstage/backend-app-api : 1.0.0 ~> 2.0.0',
|
||||
' https://github.com/backstage/backstage/blob/master/packages/backend-app-api/CHANGELOG.md',
|
||||
'Version bump complete!',
|
||||
'The following packages have duplicates but have been allowed:',
|
||||
'first-duplicate, second-duplicate, third-duplicate',
|
||||
' ⚠️ Warning! ⚠️',
|
||||
' The below package(s) have incompatible duplicate installations, likely due to a bad dependency in a plugin.',
|
||||
' You can investigate this by running `yarn why <package-name>`, and report the issue to the plugin maintainers.',
|
||||
' @backstage/backend-app-api',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -331,24 +331,22 @@ export default async (opts: OptionValues) => {
|
||||
forbiddenDuplicatesFilter(name),
|
||||
);
|
||||
if (forbiddenNewRanges.length > 0) {
|
||||
throw new Error(
|
||||
`Version bump failed for ${forbiddenNewRanges
|
||||
.map(i => i.name)
|
||||
.join(', ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
const allowedDuplicates = result.newRanges.filter(
|
||||
({ name }) => !forbiddenDuplicatesFilter(name),
|
||||
);
|
||||
|
||||
if (allowedDuplicates.length > 0) {
|
||||
console.log(chalk.yellow(' ⚠️ Warning! ⚠️'));
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
'The following packages have duplicates but have been allowed:',
|
||||
' The below package(s) have incompatible duplicate installations, likely due to a bad dependency in a plugin.',
|
||||
),
|
||||
);
|
||||
console.log(chalk.yellow(allowedDuplicates.map(i => i.name).join(', ')));
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
' You can investigate this by running `yarn why <package-name>`, and report the issue to the plugin maintainers.',
|
||||
),
|
||||
);
|
||||
console.log();
|
||||
for (const { name } of forbiddenNewRanges) {
|
||||
console.log(chalk.yellow(` ${name}`));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -27,10 +27,7 @@ export const includedFilter = (name: string) =>
|
||||
INCLUDED.some(pattern => pattern.test(name));
|
||||
|
||||
// Packages that are not allowed to have any duplicates
|
||||
const FORBID_DUPLICATES = [
|
||||
/^@backstage\/core-app-api$/,
|
||||
/^@backstage\/plugin-/,
|
||||
];
|
||||
const FORBID_DUPLICATES = [/^@backstage\/\w+-app-api$/, /^@backstage\/plugin-/];
|
||||
|
||||
// There are some packages that ARE explicitly allowed to have duplicates since
|
||||
// they handle that appropriately. This takes precedence over FORBID_DUPLICATES
|
||||
|
||||
@@ -447,6 +447,7 @@ export type GaugeProps = {
|
||||
inverse?: boolean;
|
||||
unit?: string;
|
||||
max?: number;
|
||||
size?: 'normal' | 'small';
|
||||
description?: ReactNode;
|
||||
getColor?: GaugePropsGetColor;
|
||||
};
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2024 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 React from 'react';
|
||||
import { HeaderIconLinkRow } from '../HeaderIconLinkRow';
|
||||
import { IconLinkVerticalProps } from './IconLinkVertical';
|
||||
|
||||
type Props = {
|
||||
links: IconLinkVerticalProps[];
|
||||
};
|
||||
|
||||
export default {
|
||||
title: 'Data Display/HeaderIconLinkRow',
|
||||
component: HeaderIconLinkRow,
|
||||
};
|
||||
|
||||
export const Default = (args: Props) => <HeaderIconLinkRow {...args} />;
|
||||
Default.args = {
|
||||
links: [
|
||||
{
|
||||
color: 'primary',
|
||||
disabled: false,
|
||||
href: 'https://google.com',
|
||||
label: 'primary',
|
||||
title: 'title',
|
||||
},
|
||||
{
|
||||
color: 'secondary',
|
||||
disabled: false,
|
||||
href: 'https://google.com',
|
||||
label: 'secondary',
|
||||
title: 'title-2',
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -19,6 +19,7 @@ import { makeStyles, useTheme } from '@material-ui/core/styles';
|
||||
import { Circle } from 'rc-progress';
|
||||
import React, { ReactNode, useEffect, useState } from 'react';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import classNames from 'classnames';
|
||||
|
||||
/** @public */
|
||||
export type GaugeClassKey =
|
||||
@@ -43,6 +44,9 @@ const useStyles = makeStyles(
|
||||
fontWeight: theme.typography.fontWeightBold,
|
||||
color: theme.palette.textContrast,
|
||||
},
|
||||
overlaySmall: {
|
||||
fontSize: theme.typography.pxToRem(25),
|
||||
},
|
||||
description: {
|
||||
fontSize: '100%',
|
||||
top: '50%',
|
||||
@@ -68,6 +72,7 @@ export type GaugeProps = {
|
||||
inverse?: boolean;
|
||||
unit?: string;
|
||||
max?: number;
|
||||
size?: 'normal' | 'small';
|
||||
description?: ReactNode;
|
||||
getColor?: GaugePropsGetColor;
|
||||
};
|
||||
@@ -121,7 +126,7 @@ export const getProgressColor: GaugePropsGetColor = ({
|
||||
|
||||
export function Gauge(props: GaugeProps) {
|
||||
const [hoverRef, setHoverRef] = useState<HTMLDivElement | null>(null);
|
||||
const { getColor = getProgressColor } = props;
|
||||
const { getColor = getProgressColor, size = 'normal' } = props;
|
||||
const classes = useStyles(props);
|
||||
const { palette } = useTheme();
|
||||
const { value, fractional, inverse, unit, max, description } = {
|
||||
@@ -165,7 +170,11 @@ export function Gauge(props: GaugeProps) {
|
||||
{description && isHovering ? (
|
||||
<Box className={classes.description}>{description}</Box>
|
||||
) : (
|
||||
<Box className={classes.overlay}>
|
||||
<Box
|
||||
className={classNames(classes.overlay, {
|
||||
[classes.overlaySmall]: size === 'small',
|
||||
})}
|
||||
>
|
||||
{isNaN(value) ? 'N/A' : `${asActual}${unit}`}
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -175,6 +175,91 @@ export const InfoMessage = () => (
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
export const AlignedBottom = () => (
|
||||
<Wrapper>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
title="Progress"
|
||||
subheader="With a subheader"
|
||||
progress={0.3}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
title="Progress"
|
||||
subheader="With a subheader"
|
||||
progress={0.57}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
title="Progress with longer title"
|
||||
subheader="With a subheader"
|
||||
progress={0.89}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
title="Progress"
|
||||
subheader="With a subheader"
|
||||
inverse
|
||||
progress={0.2}
|
||||
/>
|
||||
</Grid>
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
export const Small = () => (
|
||||
<Wrapper>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
size="small"
|
||||
title="Progress"
|
||||
progress={0.3}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
size="small"
|
||||
title="Progress"
|
||||
subheader="With a subheader"
|
||||
progress={0.57}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
size="small"
|
||||
title="Progress, longer title"
|
||||
progress={0.89}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<GaugeCard
|
||||
variant="fullHeight"
|
||||
alignGauge="bottom"
|
||||
size="small"
|
||||
title="Progress"
|
||||
inverse
|
||||
progress={0.2}
|
||||
/>
|
||||
</Grid>
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
export const HoverMessage = () => (
|
||||
<Wrapper>
|
||||
<Grid item>
|
||||
|
||||
@@ -27,6 +27,8 @@ type Props = {
|
||||
variant?: InfoCardVariants;
|
||||
/** Progress in % specified as decimal, e.g. "0.23" */
|
||||
progress: number;
|
||||
alignGauge?: 'normal' | 'bottom';
|
||||
size?: 'normal' | 'small';
|
||||
description?: ReactNode;
|
||||
icon?: ReactNode;
|
||||
inverse?: boolean;
|
||||
@@ -43,6 +45,10 @@ const useStyles = makeStyles(
|
||||
height: '100%',
|
||||
width: 250,
|
||||
},
|
||||
rootSmall: {
|
||||
height: '100%',
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
{ name: 'BackstageGaugeCard' },
|
||||
);
|
||||
@@ -64,6 +70,8 @@ export function GaugeCard(props: Props) {
|
||||
description,
|
||||
icon,
|
||||
variant,
|
||||
alignGauge = 'normal',
|
||||
size = 'normal',
|
||||
getColor,
|
||||
} = props;
|
||||
|
||||
@@ -75,15 +83,22 @@ export function GaugeCard(props: Props) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className={classes.root}>
|
||||
<Box className={size === 'small' ? classes.rootSmall : classes.root}>
|
||||
<InfoCard
|
||||
title={title}
|
||||
subheader={subheader}
|
||||
deepLink={deepLink}
|
||||
variant={variant}
|
||||
alignContent={alignGauge}
|
||||
icon={icon}
|
||||
titleTypographyProps={{
|
||||
...(size === 'small' ? { variant: 'subtitle2' } : undefined),
|
||||
}}
|
||||
subheaderTypographyProps={{
|
||||
...(size === 'small' ? { variant: 'body2' } : undefined),
|
||||
}}
|
||||
>
|
||||
<Gauge {...gaugeProps} />
|
||||
<Gauge {...gaugeProps} size={size} />
|
||||
</InfoCard>
|
||||
</Box>
|
||||
);
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2024 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 React from 'react';
|
||||
import { ResponseErrorPanel } from '../ResponseErrorPanel';
|
||||
import { ErrorPanelProps } from '../ErrorPanel';
|
||||
|
||||
export default {
|
||||
title: 'Data Display/ResponseErrorPanel',
|
||||
component: ResponseErrorPanel,
|
||||
};
|
||||
|
||||
export const Default = (args: ErrorPanelProps) => (
|
||||
<ResponseErrorPanel {...args} />
|
||||
);
|
||||
Default.args = {
|
||||
error: new Error('Error message from error object'),
|
||||
defaultExpanded: false,
|
||||
};
|
||||
|
||||
export const WithTitle = (args: ErrorPanelProps) => (
|
||||
<ResponseErrorPanel {...args} />
|
||||
);
|
||||
WithTitle.args = {
|
||||
error: new Error('test'),
|
||||
defaultExpanded: false,
|
||||
title: 'Title prop is passed',
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2024 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 React from 'react';
|
||||
import { BottomLink } from '../BottomLink';
|
||||
|
||||
export default {
|
||||
title: 'Layout/BottomLink',
|
||||
component: BottomLink,
|
||||
};
|
||||
|
||||
export const Default = (args: { link: string; title: string }) => (
|
||||
<BottomLink {...args} />
|
||||
);
|
||||
Default.args = {
|
||||
link: 'https://google.com',
|
||||
title: 'This is bottom link',
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2024 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 React, { ReactNode } from 'react';
|
||||
import { ContentHeader } from '../ContentHeader';
|
||||
|
||||
export default {
|
||||
title: 'Layout/ContentHeader',
|
||||
component: ContentHeader,
|
||||
};
|
||||
|
||||
type ContentHeaderProps = {
|
||||
title?: string;
|
||||
titleComponent?: ReactNode;
|
||||
description?: string;
|
||||
textAlign?: 'left' | 'right' | 'center';
|
||||
};
|
||||
|
||||
export const Default = (args: ContentHeaderProps) => (
|
||||
<ContentHeader {...args}>
|
||||
<div>Child of Content Header</div>
|
||||
</ContentHeader>
|
||||
);
|
||||
Default.args = {
|
||||
title: 'This is Content Header default aligned',
|
||||
description: 'This is description',
|
||||
};
|
||||
|
||||
export const Left = (args: ContentHeaderProps) => (
|
||||
<ContentHeader {...args}>
|
||||
<div>Child of Content Header</div>
|
||||
</ContentHeader>
|
||||
);
|
||||
Left.args = {
|
||||
title: 'This is Content Header left aligned',
|
||||
description: 'This is description',
|
||||
textAlign: 'left',
|
||||
};
|
||||
|
||||
export const Right = (args: ContentHeaderProps) => (
|
||||
<ContentHeader {...args}>
|
||||
<div>Child of Content Header</div>
|
||||
</ContentHeader>
|
||||
);
|
||||
Right.args = {
|
||||
title: 'This is Content Header right aligned',
|
||||
description: 'This is description',
|
||||
textAlign: 'right',
|
||||
};
|
||||
|
||||
export const Center = (args: ContentHeaderProps) => (
|
||||
<ContentHeader {...args}>
|
||||
<div>Child of Content Header</div>
|
||||
</ContentHeader>
|
||||
);
|
||||
Center.args = {
|
||||
title: 'This is Content Header center aligned',
|
||||
description: 'This is description',
|
||||
textAlign: 'center',
|
||||
};
|
||||
@@ -43,6 +43,10 @@ const useStyles = makeStyles(
|
||||
paddingBottom: 0,
|
||||
},
|
||||
},
|
||||
contentAlignBottom: {
|
||||
display: 'flex',
|
||||
alignItems: 'self-end',
|
||||
},
|
||||
header: {
|
||||
padding: theme.spacing(2, 2, 2, 2.5),
|
||||
},
|
||||
@@ -138,6 +142,7 @@ export type Props = {
|
||||
slackChannel?: string;
|
||||
errorBoundaryProps?: ErrorBoundaryProps;
|
||||
variant?: InfoCardVariants;
|
||||
alignContent?: 'normal' | 'bottom';
|
||||
children?: ReactNode;
|
||||
headerStyle?: object;
|
||||
headerProps?: CardHeaderProps;
|
||||
@@ -150,6 +155,7 @@ export type Props = {
|
||||
className?: string;
|
||||
noPadding?: boolean;
|
||||
titleTypographyProps?: object;
|
||||
subheaderTypographyProps?: object;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -167,6 +173,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
slackChannel,
|
||||
errorBoundaryProps,
|
||||
variant,
|
||||
alignContent = 'normal',
|
||||
children,
|
||||
headerStyle,
|
||||
headerProps,
|
||||
@@ -179,6 +186,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
className,
|
||||
noPadding,
|
||||
titleTypographyProps,
|
||||
subheaderTypographyProps,
|
||||
} = props;
|
||||
const classes = useStyles();
|
||||
/**
|
||||
@@ -209,10 +217,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classes.headerSubheader}
|
||||
data-testid="info-card-subheader"
|
||||
>
|
||||
<div data-testid="info-card-subheader">
|
||||
{subheader && <div className={classes.subheader}>{subheader}</div>}
|
||||
{icon}
|
||||
</div>
|
||||
@@ -228,7 +233,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
{title && (
|
||||
<CardHeader
|
||||
classes={{
|
||||
root: classes.header,
|
||||
root: classNames(classes.header),
|
||||
title: classes.headerTitle,
|
||||
subheader: classes.headerSubheader,
|
||||
avatar: classes.headerAvatar,
|
||||
@@ -240,6 +245,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
action={action}
|
||||
style={{ ...headerStyle }}
|
||||
titleTypographyProps={titleTypographyProps}
|
||||
subheaderTypographyProps={subheaderTypographyProps}
|
||||
{...headerProps}
|
||||
/>
|
||||
)}
|
||||
@@ -250,6 +256,7 @@ export function InfoCard(props: Props): JSX.Element {
|
||||
<CardContent
|
||||
className={classNames(cardClassName, {
|
||||
[classes.noPadding]: noPadding,
|
||||
[classes.contentAlignBottom]: alignContent === 'bottom',
|
||||
})}
|
||||
style={calculatedCardStyle}
|
||||
>
|
||||
|
||||
@@ -513,6 +513,17 @@ export function getGitLabRequestOptions(config: GitLabIntegrationConfig): {
|
||||
headers: Record<string, string>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export function getHarnessFileContentsUrl(
|
||||
config: HarnessIntegrationConfig,
|
||||
url: string,
|
||||
): string;
|
||||
|
||||
// @public
|
||||
export function getHarnessRequestOptions(config: HarnessIntegrationConfig): {
|
||||
headers?: Record<string, string>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class GiteaIntegration implements ScmIntegration {
|
||||
constructor(config: GiteaIntegrationConfig);
|
||||
@@ -674,6 +685,34 @@ export type GoogleGcsIntegrationConfig = {
|
||||
privateKey?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class HarnessIntegration implements ScmIntegration {
|
||||
constructor(config: HarnessIntegrationConfig);
|
||||
// (undocumented)
|
||||
readonly config: HarnessIntegrationConfig;
|
||||
// (undocumented)
|
||||
static factory: ScmIntegrationsFactory<HarnessIntegration>;
|
||||
// (undocumented)
|
||||
resolveEditUrl(url: string): string;
|
||||
// (undocumented)
|
||||
resolveUrl(options: {
|
||||
url: string;
|
||||
base: string;
|
||||
lineNumber?: number | undefined;
|
||||
}): string;
|
||||
// (undocumented)
|
||||
get title(): string;
|
||||
// (undocumented)
|
||||
get type(): string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type HarnessIntegrationConfig = {
|
||||
host: string;
|
||||
token?: string;
|
||||
apiKey?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface IntegrationsByType {
|
||||
// (undocumented)
|
||||
@@ -696,6 +735,8 @@ export interface IntegrationsByType {
|
||||
github: ScmIntegrationsGroup<GithubIntegration>;
|
||||
// (undocumented)
|
||||
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
||||
// (undocumented)
|
||||
harness: ScmIntegrationsGroup<HarnessIntegration>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -839,6 +880,9 @@ export function readGoogleGcsIntegrationConfig(
|
||||
config: Config,
|
||||
): GoogleGcsIntegrationConfig;
|
||||
|
||||
// @public
|
||||
export function readHarnessConfig(config: Config): HarnessIntegrationConfig;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export const replaceGitHubUrlType: typeof replaceGithubUrlType;
|
||||
|
||||
@@ -889,6 +933,8 @@ export interface ScmIntegrationRegistry
|
||||
github: ScmIntegrationsGroup<GithubIntegration>;
|
||||
// (undocumented)
|
||||
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
||||
// (undocumented)
|
||||
harness: ScmIntegrationsGroup<HarnessIntegration>;
|
||||
resolveEditUrl(url: string): string;
|
||||
resolveUrl(options: {
|
||||
url: string;
|
||||
@@ -927,6 +973,8 @@ export class ScmIntegrations implements ScmIntegrationRegistry {
|
||||
// (undocumented)
|
||||
get gitlab(): ScmIntegrationsGroup<GitLabIntegration>;
|
||||
// (undocumented)
|
||||
get harness(): ScmIntegrationsGroup<HarnessIntegration>;
|
||||
// (undocumented)
|
||||
list(): ScmIntegration[];
|
||||
// (undocumented)
|
||||
resolveEditUrl(url: string): string;
|
||||
|
||||
Vendored
+18
@@ -345,5 +345,23 @@ export interface Config {
|
||||
*/
|
||||
password?: string;
|
||||
}>;
|
||||
/** Integration configuration for Harness Code */
|
||||
harness?: Array<{
|
||||
/**
|
||||
* The hostname of the given Harness Code instance
|
||||
* @visibility frontend
|
||||
*/
|
||||
host: string;
|
||||
/**
|
||||
* The apikey to use for authenticated requests.
|
||||
* @visibility secret
|
||||
*/
|
||||
apiKey?: string;
|
||||
/**
|
||||
* Harness Code token used to authenticate requests. This can be either a generated access token.
|
||||
* @visibility secret
|
||||
*/
|
||||
token?: string;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import { ScmIntegrations } from './ScmIntegrations';
|
||||
import { GiteaIntegration, GiteaIntegrationConfig } from './gitea';
|
||||
import { AwsCodeCommitIntegration } from './awsCodeCommit/AwsCodeCommitIntegration';
|
||||
import { AwsCodeCommitIntegrationConfig } from './awsCodeCommit';
|
||||
import { HarnessIntegration, HarnessIntegrationConfig } from './harness';
|
||||
|
||||
describe('ScmIntegrations', () => {
|
||||
const awsS3 = new AwsS3Integration({
|
||||
@@ -80,6 +81,10 @@ describe('ScmIntegrations', () => {
|
||||
host: 'gitea.local',
|
||||
} as GiteaIntegrationConfig);
|
||||
|
||||
const harness = new HarnessIntegration({
|
||||
host: 'harness.local',
|
||||
} as HarnessIntegrationConfig);
|
||||
|
||||
const i = new ScmIntegrations({
|
||||
awsS3: basicIntegrations([awsS3], item => item.config.host),
|
||||
awsCodeCommit: basicIntegrations([awsCodeCommit], item => item.config.host),
|
||||
@@ -94,6 +99,7 @@ describe('ScmIntegrations', () => {
|
||||
github: basicIntegrations([github], item => item.config.host),
|
||||
gitlab: basicIntegrations([gitlab], item => item.config.host),
|
||||
gitea: basicIntegrations([gitea], item => item.config.host),
|
||||
harness: basicIntegrations([harness], item => item.config.host),
|
||||
});
|
||||
|
||||
it('can get the specifics', () => {
|
||||
@@ -113,6 +119,7 @@ describe('ScmIntegrations', () => {
|
||||
expect(i.github.byUrl('https://github.local')).toBe(github);
|
||||
expect(i.gitlab.byUrl('https://gitlab.local')).toBe(gitlab);
|
||||
expect(i.gitea.byUrl('https://gitea.local')).toBe(gitea);
|
||||
expect(i.harness.byUrl('https://harness.local')).toBe(harness);
|
||||
});
|
||||
|
||||
it('can list', () => {
|
||||
@@ -128,6 +135,7 @@ describe('ScmIntegrations', () => {
|
||||
github,
|
||||
gitlab,
|
||||
gitea,
|
||||
harness,
|
||||
]),
|
||||
);
|
||||
});
|
||||
@@ -143,6 +151,7 @@ describe('ScmIntegrations', () => {
|
||||
expect(i.byUrl('https://github.local')).toBe(github);
|
||||
expect(i.byUrl('https://gitlab.local')).toBe(gitlab);
|
||||
expect(i.byUrl('https://gitea.local')).toBe(gitea);
|
||||
expect(i.byUrl('https://harness.local')).toBe(harness);
|
||||
|
||||
expect(i.byHost('awss3.local')).toBe(awsS3);
|
||||
expect(i.byHost('awscodecommit.local')).toBe(awsCodeCommit);
|
||||
|
||||
@@ -28,6 +28,7 @@ import { defaultScmResolveUrl } from './helpers';
|
||||
import { ScmIntegration, ScmIntegrationsGroup } from './types';
|
||||
import { ScmIntegrationRegistry } from './registry';
|
||||
import { GiteaIntegration } from './gitea';
|
||||
import { HarnessIntegration } from './harness/HarnessIntegration';
|
||||
|
||||
/**
|
||||
* The set of supported integrations.
|
||||
@@ -48,6 +49,7 @@ export interface IntegrationsByType {
|
||||
github: ScmIntegrationsGroup<GithubIntegration>;
|
||||
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
||||
gitea: ScmIntegrationsGroup<GiteaIntegration>;
|
||||
harness: ScmIntegrationsGroup<HarnessIntegration>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +72,7 @@ export class ScmIntegrations implements ScmIntegrationRegistry {
|
||||
github: GithubIntegration.factory({ config }),
|
||||
gitlab: GitLabIntegration.factory({ config }),
|
||||
gitea: GiteaIntegration.factory({ config }),
|
||||
harness: HarnessIntegration.factory({ config }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,6 +123,10 @@ export class ScmIntegrations implements ScmIntegrationRegistry {
|
||||
return this.byType.gitea;
|
||||
}
|
||||
|
||||
get harness(): ScmIntegrationsGroup<HarnessIntegration> {
|
||||
return this.byType.harness;
|
||||
}
|
||||
|
||||
list(): ScmIntegration[] {
|
||||
return Object.values(this.byType).flatMap(
|
||||
i => i.list() as ScmIntegration[],
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2024 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 { ConfigReader } from '@backstage/config';
|
||||
import { HarnessIntegration } from './HarnessIntegration';
|
||||
|
||||
describe('HarnessIntegration', () => {
|
||||
it('has a working factory', () => {
|
||||
const integrations = HarnessIntegration.factory({
|
||||
config: new ConfigReader({
|
||||
integrations: {
|
||||
harness: [
|
||||
{
|
||||
host: 'app.harness.io',
|
||||
token: '1234',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
expect(integrations.list().length).toBe(1);
|
||||
expect(integrations.list()[0].config.host).toBe('app.harness.io');
|
||||
});
|
||||
|
||||
it('returns the basics', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
expect(integration.type).toBe('harness');
|
||||
expect(integration.title).toBe('app.harness.io');
|
||||
});
|
||||
|
||||
describe('resolveUrl', () => {
|
||||
it('works for valid urls, ignoring line number', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
|
||||
expect(
|
||||
integration.resolveUrl({
|
||||
url: 'https://app.harness.io/catalog-info.yaml',
|
||||
base: 'https://app.harness.io/catalog-info.yaml',
|
||||
lineNumber: 9,
|
||||
}),
|
||||
).toBe('https://app.harness.io/catalog-info.yaml');
|
||||
});
|
||||
|
||||
it('handles line numbers', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
|
||||
expect(
|
||||
integration.resolveUrl({
|
||||
url: '',
|
||||
base: 'https://app.harness.io/catalog-info.yaml#4',
|
||||
lineNumber: 9,
|
||||
}),
|
||||
).toBe('https://app.harness.io/catalog-info.yaml#L9');
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolves with a relative url', () => {
|
||||
it('works for valid urls', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
|
||||
expect(
|
||||
integration.resolveUrl({
|
||||
url: './skeleton',
|
||||
base: 'https://app.harness.io/git/plugins/repo/+/refs/heads/master/template.yaml',
|
||||
}),
|
||||
).toBe(
|
||||
'https://app.harness.io/git/plugins/repo/+/refs/heads/master/skeleton',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolves with an absolute url', () => {
|
||||
it('works for valid urls', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
|
||||
expect(
|
||||
integration.resolveUrl({
|
||||
url: '/catalog-info.yaml',
|
||||
base: 'https://app.harness.io/git/repo/+/refs/heads/master/',
|
||||
}),
|
||||
).toBe(
|
||||
'https://app.harness.io/git/repo/+/refs/heads/master/catalog-info.yaml',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('resolve edit URL', () => {
|
||||
const integration = new HarnessIntegration({
|
||||
host: 'app.harness.io',
|
||||
});
|
||||
|
||||
expect(
|
||||
integration.resolveEditUrl(
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/edit/refMain/~/all-apis.yaml',
|
||||
),
|
||||
).toBe(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/edit/all-apis.yaml',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2024 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 { basicIntegrations, defaultScmResolveUrl } from '../helpers';
|
||||
import { ScmIntegration, ScmIntegrationsFactory } from '../types';
|
||||
import { HarnessIntegrationConfig, readHarnessConfig } from './config';
|
||||
import { getHarnessEditContentsUrl } from './core';
|
||||
|
||||
/**
|
||||
* A Harness Code based integration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class HarnessIntegration implements ScmIntegration {
|
||||
static factory: ScmIntegrationsFactory<HarnessIntegration> = ({ config }) => {
|
||||
const configs = config.getOptionalConfigArray('integrations.harness') ?? [];
|
||||
const harnessConfigs = configs.map(c => readHarnessConfig(c));
|
||||
|
||||
return basicIntegrations(
|
||||
harnessConfigs.map(c => new HarnessIntegration(c)),
|
||||
(harness: HarnessIntegration) => harness.config.host,
|
||||
);
|
||||
};
|
||||
|
||||
constructor(readonly config: HarnessIntegrationConfig) {}
|
||||
|
||||
get type(): string {
|
||||
return 'harness';
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this.config.host;
|
||||
}
|
||||
|
||||
resolveUrl(options: {
|
||||
url: string;
|
||||
base: string;
|
||||
lineNumber?: number | undefined;
|
||||
}): string {
|
||||
return defaultScmResolveUrl(options);
|
||||
}
|
||||
|
||||
resolveEditUrl(url: string): string {
|
||||
return getHarnessEditContentsUrl(this.config, url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2024 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 { Config, ConfigReader } from '@backstage/config';
|
||||
import { loadConfigSchema } from '@backstage/config-loader';
|
||||
import { HarnessIntegrationConfig, readHarnessConfig } from './config';
|
||||
|
||||
describe('readHarnessConfig', () => {
|
||||
function buildConfig(data: Partial<HarnessIntegrationConfig>): Config {
|
||||
return new ConfigReader(data);
|
||||
}
|
||||
|
||||
async function buildFrontendConfig(
|
||||
data: Partial<HarnessIntegrationConfig>,
|
||||
): Promise<Config> {
|
||||
const fullSchema = await loadConfigSchema({
|
||||
dependencies: ['@backstage/integration'],
|
||||
});
|
||||
const serializedSchema = fullSchema.serialize() as {
|
||||
schemas: { value: { properties?: { integrations?: object } } }[];
|
||||
};
|
||||
const schema = await loadConfigSchema({
|
||||
serialized: {
|
||||
...serializedSchema, // only include schemas that apply to integrations
|
||||
schemas: serializedSchema.schemas.filter(
|
||||
s => s.value?.properties?.integrations,
|
||||
),
|
||||
},
|
||||
});
|
||||
const processed = schema.process(
|
||||
[{ data: { integrations: { harness: [data] } }, context: 'app' }],
|
||||
{ visibility: ['frontend'] },
|
||||
);
|
||||
return new ConfigReader((processed[0].data as any).integrations.harness[0]);
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
const output = readHarnessConfig(
|
||||
buildConfig({
|
||||
host: 'a.com',
|
||||
token: 'p',
|
||||
apiKey: 'a',
|
||||
}),
|
||||
);
|
||||
expect(output).toEqual({
|
||||
host: 'a.com',
|
||||
token: 'p',
|
||||
apiKey: 'a',
|
||||
});
|
||||
});
|
||||
|
||||
it('can create a default value if the API base URL is missing', () => {
|
||||
const output = readHarnessConfig(
|
||||
buildConfig({
|
||||
host: 'a.com',
|
||||
}),
|
||||
);
|
||||
expect(output).toEqual({
|
||||
host: 'a.com',
|
||||
token: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects funky configs', () => {
|
||||
const valid: any = {
|
||||
host: 'a.com',
|
||||
};
|
||||
expect(() => readHarnessConfig(buildConfig({ ...valid, host: 2 }))).toThrow(
|
||||
/host/,
|
||||
);
|
||||
});
|
||||
|
||||
it('works on the frontend', async () => {
|
||||
expect(
|
||||
readHarnessConfig(
|
||||
await buildFrontendConfig({
|
||||
host: 'a.com',
|
||||
token: 'p',
|
||||
}),
|
||||
),
|
||||
).toEqual({
|
||||
host: 'a.com',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2024 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 { Config } from '@backstage/config';
|
||||
import { isValidHost } from '../helpers';
|
||||
|
||||
/**
|
||||
* The configuration for a single Harness integration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type HarnessIntegrationConfig = {
|
||||
/**
|
||||
* The host of the target that this matches on, e.g. "app.harness.io"
|
||||
*/
|
||||
host: string;
|
||||
/**
|
||||
* The password or http token to use for authentication.
|
||||
*/
|
||||
token?: string;
|
||||
/**
|
||||
* The API key to use for authentication.
|
||||
*/
|
||||
apiKey?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a location config block for use in HarnessIntegration
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function readHarnessConfig(config: Config): HarnessIntegrationConfig {
|
||||
const host = config.getString('host');
|
||||
const token = config.getOptionalString('token');
|
||||
const apiKey = config.getOptionalString('apiKey');
|
||||
|
||||
if (!isValidHost(host)) {
|
||||
throw new Error(
|
||||
`Invalid Harness Code integration config, '${host}' is not a valid host`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
host,
|
||||
apiKey,
|
||||
token,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 { setupServer } from 'msw/node';
|
||||
import { setupRequestMockHandlers } from '../helpers';
|
||||
import { HarnessIntegrationConfig } from './config';
|
||||
import {
|
||||
getHarnessEditContentsUrl,
|
||||
getHarnessFileContentsUrl,
|
||||
getHarnessRequestOptions,
|
||||
} from './core';
|
||||
|
||||
describe('Harness code core', () => {
|
||||
const worker = setupServer();
|
||||
setupRequestMockHandlers(worker);
|
||||
|
||||
describe('getHarnessFileContentsUrl', () => {
|
||||
it('can create an url from arguments', () => {
|
||||
const config: HarnessIntegrationConfig = {
|
||||
host: 'app.harness.io',
|
||||
};
|
||||
expect(
|
||||
getHarnessFileContentsUrl(
|
||||
config,
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml',
|
||||
),
|
||||
).toEqual(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/raw/all-apis.yaml?routingId=accountId&git_ref=refMain',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getHarnessEditContentsUrl', () => {
|
||||
it('can create an url from arguments', () => {
|
||||
const config: HarnessIntegrationConfig = {
|
||||
host: 'app.harness.io',
|
||||
};
|
||||
expect(
|
||||
getHarnessEditContentsUrl(
|
||||
config,
|
||||
'https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/edit/refMain/~/all-apis.yaml',
|
||||
),
|
||||
).toEqual(
|
||||
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/edit/all-apis.yaml',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getHarnessRequestOptions', () => {
|
||||
it('adds token header when only a token is specified', () => {
|
||||
const authRequest: HarnessIntegrationConfig = {
|
||||
host: 'app.harness.io',
|
||||
token: 'P',
|
||||
};
|
||||
const anonymousRequest: HarnessIntegrationConfig = {
|
||||
host: 'app.harness.io',
|
||||
};
|
||||
expect(
|
||||
(getHarnessRequestOptions(authRequest).headers as any).Authorization,
|
||||
).toEqual('Bearer P');
|
||||
expect(getHarnessRequestOptions(anonymousRequest).headers).toStrictEqual(
|
||||
{},
|
||||
);
|
||||
});
|
||||
|
||||
it('adds basic auth when apikey and token are specified', () => {
|
||||
const authRequest: HarnessIntegrationConfig = {
|
||||
host: 'app.harness.io',
|
||||
token: 'P',
|
||||
apiKey: 'a',
|
||||
};
|
||||
|
||||
expect(
|
||||
(getHarnessRequestOptions(authRequest).headers as any)['x-api-key'],
|
||||
).toEqual('a');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright 2024 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 { HarnessIntegrationConfig } from './config';
|
||||
|
||||
/**
|
||||
* Given a URL pointing to a file, returns a URL
|
||||
* for editing the contents of the data.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* Converts
|
||||
* from: https://app.harness.io/a/b/src/branchname/path/to/c.yaml
|
||||
* or: https://app.harness.io/a/b/_edit/branchname/path/to/c.yaml
|
||||
*
|
||||
* @param url - A URL pointing to a file
|
||||
* @param config - The relevant provider config
|
||||
* @public
|
||||
*/
|
||||
export function getHarnessEditContentsUrl(
|
||||
config: HarnessIntegrationConfig,
|
||||
url: string,
|
||||
) {
|
||||
try {
|
||||
const baseUrl = `https://${config.host}`;
|
||||
const [
|
||||
_blank,
|
||||
_ng,
|
||||
_account,
|
||||
accountId,
|
||||
_module,
|
||||
_moduleName,
|
||||
_org,
|
||||
orgName,
|
||||
_projects,
|
||||
projectName,
|
||||
_repos,
|
||||
repoName,
|
||||
_files,
|
||||
_ref,
|
||||
_branch,
|
||||
...path
|
||||
] = url.replace(baseUrl, '').split('/');
|
||||
const pathWithoutSlash = path.join('/').replace(/^\//, '');
|
||||
return `${baseUrl}/gateway/code/api/v1/repos/${accountId}/${orgName}/${projectName}/${repoName}/+/edit/${pathWithoutSlash}`;
|
||||
} catch (e) {
|
||||
throw new Error(`Incorrect URL: ${url}, ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a file path URL,
|
||||
* it returns an API URL which returns the contents of the file.
|
||||
* @remarks
|
||||
*
|
||||
* Converts
|
||||
* from: https://app.harness.io/ng/account/accountId/module/code/orgs/orgName/projects/projName/repos/repoName/files/refMain/~/all-apis.yaml
|
||||
* to: https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/+/content/all-apis.yaml?routingId=accountId&include_commit=false&ref=refMain
|
||||
*
|
||||
* @param url - A URL pointing to a file
|
||||
* @param config - The relevant provider config
|
||||
* @public
|
||||
*/
|
||||
export function getHarnessFileContentsUrl(
|
||||
config: HarnessIntegrationConfig,
|
||||
url: string,
|
||||
) {
|
||||
try {
|
||||
const baseUrl = `https://${config.host}`;
|
||||
const [
|
||||
_blank,
|
||||
_ng,
|
||||
_account,
|
||||
accountId,
|
||||
_module,
|
||||
_moduleName,
|
||||
_org,
|
||||
orgName,
|
||||
_projects,
|
||||
projectName,
|
||||
_repos,
|
||||
repoName,
|
||||
_files,
|
||||
_ref,
|
||||
_branch,
|
||||
...path
|
||||
] = url.replace(baseUrl, '').split('/');
|
||||
const urlParts = url.replace(baseUrl, '').split('/');
|
||||
const refAndPath = urlParts.slice(13);
|
||||
const refIndex = refAndPath.findIndex(item => item === '~');
|
||||
const refString = refAndPath.slice(0, refIndex);
|
||||
const pathWithoutSlash = path.join('/').replace(/^\//, '');
|
||||
return `${baseUrl}/gateway/code/api/v1/repos/${accountId}/${orgName}/${projectName}/${repoName}/+/raw/${pathWithoutSlash}?routingId=${accountId}&git_ref=${refString}`;
|
||||
} catch (e) {
|
||||
throw new Error(`Incorrect URL: ${url}, ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return request headers for a Harness Code provider.
|
||||
*
|
||||
* @param config - A Harness Code provider config
|
||||
* @public
|
||||
*/
|
||||
export function getHarnessRequestOptions(config: HarnessIntegrationConfig): {
|
||||
headers?: Record<string, string>;
|
||||
} {
|
||||
const headers: Record<string, string> = {};
|
||||
const { token, apiKey } = config;
|
||||
|
||||
if (apiKey) {
|
||||
headers['x-api-key'] = apiKey;
|
||||
} else if (token) {
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
return {
|
||||
headers,
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user