-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (68 loc) · 2.4 KB
/
grafana-annotation.yml
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
name: Deploy Annotation to Grafana (Manual Trigger)
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'grafana'
version:
description: 'Application version'
required: true
team:
description: 'Owner or team name'
required: true
default: 'platform'
app:
description: 'App name'
required: true
default: 'platform'
permissions:
id-token: write
contents: write
jobs:
deploy-annotation:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: 'Azure login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Create Grafana Annotation
run: |
timestamp=$(date +%s%3N) # Use millisecond resolution, as requested by the annotations api
curl -X POST "${{ secrets.GRAFANA_URL }}/api/annotations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.GRAFANA_SA_TOKEN }}" \
-d "{
\"text\": \"Deployed ${{ github.event.repository.name }} version ${{ github.event.inputs.version }}\",
\"tags\": [
\"deployment\",
\"env:${{ github.event.inputs.environment }}\",
\"app:${{ github.event.inputs.app }}\",
\"team:${{ github.event.inputs.owner }}\"
],
\"time\": ${timestamp}
}"
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: actions/send-ci-cd-trace/package-lock.json
- name: Install Dependencies
run: npm ci --ignore-scripts
working-directory: actions/send-ci-cd-trace
- name: Build the Action
run: npm run build
working-directory: actions/send-ci-cd-trace
- name: Send Trace to Azure Monitor
uses: ./actions/send-ci-cd-trace
with:
connection_string: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}
app: "${{ github.event.inputs.app }}"
team: "${{ github.event.inputs.team }}"