-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (152 loc) · 5.69 KB
/
Copy pathdac.yaml
File metadata and controls
163 lines (152 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Reusable Workflow for Dashboard-as-Code CI/CD
on:
workflow_call:
inputs:
# general:
url:
description: The URL of the Perses API server where to deploy the dashboard preview.
type: string
required: true
directory:
description: Path to the directory containing the dashboards as code (mutually exclusive with `file`).
type: string
required: false
file:
description: Path to the file that contains the dashboards as code (mutually exclusive with `directory`).
type: string
required: false
project:
description: If present, the project scope for this CLI request.
type: string
required: false
cli-version:
description: Version of percli to install. /!\ For this version of the workflow, the percli version should be at least v0.53.1 or higher
type: string
default: latest
required: false
# skip:
skip-preview:
description: Skip the dashboard preview stage if provided.
type: boolean
required: false
skip-diff:
description: Skip the dashboard diff generation stage if provided.
type: boolean
required: false
skip-deploy:
description: Skip the dashboard deployment stage if provided.
type: boolean
required: false
# auth:
provider:
description: External authentication provider identifier. (slug_id)
type: string
required: false
insecure-skip-tls-verify:
description: If true the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
type: string
required: false
# validate-specific:
server-validation:
description: When enabled, requests the API to make additional validation.
type: boolean
required: false
# preview-specific:
ttl:
description: Time To Live of the dashboard preview (default "1d").
type: string
required: false
# deploy-specific:
force:
description: If present, dashboards will be deployed even if the projects are not consistent between the --project flag and the dashboards metadata (the latter has priority).
type: boolean
required: false
secrets:
username:
description: Username for basic authentication to the API server.
required: false
password:
description: Password for basic authentication to the API server.
required: false
token:
description: Bearer token for authentication to the API server.
required: false
client-id:
description: Client ID used for robotic access when using external authentication provider.
required: false
client-secret:
description: Client Secret used for robotic access when using external authentication provider.
required: false
cue-token:
description: Token for CUE's Central Registry.
required: false
jobs:
dac:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install necessary tools
uses: perses/github-actions/actions/setup_environment@v0.9.0
with:
enable_go: true
enable_cue: true
cue_version: "v0.15.4"
- name: Retrieve workflow version
id: workflow-version
uses: canonical/get-workflow-version-action@v1
with:
repository-name: perses/cli-actions
file-name: dac.yaml
- name: Check out actions using workflow version
uses: actions/checkout@v4
with:
repository: perses/cli-actions
ref: ${{ steps.workflow-version.outputs.sha }}
path: perses-cli-actions
- name: Install percli
uses: ./perses-cli-actions/actions/install_percli
with:
cli-version: ${{ inputs.cli-version }}
- name: Build the dashboards
uses: ./perses-cli-actions/actions/build_dac
with:
directory: ${{ inputs.directory }}
file: ${{ inputs.file }}
- name: Login to the API server
uses: ./perses-cli-actions/actions/login
with:
url: ${{ inputs.url }}
username: ${{ secrets.username }}
password: ${{ secrets.password }}
token: ${{ secrets.token }}
provider: ${{ inputs.provider }}
client-id: ${{ secrets.client-id }}
client-secret: ${{ secrets.client-secret }}
insecure-skip-tls-verify: ${{ inputs.insecure-skip-tls-verify }}
- name: Validate the dashboards
uses: ./perses-cli-actions/actions/validate_resources
with:
directory: ./built
online: ${{ inputs.server-validation }}
- name: Preview the dashboards
if: ${{ github.event_name == 'pull_request' && !inputs.skip-preview }}
uses: ./perses-cli-actions/actions/preview_dashboards
with:
directory: ./built
project: ${{ inputs.project }}
prefix: PR${{ github.event.pull_request.number }}
ttl: ${{ inputs.ttl }}
- name: Generate dashboards diffs
if: ${{ github.event_name == 'pull_request' && !inputs.skip-diff }}
uses: ./perses-cli-actions/actions/diff_dashboards
with:
directory: ./built
project: ${{ inputs.project }}
- name: Deploy the dashboards
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && !inputs.skip-deploy }}
uses: ./perses-cli-actions/actions/apply_resources
with:
directory: ./built
project: ${{ inputs.project }}
force: ${{ inputs.force }}