diff --git a/generate_cohortes.sh b/generate_cohortes.sh index f106af0ff..83fc87b4a 100755 --- a/generate_cohortes.sh +++ b/generate_cohortes.sh @@ -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") diff --git a/staged_rollouts/v1.54.3.txt b/staged_rollouts/v1.54.3.txt index dcdef0a8f..9274be61c 100644 --- a/staged_rollouts/v1.54.3.txt +++ b/staged_rollouts/v1.54.3.txt @@ -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 \ No newline at end of file