Skip to main content

Read the versions in Argo CD

If Argo CD deploys your applications, Astrolabe reads the version actually deployed: the tag of the component's image, on each environment. Nothing to report from your pipelines, and nothing to write in the catalog-info.yaml of your components.

Several Argo CD (production, the other environments) make one source: Astrolabe looks in all of them.

Before you start

Connect each Argo CD in Administration › Company connections: see Add the Argo CD integration. You can do it before or after the steps below.

1. ⚙️ Choose Argo CD as the source​

  1. In the left sidebar, click Administration, then Plugins.

  2. On the Deployments card, click Configure. The Settings tab opens.

  3. In Source, choose argocd. Two fields appear under it:

    FieldWhat to writeLeft empty
    Component labelThe label of your Argo CD applications whose value is the name of the component, for example app.kubernetes.io/namebackstage.io/component
    Environment labelThe label of your Argo CD applications whose value is the environment, for example envenvironment

    Write a label without spaces or accents.

  4. Click Save. The message Settings saved. appears.

The screen says "Still waiting for: integrations.argocd"

No Argo CD is connected yet. Add one in Administration › Company connections.

2. 🏷️ Label your Argo CD applications​

Give each Argo CD application of a component two labels: the component label, with the name of the component as its value, and the environment label, with the name of the environment as its value.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: shop-api-recette
labels:
backstage.io/component: shop-api # the component label: the name of the component
environment: recette # the environment label: the name of the column

The name of the component is the metadata.name of its catalog-info.yaml. The value of the environment label is the name of the column, character for character: recette and Recette make two columns.

Nothing else to do: Astrolabe links a component to every application that carries the component label with its name.

✅ Check​

Open the component from Catalog: the Deployments card of the Overview shows each environment and its version, for example recette 2.5.0 and prod 2.4.0.

The version is the tag of the image named after the component: registry.example.com/shop-api:2.5.0 gives 2.5.0. A proxy or an agent next to it never wins.

✅ That's it!

Most of your components follow the component label of step 1. For one component whose applications carry another label, add one line to its catalog-info.yaml:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: shop-api
annotations:
argocd/app-selector: team.example.com/app=shop-api
spec:
type: service
lifecycle: production
owner: group:default/platform

The selector must contain a label whose value is the name of the component: team.example.com/app=shop-api for the component shop-api. A selector that does not name the component links nothing: see Common problems with Deployments.

This annotation was checked only when it is wrong. The case where it links the component was not checked on an instance.

Next: Frequently asked questions.