Welcome to the azure-workitem backend plugin!
This plugin was created through the Backstage CLI
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running yarn start
in the root directory, wait the server to start and then acessing the plugin endpoints:
- /azure-workitem/health: This endpoint will simply return a JSON with content
{"status" : "ok"}
and requires no authentication; - /azure-workitem/hello: This endpoint will thrown a 401 error if not authenticated and can be called setting the
Authorization
header with the proper token. Once authenticated it will return a JSON with content{"message": "Hello User"}
, where User is the authenticated user. Here's an example to call it using thecurl
utility:
curl -vH "Authorization: Bearer ${RHDH_TOKEN}" http://localhost:7007/api/azure-workitem/hello
You can also serve the plugin in isolation by running yarn start
in the plugin directory.
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
It is only meant for local development, and the setup for it can be found inside the /dev directory.
This backend plugin pulls data from Azure Boards. The corresponding front end plugin for this is available in this repo (https://github.com/arunhari82/backstage-plugin-azure-workitem-dynamic.git)
setup name to include @<<username>>
```
e.g : replace @anattama with your username or enterprise name
"name": "@anattama/backstage-plugin-azure-workitem-backend",`
```
Personal access token should have the following previleges
Task Groups : Read,Write & Manage
WorkItems: Read,write & Manage
export AZURE_ORG_NAME=<<your azure org name>>
export AZURE_PERSONAL_ACCESS_TOKEN=<<Your Personal Access Token>>
yarn start
curl http://localhost:7007/api/azure-workitem/workitems/<<Azure Project Name>>
yarn tsc
yarn build
yarn export-dynamic
This file is located in home directory as a hidden file. We need to update this file to reflect the right npmregistry
Sample .npmrc file shown below In this case Azure Artifactory is being used as npmregistry but we can also uses Nexus,Jfrog artifactory.
Scope @anattama:registry
tells the npm publish
to point which registry
;//nexus-nexus.apps.cluster-jtdkc.sandbox251.opentlc.com/repository/:_authToken=<<Nexus Token>>
@anattama:registry=https://pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/registry/
always-auth=true
; begin auth token
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/registry/:username=anattama
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/registry/:_password=<<BASE64 Encoded Token>>
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/registry/:email=<<email_address>>
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/:username=anattama
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/:_password=<<BASE64 Encoded Token>>
//pkgs.dev.azure.com/anattama/_packaging/mynpmregsitry/npm/:email=<<email_address>>
; end auth token
```
npm pack --json > ./npminfo.json
```
After we execute this command the file npminfo.json
will have integrity : SHA
```
npm publish
```
This secret contains the registry information please refer to runtime section of architecture diagram above. Sample secret yaml below
kind: Secret
apiVersion: v1
metadata:
name: dynamic-plugins-npmrc
namespace: backstage
data:
.npmrc: <<BASE64 Encoded file content of .npmrc file>>
type: Opaque
Note : this secret must be named as dynamic-plugins-npmrc
and it should exists in the same namespace as devhub installed namespace.
Add the following section to the dynamic plugin configmap
- package: '@<<Username>>/backstage-plugin-azure-workitem-backend@<<Version>>'
integrity: <<SHA from npminfo.json>>
disabled: false
This plugin requires the following configuration at root level as defined in config.d.ts
file
integrations:
azure:
- host: dev.azure.com
credentials:
- personalAccessToken: ${AZURE_PERSONAL_ACCESS_TOKEN}
organizations:
- ${AZURE_ORG_NAME}