Files
backstage/plugins/gocd
Julio Zynger 2677db7c15 Add table pagination to GoCD plugin
The default value for the GoCD API is [10 pipelines per page](https://api.gocd.org/current/#get-pipeline-history).
Here we increase the requested page size to the maximum (100 pipelines per page) and add pagination controls to the build tables.

We still don't have _actual request pagination_ implemented, which means we only ever perform a single request - that will come in a future contribution.

Signed-off-by: Julio Zynger <julio.zynger@soundcloud.com>
2022-03-30 17:35:43 +02:00
..
2022-03-30 17:35:43 +02:00
2022-03-22 12:28:03 +00:00
2022-03-29 08:42:22 +00:00

GoCD

Welcome to the GoCD plugin!

  • View recent GoCD Builds

gocd-builds-card

Installation

GoCD Plugin exposes an entity tab component named EntityGoCdContent. You can include it in the EntityPage.tsx`:

// At the top imports
import { EntityGoCdContent } from '@backstage/plugin-gocd';

// Farther down at the component declaration
const componentEntityPage = (
  <EntityLayout>
    {/* Place the following section where you want the tab to appear */}
    <EntityLayout.Route path="/go-cd" title="GoCD">
      <EntityGoCdContent />
    </EntityLayout.Route>

Now your plugin should be visible as a tab at the top of the entity pages, specifically for components that are of the type component. However, it warns of a missing gocd.org/pipelines annotation.

Add the annotation to your component catalog-info.yaml. You can refer to multiple GoCD pipelines by defining their names separated by commas, as shown in the highlighted example below:

metadata:
  annotations:
    gocd.org/pipelines: '<NAME OF THE PIPELINE 1>[,<NAME OF PIPELINE 2>]'

The plugin requires to configure a GoCD API proxy with a GOCD_AUTH_CREDENTIALS for authentication in the app-config.yaml. Its value is an opaque token you can obtain directly from your GoCD instance, in the shape base64(user + ':' + pass). For example, a user "root" and password "root" would become base64('root:root') = cm9vdDpyb290:

proxy:
  '/gocd':
    target: '<go cd server host>/go/api'
    allowedMethods: ['GET']
    allowedHeaders: ['Authorization']
    headers:
      Authorization: Basic ${GOCD_AUTH_CREDENTIALS}

You should also include the gocd section to allow for the plugin to redirect back to GoCD pipelines in your deployed instance:

gocd:
  baseUrl: <go cd server host>