Skip to content

Commit 84d35e9

Browse files
CI: Fix frontend-metrics-step (attempt #1) (grafana#74838)
* use grafana/public instead * parameterise script (still need to fix + run drone locally) * make drone --------- Co-authored-by: Ashley Harrison <[email protected]>
1 parent af392c5 commit 84d35e9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.drone.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,8 +1885,9 @@ steps:
18851885
repo:
18861886
- grafana/grafana
18871887
- commands:
1888-
- apk add --update bash grep
1889-
- ./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY
1888+
- apk add --update bash grep git
1889+
- ./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics
1890+
$$GRAFANA_MISC_STATS_API_KEY
18901891
depends_on:
18911892
- test-a11y-frontend
18921893
environment:
@@ -4188,6 +4189,6 @@ kind: secret
41884189
name: gcr_credentials
41894190
---
41904191
kind: signature
4191-
hmac: a7e975025e17a664e3cdb5042d624c05c0f92b2e2f433db2c66bc7ebe2a2eca7
4192+
hmac: dd510a5bc713ecde460082403f309b93dcdcb823368e642bac07861eddbf051e
41924193

41934194
...

scripts/ci-frontend-metrics.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
BUILD_FOLDER=$1
5+
if [ -z "$BUILD_FOLDER" ]; then
6+
BUILD_FOLDER="./public/build"
7+
fi
8+
49
ERROR_COUNT="0"
510
ACCESSIBILITY_ERRORS="$(grep -oP '\"errors\":(\d+),' pa11y-ci-results.json | grep -oP '\d+')"
611
DIRECTIVES="$(grep -r -o directive public/app/ | wc -l)"
@@ -10,7 +15,7 @@ CLASSNAME_PROP="$(grep -r -o -E --include="*.ts*" "\.*.className=\W.*\W.*" publi
1015
EMOTION_IMPORTS="$(grep -r -o -E --include="*.ts*" --exclude="*.test*" "\{.*css.*\} from '@emotion/css'" public/app | wc -l)"
1116
TS_FILES="$(find public/app -type f -name "*.ts*" -not -name "*.test*" | wc -l)"
1217

13-
TOTAL_BUNDLE="$(du -sk ./public/build | cut -f1)"
18+
TOTAL_BUNDLE="$(du -sk $BUILD_FOLDER | cut -f1)"
1419
OUTDATED_DEPENDENCIES="$(yarn outdated --all | grep -oP '[[:digit:]]+ *(?= dependencies are out of date)')"
1520
## Disabled due to yarn PnP update breaking npm audit
1621
#VULNERABILITY_AUDIT="$(yarn npm audit --all --recursive --json)"

scripts/drone/steps/lib.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ def frontend_metrics_step(trigger = None):
633633
},
634634
"failure": "ignore",
635635
"commands": [
636-
"apk add --update bash grep",
637-
"./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY",
636+
"apk add --update bash grep git",
637+
"./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY",
638638
],
639639
}
640640
if trigger:

0 commit comments

Comments
 (0)