Skip to content

Commit 9ec73ab

Browse files
Add scripts to add single metric [wip]
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent 722b098 commit 9ec73ab

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

example/add_metric.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# USE_FLAGS=1 (will check devstats runnign flag and abort when set, then it will clear provisioned flag for the time of adding new metric and then set it)
3+
if ( [ -z "$PG_PASS" ] || [ -z "$PG_HOST" ] || [ -z "$PG_PORT" ] )
4+
then
5+
echo "$0: you need to set PG_PASS, PG_HOST and PG_PORT to run this script"
6+
exit 1
7+
fi
8+
9+
export GHA2DB_PROJECTS_YAML="example/projects.yaml"
10+
export LIST_FN_PREFIX="example/all_"
11+
12+
. ./devel/all_projs.sh || exit 2
13+
for proj in $all
14+
do
15+
db=$proj
16+
if [ "$db" = "kubernetes" ]
17+
then
18+
db="gha"
19+
elif [ "$db" = "all" ]
20+
then
21+
db="allprj"
22+
fi
23+
if [ ! -z "$USE_FLAGS" ]
24+
then
25+
./devel/check_flag.sh "$db" devstats_running 0 || exit 3
26+
./devel/clear_flag.sh "$db" provisioned || exit 4
27+
fi
28+
GHA2DB_PROJECT=$proj PG_DB=$db ./devel/add_single_metric.sh || exit 5
29+
if [ ! -z "$USE_FLAGS" ]
30+
then
31+
./devel/set_flag.sh "$db" provisioned || exit 6
32+
fi
33+
done
34+
35+
echo 'OK'

k8s/add_metric.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# USE_FLAGS=1 (will check devstats runnign flag and abort when set, then it will clear provisioned flag for the time of adding new metric and then set it)
3+
if ( [ -z "$PG_PASS" ] || [ -z "$PG_HOST" ] || [ -z "$PG_PORT" ] )
4+
then
5+
echo "$0: you need to set PG_PASS, PG_HOST and PG_PORT to run this script"
6+
exit 1
7+
fi
8+
9+
if ( [ -z "$ES_HOST" ] || [ -z "$ES_PORT" ] || [ -z "$ES_PROTO" ] )
10+
then
11+
echo "$0: you need to set ES_PROTO, ES_HOST and ES_PORT to run this script"
12+
exit 2
13+
fi
14+
15+
# export GHA2DB_USE_ES
16+
# export GHA2DB_USE_ES_RAW
17+
export GHA2DB_PROJECTS_YAML="k8s/projects.yaml"
18+
export GHA2DB_ES_URL="${ES_PROTO}://${ES_HOST}:${ES_PORT}"
19+
export LIST_FN_PREFIX="k8s/all_"
20+
21+
. ./devel/all_projs.sh || exit 3
22+
for proj in $all
23+
do
24+
db=$proj
25+
if [ "$db" = "kubernetes" ]
26+
then
27+
db="gha"
28+
elif [ "$db" = "all" ]
29+
then
30+
db="allprj"
31+
fi
32+
if [ ! -z "$USE_FLAGS" ]
33+
then
34+
./devel/check_flag.sh "$db" devstats_running 0 || exit 4
35+
./devel/clear_flag.sh "$db" provisioned || exit 5
36+
fi
37+
GHA2DB_PROJECT=$proj PG_DB=$db ./devel/add_single_metric.sh || exit 6
38+
if [ ! -z "$USE_FLAGS" ]
39+
then
40+
./devel/set_flag.sh "$db" provisioned || exit 7
41+
fi
42+
done
43+
44+
echo 'OK'

0 commit comments

Comments
 (0)