0.3.1 • Published 2 years ago

@bestsellerit/backstage-plugin-harbor v0.3.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Backstage Harbor plugin

Quality Gate Status npm

Welcome to the harbor plugin! This plugin will show you information about your docker images within harbor

Dashboard Docker Image

Getting started

Enabling frontend

cd package/app
yarn add @bestsellerit/backstage-plugin-harbor
// packages/app/src/plugins.ts
export { plugin as harbor } from '@bestsellerit/backstage-plugin-harbor';
// packages/app/src/components/catalog/EntityPage.tsx
import {
  HarborPage,
  HarborWidget,
  isHarborAvailable,
} from '@bestsellerit/backstage-plugin-harbor';

const serviceEntityPage = (
  <EntityPageLayout>
    // ...
    <EntityLayout.Route path="/harbor" title="Harbor" if={isHarborAvailable}>
      <HarborPage />
    </EntityLayout.Route>
  </EntityPageLayout>
)
// packages/app/src/components/catalog/EntityPage.tsx

const overviewContent = (
  <Grid container spacing={6} alignItems="stretch">
   // ...
  <EntityLayout>
    <EntityLayout.Route path="/harbor" title="Harbor" if={isHarborAvailable}>
      <HarborWidget />
    </EntityLayout.Route>
  </EntityLayout>
    ...
  </Grid>
);

Enabling backend

cd packages/backend
yarn add @bestsellerit/backstage-plugin-harbor-backend

Create a new file named packages/backend/src/plugins/harbor.ts, and add the following to it

import { createRouter } from '@bestsellerit/backstage-plugin-harbor-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin({
  logger,
  config,
}: PluginEnvironment): Promise<Router> {
  return await createRouter({ logger, config });
}

And finally, wire this into the overall backend router. Edit packages/backend/src/index.ts

import harbor from './plugins/harbor';
// ...
async function main() {
  // ...
  const harborEnv = useHotMemoize(module, () => createEnv('harbor'));
  apiRouter.use('/harbor', await harbor(harborEnv));

Configuration

The plugin requires configuration in the Backstage app-config.yaml to connect to harbors API.

harbor:
  baseUrl: https://harbor.yourdomain.com
  username: 
    $env: HARBOR_USERNAME
  password:
    $env: HARBOR_PASSWORD

Adding annotations and values to your component file.

apiVersion: backstage.io/v1alpha1
kind: System
metadata:
  name: sample-system
  description: "A sample system"
  annotations:
    goharbor.io/repository-slug: project/repository

Contributing

Everyone is welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.

0.3.1

2 years ago

0.3.0

2 years ago

0.1.15

2 years ago

0.2.1

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.1.13

3 years ago

0.1.14

2 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago