Skip to main content

Show the Jenkins tab on a component

Each annotated component gets a Jenkins tab with its builds, and a Latest master build card on its Overview.

How to​

1. Turn on the plugin​

  1. In Administration, under PLATFORM, click Plugins.
  2. On the Jenkins card, turn on the Enable Jenkins switch.

If the card says Configure the Jenkins integration first, click it: the integration opens in Company connections. Add it (Add the Jenkins integration). The plugin turns on by itself when you save the integration: go to step 2.

2. Annotate the component​

In the component's catalog-info.yaml, add the full name of its Jenkins job:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: shop-api
annotations:
jenkins.io/job-full-name: shop-api
spec:
type: service
lifecycle: production
owner: team-a
Where is the full name?

It is the path of the job in the address bar of Jenkins, without job/. The job https://jenkins.example.com/job/shop/job/shop-api/ is written shop/shop-api.

3. Check​

Open the component in Catalog. A Jenkins tab is next to Overview. Click it: the job is listed with its last build.

✅ Done.

What it shows, and to whom​

ColumnWhat
BuildThe job name, with a link. A folder of branches gives one line per branch, for example shop » master
TestsThe test results, or n/a
StatusFor example Completed
Last Run DurationFor example 0.1 s
ActionsView build opens the build in Jenkins

On Overview, the Latest master build card shows the Status, the Build, the Latest Run and the Duration of the last build of the job master, with a link See more on Jenkins. It reads the job named master inside your job: use a job that has a master branch.

Anyone who can open the component sees the tab and the card. Astrolabe reads Jenkins with the user and the token of the integration, the same for every reader.

Several jobs on one component​

Write the full names separated by a comma. They must be on the same Jenkins.

metadata:
annotations:
jenkins.io/job-full-name: shop-api,shop/shop-api-tests

The tab lists the builds of every job.

You have several Jenkins​

Start the annotation with the instance key of the integration, then :, then the job name:

metadata:
annotations:
jenkins.io/job-full-name: prod:shop-api

Here, prod is the Jenkins instance key of the production Jenkins integration.

Next: Add the Jenkins cards to your dashboard.

Something is wrong? See Common problems with Jenkins.