Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Jan 20, 2025
1 parent 94afeab commit 8c77fe5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
58 changes: 29 additions & 29 deletions charts/kube-prometheus-stack/ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@
set -euo pipefail

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

cd "${SCRIPT_DIR}/../"
cd "${SCRIPT_DIR}/../"

./hack/update_crds.sh
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Please run ./hack/update_crds.sh"
./hack/update_crds.sh
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Please run ./hack/update_crds.sh"

exit 1
fi
exit 1
fi

cd hack
cd hack

export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_DISABLE_PIP_VERSION_CHECK=1

python3 -m venv venv
# shellcheck disable=SC1091
source venv/bin/activate
python3 -m venv venv
# shellcheck disable=SC1091
source venv/bin/activate

pip3 install -r requirements.txt
pip3 install -r requirements.txt

go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
PATH="$(go env GOPATH)/bin:$PATH"
export PATH
go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
PATH="$(go env GOPATH)/bin:$PATH"
export PATH

./sync_prometheus_rules.py
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Changes inside rules are not supported!"
echo "Please go into the ./hack/ directory and run ./sync_prometheus_rules.py"
exit 1
fi
./sync_prometheus_rules.py
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Changes inside rules are not supported!"
echo "Please go into the ./hack/ directory and run ./sync_prometheus_rules.py"
exit 1
fi

./sync_grafana_dashboards.py
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Changes inside dashboards are not supported!"
echo "Please go into the ./hack/ directory and run ./sync_grafana_dashboards.py"
exit 1
fi
./sync_grafana_dashboards.py
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Changes inside dashboards are not supported!"
echo "Please go into the ./hack/ directory and run ./sync_grafana_dashboards.py"
exit 1
fi

rm -rf ./venv ./*.git
rm -rf ./venv ./*.git
} 2>&1
50 changes: 25 additions & 25 deletions charts/kube-prometheus-stack/hack/update_crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,43 @@ set -e
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

if [[ $(uname -s) = "Darwin" ]]; then
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')"
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')"
else
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')"
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')"
fi

FILES=(
"crd-alertmanagerconfigs.yaml : monitoring.coreos.com_alertmanagerconfigs.yaml"
"crd-alertmanagers.yaml : monitoring.coreos.com_alertmanagers.yaml"
"crd-podmonitors.yaml : monitoring.coreos.com_podmonitors.yaml"
"crd-probes.yaml : monitoring.coreos.com_probes.yaml"
"crd-prometheusagents.yaml : monitoring.coreos.com_prometheusagents.yaml"
"crd-prometheuses.yaml : monitoring.coreos.com_prometheuses.yaml"
"crd-prometheusrules.yaml : monitoring.coreos.com_prometheusrules.yaml"
"crd-scrapeconfigs.yaml : monitoring.coreos.com_scrapeconfigs.yaml"
"crd-servicemonitors.yaml : monitoring.coreos.com_servicemonitors.yaml"
"crd-thanosrulers.yaml : monitoring.coreos.com_thanosrulers.yaml"
"crd-alertmanagerconfigs.yaml : monitoring.coreos.com_alertmanagerconfigs.yaml"
"crd-alertmanagers.yaml : monitoring.coreos.com_alertmanagers.yaml"
"crd-podmonitors.yaml : monitoring.coreos.com_podmonitors.yaml"
"crd-probes.yaml : monitoring.coreos.com_probes.yaml"
"crd-prometheusagents.yaml : monitoring.coreos.com_prometheusagents.yaml"
"crd-prometheuses.yaml : monitoring.coreos.com_prometheuses.yaml"
"crd-prometheusrules.yaml : monitoring.coreos.com_prometheusrules.yaml"
"crd-scrapeconfigs.yaml : monitoring.coreos.com_scrapeconfigs.yaml"
"crd-servicemonitors.yaml : monitoring.coreos.com_servicemonitors.yaml"
"crd-thanosrulers.yaml : monitoring.coreos.com_thanosrulers.yaml"
)

for line in "${FILES[@]}"; do
DESTINATION=$(echo "${line%%:*}" | xargs)
SOURCE=$(echo "${line##*:}" | xargs)
DESTINATION=$(echo "${line%%:*}" | xargs)
SOURCE=$(echo "${line##*:}" | xargs)

URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"
URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"

echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"
echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"

echo "# ${URL}" >"${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"
echo "# ${URL}" >"${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"

if ! curl --silent --retry-all-errors --fail --location "${URL}" >>"${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"; then
echo -e "Failed to download ${URL}!"
exit 1
fi
if ! curl --silent --retry-all-errors --fail --location "${URL}" >>"${SCRIPT_DIR}/../charts/crds/crds/${DESTINATION}"; then
echo -e "Failed to download ${URL}!"
exit 1
fi
done

{
for file in "${SCRIPT_DIR}/../charts/crds/crds/"crd*.yaml; do
cat "${file}"
echo "---"
done
for file in "${SCRIPT_DIR}/../charts/crds/crds/"crd*.yaml; do
cat "${file}"
echo "---"
done
} | bzip2 --best --compress --keep --stdout - >"${SCRIPT_DIR}/../charts/crds/files/crds.bz2"
10 changes: 5 additions & 5 deletions charts/kube-prometheus-stack/hack/update_mixins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ git clone --depth 1 --quiet https://github.com/kubernetes-monitoring/kubernetes-
git clone --depth 1 --quiet https://github.com/etcd-io/etcd.git "${SCRIPT_DIR}/tmp/etcd"

for REPO_PATH in "${SCRIPT_DIR}/tmp/"*; do
SHA=$(git -C "$REPO_PATH" log -1 --pretty=format:"%H")
REPO_NAME=$(basename "$REPO_PATH")
echo "Updating $REPO_NAME to $SHA"
_sed_i -e "s/'ref.$REPO_NAME'.*:.*'.*'/'ref.$REPO_NAME': '$SHA'/" "${SCRIPT_DIR}/sync_grafana_dashboards.py"
_sed_i -e "s/'ref.$REPO_NAME'.*:.*'.*'/'ref.$REPO_NAME': '$SHA'/" "${SCRIPT_DIR}/sync_prometheus_rules.py"
SHA=$(git -C "$REPO_PATH" log -1 --pretty=format:"%H")
REPO_NAME=$(basename "$REPO_PATH")
echo "Updating $REPO_NAME to $SHA"
_sed_i -e "s/'ref.$REPO_NAME'.*:.*'.*'/'ref.$REPO_NAME': '$SHA'/" "${SCRIPT_DIR}/sync_grafana_dashboards.py"
_sed_i -e "s/'ref.$REPO_NAME'.*:.*'.*'/'ref.$REPO_NAME': '$SHA'/" "${SCRIPT_DIR}/sync_prometheus_rules.py"
done

export PIP_DISABLE_PIP_VERSION_CHECK=1
Expand Down

0 comments on commit 8c77fe5

Please sign in to comment.