Skip to content

Commit d2cf455

Browse files
authored
chore: Add example templates for ArgoCD actions (#8704)
* chore: Add example templates for ArgoCD actions New actions were added to the ArgoCD plugin. We should also have some example templates users can reference. Signed-off-by: Bryan Ramos <bramos@redhat.com> * Update README for backend plugin Signed-off-by: Bryan Ramos <bramos@redhat.com> * prettier:fix Signed-off-by: Bryan Ramos <bramos@redhat.com> * use fully qualified names in example action templates Signed-off-by: Bryan Ramos <bramos@redhat.com> * Update changeset Signed-off-by: Bryan Ramos <bramos@redhat.com> --------- Signed-off-by: Bryan Ramos <bramos@redhat.com>
1 parent 218fe98 commit d2cf455

11 files changed

Lines changed: 506 additions & 3 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-argocd-backend': patch
3+
---
4+
5+
Add example templates for ArgoCD plugin actions

workspaces/argocd/app-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ catalog:
107107
rules:
108108
- allow: [Template]
109109

110+
- type: file
111+
target: ../../examples/templates/argocd-find-applications.yaml
112+
rules:
113+
- allow: [Template]
114+
115+
- type: file
116+
target: ../../examples/templates/argocd-get-application.yaml
117+
rules:
118+
- allow: [Template]
119+
120+
- type: file
121+
target: ../../examples/templates/argocd-get-revision-details.yaml
122+
rules:
123+
- allow: [Template]
124+
125+
- type: file
126+
target: ../../examples/templates/argocd-list-applications.yaml
127+
rules:
128+
- allow: [Template]
129+
110130
# Local example organizational data
111131
- type: file
112132
target: ../../examples/org.yaml
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ArgoCD Find Applications Action
2+
#
3+
# Action ID: backstage-community-argocd:argocd:find-applications
4+
#
5+
# This action is automatically registered by the @backstage-community/plugin-argocd-backend
6+
# plugin via the Backstage Actions API. No additional setup is required beyond
7+
# installing the backend plugin.
8+
#
9+
# Prerequisites:
10+
# - ArgoCD backend plugin installed and configured
11+
# - ArgoCD instance(s) configured in app-config.yaml under argocd.appLocatorMethods
12+
13+
---
14+
# Minimal example (required fields only)
15+
actionId: backstage-community-argocd:argocd:find-applications
16+
input:
17+
appName: my-service
18+
19+
---
20+
# Full example (all fields)
21+
actionId: backstage-community-argocd:argocd:find-applications
22+
input:
23+
appName: my-service
24+
project: my-project # Filter by ArgoCD project name
25+
appNamespace: argocd # Filter by application namespace
26+
27+
# Expected output:
28+
# instances:
29+
# - instanceName: production
30+
# instanceUrl: https://argocd.example.com
31+
# applications:
32+
# - name: my-service
33+
# namespace: argocd
34+
# project: my-project
35+
# syncStatus: Synced
36+
# healthStatus: Healthy
37+
# revision: abc123def
38+
# destination:
39+
# server: https://kubernetes.default.svc
40+
# namespace: my-namespace
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# ArgoCD Get Application Action
2+
#
3+
# Action ID: backstage-community-argocd:argocd:get-application
4+
#
5+
# This action is automatically registered by the @backstage-community/plugin-argocd-backend
6+
# plugin via the Backstage Actions API. No additional setup is required beyond
7+
# installing the backend plugin.
8+
#
9+
# Prerequisites:
10+
# - ArgoCD backend plugin installed and configured
11+
# - ArgoCD instance(s) configured in app-config.yaml under argocd.appLocatorMethods
12+
13+
---
14+
# Minimal example (required fields only)
15+
actionId: backstage-community-argocd:argocd:get-application
16+
input:
17+
instanceName: local
18+
appName: my-service
19+
20+
---
21+
# Full example (all fields)
22+
actionId: backstage-community-argocd:argocd:get-application
23+
input:
24+
instanceName: local
25+
appName: my-service
26+
appNamespace: argocd # Namespace of the application
27+
project: my-project # ArgoCD project name
28+
29+
# Expected output:
30+
# name: my-service
31+
# namespace: argocd
32+
# project: my-project
33+
# syncStatus: Synced
34+
# healthStatus: Healthy
35+
# revision: abc123def
36+
# operationPhase: Succeeded
37+
# operationMessage: successfully synced
38+
# destination:
39+
# server: https://kubernetes.default.svc
40+
# namespace: my-namespace
41+
# resourcesCount: 5
42+
# historyCount: 3
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ArgoCD Get Revision Details Action
2+
#
3+
# Action ID: backstage-community-argocd:argocd:get-revision-details
4+
#
5+
# This action is automatically registered by the @backstage-community/plugin-argocd-backend
6+
# plugin via the Backstage Actions API. No additional setup is required beyond
7+
# installing the backend plugin.
8+
#
9+
# Prerequisites:
10+
# - ArgoCD backend plugin installed and configured
11+
# - ArgoCD instance(s) configured in app-config.yaml under argocd.appLocatorMethods
12+
13+
---
14+
# Minimal example (required fields only)
15+
actionId: backstage-community-argocd:argocd:get-revision-details
16+
input:
17+
instanceName: local
18+
appName: my-service
19+
revisionID: abc123def456
20+
21+
---
22+
# Full example (all fields)
23+
actionId: backstage-community-argocd:argocd:get-revision-details
24+
input:
25+
instanceName: local
26+
appName: my-service
27+
revisionID: abc123def456
28+
appNamespace: argocd # Namespace of the application
29+
30+
# Expected output:
31+
# author: Jane Developer
32+
# date: 2026-04-15T10:30:00Z
33+
# message: "feat: add new deployment config"
34+
# revisionID: abc123def456
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ArgoCD List Applications Action
2+
#
3+
# Action ID: backstage-community-argocd:argocd:list-applications
4+
#
5+
# This action is automatically registered by the @backstage-community/plugin-argocd-backend
6+
# plugin via the Backstage Actions API. No additional setup is required beyond
7+
# installing the backend plugin.
8+
#
9+
# Prerequisites:
10+
# - ArgoCD backend plugin installed and configured
11+
# - ArgoCD instance(s) configured in app-config.yaml under argocd.appLocatorMethods
12+
13+
---
14+
# Minimal example (required fields only)
15+
actionId: backstage-community-argocd:argocd:list-applications
16+
input:
17+
instanceName: local
18+
19+
---
20+
# Full example (all fields)
21+
actionId: backstage-community-argocd:argocd:list-applications
22+
input:
23+
instanceName: local
24+
selector: app.kubernetes.io/part-of=my-app # Label selector to filter applications
25+
project: my-project # Filter by ArgoCD project name
26+
appNamespace: argocd # Filter by application namespace
27+
28+
# Expected output:
29+
# totalCount: 2
30+
# applications:
31+
# - name: my-service
32+
# namespace: argocd
33+
# project: my-project
34+
# syncStatus: Synced
35+
# healthStatus: Healthy
36+
# revision: abc123def
37+
# destination:
38+
# server: https://kubernetes.default.svc
39+
# namespace: my-namespace
40+
# - name: my-other-service
41+
# namespace: argocd
42+
# project: my-project
43+
# syncStatus: OutOfSync
44+
# healthStatus: Degraded
45+
# revision: def456ghi
46+
# destination:
47+
# server: https://kubernetes.default.svc
48+
# namespace: other-namespace
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: argocd-find-applications
5+
title: Find ArgoCD Applications
6+
description: Find all ArgoCD applications across all configured instances by application name
7+
tags:
8+
- argocd
9+
- deployment
10+
- kubernetes
11+
spec:
12+
owner: group:default/infrastructure
13+
type: deployment
14+
parameters:
15+
- title: Find ArgoCD Applications
16+
required:
17+
- appName
18+
properties:
19+
appName:
20+
title: Application Name
21+
type: string
22+
description: The ArgoCD application name to search for
23+
project:
24+
title: Project Name
25+
type: string
26+
description: Filter by ArgoCD project name
27+
appNamespace:
28+
title: Application Namespace
29+
type: string
30+
description: Filter by application namespace
31+
steps:
32+
- id: find-applications
33+
name: Find ArgoCD Applications
34+
action: backstage-community-argocd:argocd:find-applications
35+
input:
36+
appName: ${{ parameters.appName }}
37+
project: ${{ parameters.project }}
38+
appNamespace: ${{ parameters.appNamespace }}
39+
output:
40+
text:
41+
- title: Found Instances
42+
content: |
43+
```json
44+
${{ steps['find-applications'].output.instances | dump }}
45+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: argocd-get-application
5+
title: Get ArgoCD Application
6+
description: Get full details of a specific ArgoCD application from a named instance
7+
tags:
8+
- argocd
9+
- deployment
10+
- kubernetes
11+
spec:
12+
owner: group:default/infrastructure
13+
type: deployment
14+
parameters:
15+
- title: ArgoCD Application Details
16+
required:
17+
- instanceName
18+
- appName
19+
properties:
20+
instanceName:
21+
title: ArgoCD Instance
22+
type: string
23+
description: Name of the ArgoCD instance as configured in argocd.appLocatorMethods[].instances
24+
appName:
25+
title: Application Name
26+
type: string
27+
description: The ArgoCD application name
28+
appNamespace:
29+
title: Application Namespace
30+
type: string
31+
description: Namespace of the application
32+
project:
33+
title: Project Name
34+
type: string
35+
description: ArgoCD project name
36+
steps:
37+
- id: get-application
38+
name: Get ArgoCD Application
39+
action: backstage-community-argocd:argocd:get-application
40+
input:
41+
instanceName: ${{ parameters.instanceName }}
42+
appName: ${{ parameters.appName }}
43+
appNamespace: ${{ parameters.appNamespace }}
44+
project: ${{ parameters.project }}
45+
output:
46+
text:
47+
- title: Application Status
48+
content: |
49+
**Name:** ${{ steps['get-application'].output.name }}
50+
**Sync:** ${{ steps['get-application'].output.syncStatus }}
51+
**Health:** ${{ steps['get-application'].output.healthStatus }}
52+
**Resources:** ${{ steps['get-application'].output.resourcesCount }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: argocd-get-revision-details
5+
title: Get ArgoCD Revision Details
6+
description: Fetch the Git commit metadata for a specific revision of an ArgoCD application deployment
7+
tags:
8+
- argocd
9+
- deployment
10+
- kubernetes
11+
spec:
12+
owner: group:default/infrastructure
13+
type: deployment
14+
parameters:
15+
- title: Revision Details
16+
required:
17+
- instanceName
18+
- appName
19+
- revisionID
20+
properties:
21+
instanceName:
22+
title: ArgoCD Instance
23+
type: string
24+
description: Name of the ArgoCD instance
25+
appName:
26+
title: Application Name
27+
type: string
28+
description: The ArgoCD application name
29+
revisionID:
30+
title: Revision ID
31+
type: string
32+
description: Git commit SHA or tag to get details for
33+
appNamespace:
34+
title: Application Namespace
35+
type: string
36+
description: Namespace of the application
37+
steps:
38+
- id: get-revision-details
39+
name: Get Revision Details
40+
action: backstage-community-argocd:argocd:get-revision-details
41+
input:
42+
instanceName: ${{ parameters.instanceName }}
43+
appName: ${{ parameters.appName }}
44+
revisionID: ${{ parameters.revisionID }}
45+
appNamespace: ${{ parameters.appNamespace }}
46+
output:
47+
text:
48+
- title: Revision Info
49+
content: |
50+
**Author:** ${{ steps['get-revision-details'].output.author }}
51+
**Date:** ${{ steps['get-revision-details'].output.date }}
52+
**Message:** ${{ steps['get-revision-details'].output.message }}

0 commit comments

Comments
 (0)