Merge branch 'backstage:master' into docs/scaffolder-input-examples

This commit is contained in:
Gabriel Dantas Gomes
2022-11-03 11:55:23 -03:00
committed by GitHub
93 changed files with 1583 additions and 560 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ Settings for local development:
- Application name: Backstage (or your custom app name)
- Homepage URL: `http://localhost:3000`
- Authorization callback URL: `http://localhost:7007/api/auth/github`
- Authorization callback URL: `http://localhost:7007/api/auth/github/handler/frame`
## Configuration
+1 -1
View File
@@ -49,7 +49,7 @@ A user identity within Backstage is built up from two pieces of information, a
user [entity reference](../features/software-catalog/references.md), and a
set of ownership entity references.
When a user signs in, a Backstage token is generated with these two pieces of information,
which is then used to identity the user within the Backstage ecosystem.
which is then used to identify the user within the Backstage ecosystem.
The user entity reference should uniquely identify the logged in user in Backstage.
It is encouraged that a matching user entity also exists within the Software Catalog,
@@ -261,6 +261,129 @@ the `connect` call has been made to the provider.
Start up the backend - it should now start reading from the previously
registered location and you'll see your entities start to appear in Backstage.
### Example User Entity Provider
If you have a 3rd party entity provider such as an internal HR system that you wish to use you are not limited to using our entity providers, (or simply wish to add to existing entity providers with your own data).
We can create an entity provider to read entities that are based off that provider.
We create a basic entity provider as shown above. In the example below we might want to extract our users from an HR system, I am assuming the HR system already has the slackUserId to get that information please see the [Slack Api](https://api.slack.com/methods).
```typescript
import {
ANNOTATION_LOCATION,
ANNOTATION_ORIGIN_LOCATION,
} from '@backstage/catalog-model'
import {
EntityProvider,
EntityProviderConnection,
} from '@backstage/plugin-catalog-backend'
import { WebClient } from '@slack/web-api'
import {kebabCase} from 'lodash'
interface Staff {
displayName: string
slackUserId: string
jobTitle: string
photoUrl: string
address: string
email:string
}
export class UserEntityProvider implements EntityProvider {
private readonly getStaffUrl: string
protected readonly slackTeam: string
protected readonly slackToken: string
protected connection?: EntityProviderConnection
static fromConfig(config: Config, options: { logger: Logger }) {
const getStaffUrl = config.getString('staff.url')
const slackToken = config.getString('slack.token')
const slackTeam = config.getString('slack.team')
return new UserEntityProvider({
...options,
getStaffUrl,
slackToken,
slackTeam,
})
}
private constructor(options: {
getStaffUrl: string
slackToken: string
slackTeam: string
}) {
this.getStaffUrl = options.getStaffUrl
this.slackToken = options.slackToken
this.slackTeam = options.slackTeam
}
async getAllStaff(): Promise<Staff[]>{
await return axios.get(this.getStaffUrl)
}
public async connect(connection: EntityProviderConnection): Promise<void> {
this.connection = connection
}
async run(): Promise<void> {
if (!this.connection) {
throw new Error('User Connection Not initialized')
}
const userResources: UserEntity[] = []
const staff = await this.getAllStaff()
for (const user of staff) {
// we can add any links here in this case it would be adding a slack link to the users so you can directly slack them.
const links =
user.slackUserId != null && user.slackUserId.length > 0
? [
{
url: `slack://user?team=${this.slackTeam}&id=${user.slackUserId}`,
title: 'Slack',
icon: 'message',
},
]
: undefined
const userEntity: UserEntity = {
kind: 'User',
apiVersion: 'backstage.io/v1alpha1',
metadata: {
annotations: {
[ANNOTATION_LOCATION]: 'hr-user-https://www.hrurl.com/',
[ANNOTATION_ORIGIN_LOCATION]: 'hr-user-https://www.hrurl.com/',
},
links,
// name of the entity
name: kebabCase(user.displayName),
// name for display purposes could be anything including email
title: user.displayName,
},
spec: {
profile: {
displayName: user.displayName,
email: user.email,
picture: user.photoUrl,
},
memberOf: [],
},
}
userResources.push(userEntity)
}
await this.connection.applyMutation({
type: 'full',
entities: userResources.map((entity) => ({
entity,
locationKey: 'hr-user-https://www.hrurl.com/',
})),
})
}
```
## Custom Processors
The other possible way of ingesting data into the catalog is through the use of
+1 -1
View File
@@ -249,7 +249,7 @@ however likely to change in the future.
The common packages are the packages effectively depended on by all other pages.
This is a much smaller set of packages but they are also very pervasive. Because
the common packages are isomorphic and must execute both in the frontend and
backend, they are never allowed to depend on any of the frontend of backend
backend, they are never allowed to depend on any of the frontend or backend
packages.
The Backstage CLI is in a category of its own and is depended on by virtually
+106
View File
@@ -0,0 +1,106 @@
# Release v1.8.0-next.1
## @backstage/plugin-scaffolder-backend@1.8.0-next.1
### Minor Changes
- 5921b5ce49: - The GitLab Project ID for the `publish:gitlab:merge-request` action is now passed through the query parameter `project` in the `repoUrl`. It still allows people to not use the `projectid` and use the `repoUrl` with the `owner` and `repo` query parameters instead. This makes it easier to publish to repositories instead of writing the full path to the project.
## @backstage/create-app@0.4.33-next.1
### Patch Changes
- Bumped create-app version.
## @backstage/plugin-azure-devops-backend@0.3.17-next.1
### Patch Changes
- 62f284e394: - Adjusted the asset parser to accept case sensitive
- Fixed fetching data that was using the deprecated function
## @backstage/plugin-playlist@0.1.2-next.1
### Patch Changes
- 605f269f0d: Updated Playlist plugin docs:
- Updated `playlist` plugin README to include note about installing backend plugin and added images for the various features
- Updated `playlist-backend` plugin README to remove `IdentityClient` import in example as it is not used and made minor change to headings
## @backstage/plugin-playlist-backend@0.2.1-next.1
### Patch Changes
- 605f269f0d: Updated Playlist plugin docs:
- Updated `playlist` plugin README to include note about installing backend plugin and added images for the various features
- Updated `playlist-backend` plugin README to remove `IdentityClient` import in example as it is not used and made minor change to headings
## @backstage/plugin-scaffolder-backend-module-cookiecutter@0.2.13-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder-backend@1.8.0-next.1
## @backstage/plugin-scaffolder-backend-module-rails@0.4.6-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder-backend@1.8.0-next.1
## @backstage/plugin-scaffolder-backend-module-yeoman@0.2.11-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder-backend@1.8.0-next.1
## @backstage/plugin-techdocs@1.4.0-next.1
### Patch Changes
- 9e4d8e6198: Fix logic bug that broke techdocs-cli-embedded-app
## @backstage/plugin-techdocs-addons-test-utils@1.0.6-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-techdocs@1.4.0-next.1
## example-app@0.2.77-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-techdocs@1.4.0-next.1
- @backstage/plugin-playlist@0.1.2-next.1
- @backstage/plugin-techdocs-module-addons-contrib@1.0.6-next.0
## example-backend@0.2.77-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder-backend@1.8.0-next.1
- @backstage/plugin-playlist-backend@0.2.1-next.1
- @backstage/plugin-azure-devops-backend@0.3.17-next.1
- example-app@0.2.77-next.1
- @backstage/plugin-scaffolder-backend-module-rails@0.4.6-next.1
## example-backend-next@0.0.5-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder-backend@1.8.0-next.1
## techdocs-cli-embedded-app@0.2.76-next.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-techdocs@1.4.0-next.1