|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +echo "This Script can be used to 'easily' build all WrongSecrets CTF party Components and install them to a local kubernetes cluster" |
| 4 | +echo "For this to work the local kubernetes cluster must have access to the same local registry / image cache which 'docker build ...' writes its image to" |
| 5 | +echo "For example docker-desktop with its included k8s cluster" |
| 6 | + |
| 7 | +echo "Usage: ./build-an-deploy.sh" |
| 8 | + |
| 9 | +source ./scripts/check-available-commands.sh |
| 10 | +checkCommandsAvailable helm docker kubectl yq |
| 11 | + |
| 12 | +version="$(uuidgen)" |
| 13 | +docker login |
| 14 | +WRONGSECRETS_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.image') |
| 15 | +WRONGSECRETS_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.tag') |
| 16 | +WEBTOP_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.image') |
| 17 | +WEBTOP_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.tag') |
| 18 | +WRONGSECRETS_BALANCER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.balancer.repository') |
| 19 | +WRONGSECRETS_BALANCER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.balancer.tag') |
| 20 | +WRONGSECRETS_CLEANER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.repository') |
| 21 | +WRONGSECRETS_CLEANER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.tag') |
| 22 | +echo "Pulling in required images to actually run $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG & $WEBTOP_IMAGE:$WEBTOP_TAG." |
| 23 | +echo "If you see an authentication failure: pull them manually by the following 2 commands" |
| 24 | +echo "'docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG'" |
| 25 | +echo "'docker pull $WEBTOP_IMAGE:$WEBTOP_TAG'" |
| 26 | +echo "'docker pull $WRONGSECRETS_BALANCER_IMAGE:$WRONGSECRETS_BALANCER_TAG'" & |
| 27 | +echo "'docker pull $WRONGSECRETS_CLEANER_IMAGE:$WRONGSECRETS_CLEANER_TAG'" & |
| 28 | +docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG & |
| 29 | +docker pull $WEBTOP_IMAGE:$WEBTOP_TAG & |
| 30 | +docker pull $WRONGSECRETS_BALANCER_IMAGE:$WRONGSECRETS_BALANCER_TAG & |
| 31 | +docker pull $WRONGSECRETS_CLEANER_IMAGE:$WRONGSECRETS_CLEANER_TAG |
| 32 | +wait |
| 33 | + |
| 34 | +helm upgrade --install mj ./helm/wrongsecrets-ctf-party --set="imagePullPolicy=Never" |
0 commit comments