Este contenido no está disponible en el idioma seleccionado.
Tekton plugin for Backstage
The Tekton plugin for Backstage
Abstract
Chapter 1. Tekton plugin for Backstage Copiar enlaceEnlace copiado en el portapapeles!
The Tekton plugin enables you to visualize the PipelineRun
resources available on the Kubernetes cluster.
1.1. For administrators Copiar enlaceEnlace copiado en el portapapeles!
1.1.1. Setting up the Tekton plugin Copiar enlaceEnlace copiado en el portapapeles!
The Red Hat Plug-ins for Backstage (RHPIB) packages are hosted in a separate NPM registry, which is maintained by Red Hat. To use the RHPIB NPM packages, you must adjust your NPM configuration. You can create a .npmrc
file, containing the following content:
@redhat:registry=https://npm.registry.redhat.com/ registry=https://registry.npmjs.org
For more information, see npm docs.
Creating a .npmrc
file ensures that all the packages are scoped under @redhat
and are fetched from Red Hat’s NPM registry, while the rest dependencies remain sourced from other registry.
Using this configuration, you can proceed with the installation of the individual packages.
Prerequisites
-
The Kubernetes plugins including
@backstage/plugin-kubernetes
and@backstage/plugin-kubernetes-backend
are installed and configured by following the installation and configuration guides. The following
customResources
component is added in theapp-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The Kubernetes plugin is configured and connects to the cluster using a
ServiceAccount
. The
ClusterRole
must be granted for custom resources (PipelineRuns and TaskRuns) toServiceAccount
accessing the cluster. If you have the Backstage Kubernetes Plugin configured, then theClusterRole
is already granted.You can use the following code to grant the
ClusterRole
for custom resources:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following annotation is added to the entity’s
catalog-info.yaml
file to identify whether an entity contains the Kubernetes resources:annotations: ... backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>
annotations: ... backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also add the
backstage.io/kubernetes-namespace
annotation to identify the Kubernetes resources using the defined namespace.annotations: ... backstage.io/kubernetes-namespace: <RESOURCE_NS>
annotations: ... backstage.io/kubernetes-namespace: <RESOURCE_NS>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following annotation is added to the
catalog-info.yaml
file of entity to view the latestPipelineRun
in the CI/CD tab of the application:annotations: ... janus-idp.io/tekton-enabled : 'true'
annotations: ... janus-idp.io/tekton-enabled : 'true'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A custom label selector can be added, which Backstage uses to find the Kubernetes resources. The label selector takes precedence over the ID annotations.
annotations: ... backstage.io/kubernetes-label-selector: 'app=my-app,component=front-end'
annotations: ... backstage.io/kubernetes-label-selector: 'app=my-app,component=front-end'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following label is added to the resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity:
labels: ... backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>`
labels: ... backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
When using the label selector, the mentioned labels must be present on the resource.
Procedure
Install the Tekton plugin using the following command:
yarn workspace app add @redhat/backstage-plugin-tekton
yarn workspace app add @redhat/backstage-plugin-tekton
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the TEKTON tab on the entity view page using the
packages/app/src/components/catalog/EntityPage.tsx
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable latest PipelineRun visualization in the CI/CD tab on the entity view page. The
linkTekton
property is optional and takes boolean value, if not specified or set totrue
, then the GO TO TEKTON option is displayed.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2. For users Copiar enlaceEnlace copiado en el portapapeles!
1.2.1. Using the Tekton plugin in Backstage Copiar enlaceEnlace copiado en el portapapeles!
Tekton is a front-end plugin that enables you to view the PipelineRun
resources.
Prerequisites
- Your Backstage application is installed and running.
- You have installed the Tekton plugin. For the installation process, see Setting up the Tekton plugin.
Procedure
- Open your Backstage application and select a component from the Catalog page.
Go to the CI/CD tab.
The CI/CD tab displays the latest
PipelineRun
resources associated to a Kubernetes cluster. The resources include tasks to complete. When you hover the mouse pointer on a task card, you can view the steps to complete that particular task.There is also a GO TO TEKTON option at the bottom, which redirects you to the TEKTON tab.
Click GO TO TEKTON or select the TEKTON tab in the entity view page.
The TEKTON tab contains the list of pipeline runs related to a cluster. The list contains pipeline run details, such as NAME, STATUS, TASK STATUS, STARTED, and DURATION.