From 84d35e9f0b268778e3fa133faa0eed6d761a972c Mon Sep 17 00:00:00 2001 From: Kevin Minehart Date: Thu, 14 Sep 2023 08:48:31 -0500 Subject: [PATCH] CI: Fix frontend-metrics-step (attempt #1) (#74838) * use grafana/public instead * parameterise script (still need to fix + run drone locally) * make drone --------- Co-authored-by: Ashley Harrison --- .drone.yml | 7 ++++--- scripts/ci-frontend-metrics.sh | 7 ++++++- scripts/drone/steps/lib.star | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index b9f9c944627..9df78fde09c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1885,8 +1885,9 @@ steps: repo: - grafana/grafana - commands: - - apk add --update bash grep - - ./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY + - apk add --update bash grep git + - ./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics + $$GRAFANA_MISC_STATS_API_KEY depends_on: - test-a11y-frontend environment: @@ -4188,6 +4189,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: a7e975025e17a664e3cdb5042d624c05c0f92b2e2f433db2c66bc7ebe2a2eca7 +hmac: dd510a5bc713ecde460082403f309b93dcdcb823368e642bac07861eddbf051e ... diff --git a/scripts/ci-frontend-metrics.sh b/scripts/ci-frontend-metrics.sh index a3cd4f60f7e..1817697ec16 100755 --- a/scripts/ci-frontend-metrics.sh +++ b/scripts/ci-frontend-metrics.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -e +BUILD_FOLDER=$1 +if [ -z "$BUILD_FOLDER" ]; then + BUILD_FOLDER="./public/build" +fi + ERROR_COUNT="0" ACCESSIBILITY_ERRORS="$(grep -oP '\"errors\":(\d+),' pa11y-ci-results.json | grep -oP '\d+')" 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 EMOTION_IMPORTS="$(grep -r -o -E --include="*.ts*" --exclude="*.test*" "\{.*css.*\} from '@emotion/css'" public/app | wc -l)" TS_FILES="$(find public/app -type f -name "*.ts*" -not -name "*.test*" | wc -l)" -TOTAL_BUNDLE="$(du -sk ./public/build | cut -f1)" +TOTAL_BUNDLE="$(du -sk $BUILD_FOLDER | cut -f1)" OUTDATED_DEPENDENCIES="$(yarn outdated --all | grep -oP '[[:digit:]]+ *(?= dependencies are out of date)')" ## Disabled due to yarn PnP update breaking npm audit #VULNERABILITY_AUDIT="$(yarn npm audit --all --recursive --json)" diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index cf4e7df7690..29c1f41b4ba 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -633,8 +633,8 @@ def frontend_metrics_step(trigger = None): }, "failure": "ignore", "commands": [ - "apk add --update bash grep", - "./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY", + "apk add --update bash grep git", + "./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY", ], } if trigger: