Skip to content

Commit

Permalink
Prep for 20241121
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Nov 17, 2024
1 parent 83146f1 commit e824a25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 49 deletions.
75 changes: 26 additions & 49 deletions 160_gitlab_ci/000_rollout/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ set -o errexit -o pipefail
: "${COUNT:=1}"
: "${DOMAIN:=inmylab.de}"

if test -f seats.json; then
echo "ERROR: File seats.json already exists."
exit 1
fi

function generate_code() {
local chars=(A B C D E F G H J K L M N P Q R S T U V W X Y Z 2 3 4 5 6 7 8 9)
local length=6
Expand All @@ -26,50 +21,32 @@ function generate_code() {
echo -n "${code}"
}

result="$(
jq \
--null-input \
--arg name "${SET_NAME}" \
--arg count "${COUNT}" \
--arg domain "${DOMAIN}" \
--arg gitlab_admin_password "$(openssl rand -hex 32)" \
--arg gitlab_admin_token "$(openssl rand -hex 32)" \
'
{
"name": $name,
"count": $count,
"domain": $domain,
"gitlab_admin_password": $gitlab_admin_password,
"gitlab_admin_token": $gitlab_admin_token,
"seats": []
}
'
)"

for INDEX in $( seq 0 $(( COUNT - 1)) ); do
result="$(
echo "${result}" | jq \
--arg index "${INDEX}" \
--arg password "$(openssl rand -hex 32)" \
--arg code "$(generate_code)" \
--arg gitlab_token "$(openssl rand -hex 32)" \
--arg webdav_pass_dev "$(openssl rand -hex 32)" \
--arg webdav_pass_live "$(openssl rand -hex 32)" \
'
. as $all |
$all.seats +=
[{
"index": $index,
"password": $password,
"code": $code,
"gitlab_token": $gitlab_token,
"webdav_pass_dev": $webdav_pass_dev,
"webdav_pass_live": $webdav_pass_live
}]
'
)"
done
echo "${result}" >seats.json
if ! test -f seats.json; then
for INDEX in $( seq 0 $(( COUNT - 1)) ); do
result="$(
echo "${result}" | jq \
--arg index "${INDEX}" \
--arg password "$(openssl rand -hex 32)" \
--arg code "$(generate_code)" \
--arg gitlab_token "$(openssl rand -hex 32)" \
--arg webdav_pass_dev "$(openssl rand -hex 32)" \
--arg webdav_pass_live "$(openssl rand -hex 32)" \
'
. as $all |
$all.seats +=
[{
"index": $index,
"password": $password,
"code": $code,
"gitlab_token": $gitlab_token,
"webdav_pass_dev": $webdav_pass_dev,
"webdav_pass_live": $webdav_pass_live
}]
'
)"
done
echo "${result}" >seats.json
fi

UNIQUE_CODES_COUNT="$(
jq --raw-output '.seats[].code' seats.json \
Expand Down
1 change: 1 addition & 0 deletions 2024-11-21_heise-GitLab-CI.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ <h2>Agenda</h2>
<section data-markdown="160_gitlab_ci/280_security/slides.md" data-separator="^---$" data-separator-vertical="^--$"></section>
<section data-markdown="160_gitlab_ci/300_components/slides.md" data-separator="^---$" data-separator-vertical="^--$"></section>
<section data-markdown="160_gitlab_ci/310_steps/slides.md" data-separator="^---$" data-separator-vertical="^--$"></section>
<section data-markdown="160_gitlab_ci/320_secure_files/slides.md" data-separator="^---$" data-separator-vertical="^--$"></section>
<section data-markdown="160_gitlab_ci/final.md" data-separator="^---$" data-separator-vertical="^--$"></section>

<section id="summary" data-separator="^---$" data-separator-vertical="^--$">
Expand Down

0 comments on commit e824a25

Please sign in to comment.