Skip to content

Commit

Permalink
Remove custom workflow and use pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtodor committed Dec 13, 2023
1 parent 455d823 commit 4869d63
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 41 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
run: |
curl -s -S -L -o /tmp/promtool https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz
tar -zxf /tmp/promtool --strip-components=1 --directory /usr/local/bin &> /dev/null
- name: Install mimirtool
run: |
curl --silent --show-error --fail --location https://github.com/grafana/mimir/releases/download/mimir-2.10.5/mimirtool-linux-amd64 --output /usr/local/bin/mimirtool
echo "72f46c82c303c48566844612f83ab53d4b804c665644163ad7f0f8945caa0521 /usr/local/bin/mimirtool" | sha256sum --check --status
chmod +x /usr/local/bin/mimirtool
- name: Patch PATH to include GOBIN
run: echo "PATH=$(echo $PATH):/home/runner/go/bin" >> $GITHUB_ENV
- uses: pre-commit/[email protected]
18 changes: 0 additions & 18 deletions .github/workflows/validate-federated-metrics.yml

This file was deleted.

30 changes: 7 additions & 23 deletions scripts/generate-federate-match.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
set -eou pipefail
shopt -s inherit_errexit

! [ -x "$(command -v jq)" ] && echo 'jq not installed, the script requires it.' && exit 1
! [ -x "$(command -v mimirtool)" ] && echo 'mimirtool not installed, the script requires it.' && exit 1
! [ -x "$(command -v realpath)" ] && echo 'realpath not installed, the script requires it.' && exit 1
! [ -x "$(command -v sort)" ] && echo 'sort not installed, the script requires it.' && exit 1
! [ -x "$(command -v uniq)" ] && echo 'uniq not installed, the script requires it.' && exit 1
! [ -x "$(command -v yq)" ] && echo 'yq not installed, the script requires it.' && exit 1

function log() {
echo "${1:-}" >&2
}
Expand All @@ -13,27 +20,6 @@ function log_exit() {
exit 1
}

function check_command() {
local cmd="${1:-}"

echo "- Looking for '${cmd}'"
command -v "${cmd}" || log_exit "-- Command '${cmd}' required."
echo "- Found '${cmd}'!"
}

function check_dependencies() {
echo "--- Checking command dependencies"

check_command mimirtool
check_command realpath
check_command jq
check_command yq
check_command sort
check_command uniq

echo "--- Done!"
}

function get_rules_metrics() {
local os_prom_rule_file="${1:-}"
[[ "${os_prom_rule_file}" = "" ]] && log_exit "Variable 'os_prom_rule_file' is empty."
Expand All @@ -56,8 +42,6 @@ function get_rules_metrics() {
}

function main() {
check_dependencies

local script_dir
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd 2>/dev/null)"

Expand Down

0 comments on commit 4869d63

Please sign in to comment.