staged_rollouts/v1.54.3.txt: Expand rollout to 60%

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2024-08-19 04:22:37 +02:00
parent bb98f597e9
commit 8fa19a5621
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
2 changed files with 74 additions and 29 deletions

View File

@ -1,16 +1,31 @@
#!/usr/bin/env bash
#min=$((101-${1:-50}))
total_count="${1?}"
target_file="${2?}"
all=({100..1})
cohortes=()
for i in "${all[@]:0:${1?}}"
while IFS="" read -r line || [ -n "$line" ]
do
[[ -n "$line" ]] || continue
cohortes+=("$line")
done < "${target_file}"
cohortes_count=${#cohortes[@]}
count=$(( total_count - cohortes_count ))
for i in "${all[@]:0:${count}}"
do
cohorte_id=$((RANDOM % i))
while [[ " ${cohortes[*]} " =~ .*" ${cohorte_id} ".* ]]
do
cohorte_id=$((cohorte_id+1))
if [[ $cohorte_id -eq 101 ]]
then
cohorte_id=1
fi
done
cohortes+=($cohorte_id)
done
echo "${cohortes[*]}" | tr ' ' $'\n'
(IFS=$'\n'; echo -n "${cohortes[*]}" | sort -h | head -c -1 >| "$target_file")

View File

@ -1,30 +1,60 @@
3
4
5
6
9
11
12
13
14
17
23
24
25
26
28
29
30
32
33
35
38
40
41
42
43
44
79
65
76
33
72
11
77
4
60
5
86
58
41
61
53
12
42
74
3
40
13
73
57
24
45
46
47
48
49
50
51
52
53
54
55
56
57
58
60
61
62
64
65
66
35
6
67
68
72
73
74
75
76
77
78
79
80
81
82
86