0.1.13 • Published 3 years ago

@loblaw/plugin-backstage-plugin-gitlab v0.1.13

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

Backstage Gitlab Plugin

Version Contributions welcome Downloads License Stars Badge Maintenance

Build Status npm.io npm.io npm.io

Language npm.io npm.io Repo Size npm.io Hits

Website: https://gitlab.com/

Setup

  1. If you have a standalone app (you didn't clone this repo), then do
# From your Backstage root directory
cd packages/app
yarn add @loblaw/backstage-plugin-gitlab
  1. Add the EntityGitlabContent extension to the entity page in your app:
// In packages/app/src/components/catalog/EntityPage.tsx

import { isGitlabAvailable, EntityGitlabContent } from '@loblaw/backstage-plugin-gitlab';
// Farther down at the serviceEntityPage declaration
const serviceEntityPage = (
<EntityLayout>
    {/* Place the following section where you want the tab to appear */}
    <EntityLayout.Route if={isGitlabAvailable} path="/gitlab" title="Gitlab">
       <EntityGitlabContent />
    </EntityLayout.Route>
  1. Add proxy config:
  '/gitlabci':
    target: ${GITLAB_URL}/api/v4
    allowedMethods: ['GET']
    headers:
      PRIVATE-TOKEN: '${GITLAB_TOKEN}'
  • Default GitLab URL: https://gitlab.com
  • GitLab Token should be with of scope read_api and can be generated from this URL
  1. Add a gitlab.com/project-id annotation to your respective catalog-info.yaml files, on the format
# Example catalog-info.yaml entity definition file
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
      gitlab.com/project-id: 'project-id' #1234
spec:
  type: service
  # ...

Note: spec.type can take values in 'website','library','service' but to render GitLab Entity, Catalog must be of type service

Features

  • List top 20 builds for a project
  • List top 20 Merge Requests for a project
  • View Contributors for a project
  • View Languages used for a project
  • View Pipeline status for a project
  • Works for both project and personal tokens
  • Pagination for builds
  • Pagination for Merge Requests
  • Merge Requests Statistics