-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (156 loc) · 5.67 KB
/
compat-loki.yaml
File metadata and controls
162 lines (156 loc) · 5.67 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
name: Loki Compatibility
on:
push:
branches: [main]
paths-ignore:
- "CHANGELOG.md"
- "docs/observability.md"
- "charts/loki-vl-proxy/Chart.yaml"
- "README.md"
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: "15 3 * * 1"
jobs:
loki-matrix-source:
runs-on: ubuntu-latest
outputs:
loki_versions: ${{ steps.matrix.outputs.loki_versions }}
steps:
- uses: actions/checkout@v4
- id: matrix
run: echo "loki_versions=$(jq -c '.stack.loki.matrix_versions' test/e2e-compat/compatibility-matrix.json)" >> "$GITHUB_OUTPUT"
loki-pinned:
if: github.event_name != 'schedule'
needs: loki-matrix-source
runs-on: ubuntu-latest
env:
LOKI_IMAGE: grafana/loki:3.7.1
VICTORIALOGS_IMAGE: victoriametrics/victoria-logs:v1.49.0
GRAFANA_IMAGE: grafana/grafana:12.4.2
PROXY_IMAGE: loki-vl-proxy:compat-loki
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26.2"
cache: true
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
tags: ${{ env.PROXY_IMAGE }}
load: true
cache-from: type=gha,scope=compat-proxy
cache-to: type=gha,mode=max,scope=compat-proxy
- name: Start pinned stack
working-directory: test/e2e-compat
run: |
docker compose up -d --no-build loki victorialogs vmalert loki-vl-proxy loki-vl-proxy-underscore
docker compose up -d --no-build --no-deps grafana
bash ../../scripts/ci/wait_loki_track_stack.sh 180
- name: Run Loki compatibility score
run: |
set -euo pipefail
go test -v -tags=e2e -run '^TestLokiTrackScore$' ./test/e2e-compat/ | tee /tmp/loki-track-score.log
python3 - <<'PY'
import pathlib
import re
import sys
log = pathlib.Path("/tmp/loki-track-score.log").read_text(encoding="utf-8")
matches = re.findall(r"Score:\s+(\d+)/(\d+)\s+\(([0-9.]+)%\)", log)
if not matches:
print("Loki track score missing from test output", file=sys.stderr)
raise SystemExit(1)
passed, total, pct = matches[-1]
pct_val = float(pct)
if pct_val < 99.9:
print(
f"Loki compatibility score must be 100%, got {passed}/{total} ({pct_val:.1f}%)",
file=sys.stderr,
)
raise SystemExit(1)
print(f"Loki compatibility score: {passed}/{total} ({pct_val:.1f}%)")
PY
- name: Run Loki query semantics matrix
run: |
set -euo pipefail
go test -v -tags=e2e -run '^TestQuerySemantics' ./test/e2e-compat/
- name: Tear down pinned stack
if: always()
working-directory: test/e2e-compat
run: docker compose down -v
loki-matrix:
if: github.event_name == 'schedule'
needs: loki-matrix-source
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
loki_version: ${{ fromJson(needs.loki-matrix-source.outputs.loki_versions) }}
env:
VICTORIALOGS_IMAGE: victoriametrics/victoria-logs:v1.49.0
GRAFANA_IMAGE: grafana/grafana:12.4.2
PROXY_IMAGE: loki-vl-proxy:compat-loki
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26.2"
cache: true
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
tags: ${{ env.PROXY_IMAGE }}
load: true
cache-from: type=gha,scope=compat-proxy
cache-to: type=gha,mode=max,scope=compat-proxy
- name: Start matrix stack
working-directory: test/e2e-compat
env:
LOKI_IMAGE: grafana/loki:${{ matrix.loki_version }}
run: |
docker compose up -d --no-build loki victorialogs vmalert loki-vl-proxy loki-vl-proxy-underscore
docker compose up -d --no-build --no-deps grafana
bash ../../scripts/ci/wait_loki_track_stack.sh 180
- name: Run Loki compatibility score
env:
LOKI_IMAGE: grafana/loki:${{ matrix.loki_version }}
run: |
set -euo pipefail
go test -v -tags=e2e -run '^TestLokiTrackScore$' ./test/e2e-compat/ | tee /tmp/loki-track-score.log
python3 - <<'PY'
import pathlib
import re
import sys
log = pathlib.Path("/tmp/loki-track-score.log").read_text(encoding="utf-8")
matches = re.findall(r"Score:\s+(\d+)/(\d+)\s+\(([0-9.]+)%\)", log)
if not matches:
print("Loki track score missing from test output", file=sys.stderr)
raise SystemExit(1)
passed, total, pct = matches[-1]
pct_val = float(pct)
if pct_val < 99.9:
print(
f"Loki compatibility score must be 100%, got {passed}/{total} ({pct_val:.1f}%)",
file=sys.stderr,
)
raise SystemExit(1)
print(f"Loki compatibility score: {passed}/{total} ({pct_val:.1f}%)")
PY
- name: Run Loki query semantics matrix
env:
LOKI_IMAGE: grafana/loki:${{ matrix.loki_version }}
run: |
set -euo pipefail
go test -v -tags=e2e -run '^TestQuerySemantics' ./test/e2e-compat/
- name: Tear down matrix stack
if: always()
working-directory: test/e2e-compat
env:
LOKI_IMAGE: grafana/loki:${{ matrix.loki_version }}
run: docker compose down -v