Skip to content

Commit

Permalink
staged_rollouts/v1.54.3.txt: Expand rollout to 60%
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Aug 19, 2024
1 parent bb98f59 commit 8fa19a5
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 26 deletions.
21 changes: 18 additions & 3 deletions generate_cohortes.sh
Original file line number Diff line number Diff line change
@@ -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")
76 changes: 53 additions & 23 deletions staged_rollouts/v1.54.3.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,60 @@
43
44
79
65
76
33
72
11
77
3
4
60
5
86
58
41
61
53
6
9
11
12
42
74
3
40
13
73
57
14
17
23
24
25
26
28
29
30
32
33
35
38
40
41
42
43
44
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

0 comments on commit 8fa19a5

Please sign in to comment.