Skip to content

Commit

Permalink
use k3d inside dapper
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Lamarre <[email protected]>
  • Loading branch information
alexandreLamarre committed Apr 15, 2024
1 parent a5d3015 commit ca96f62
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN if [ "${ARCH}" != "s390x" ]; then \
curl -sL https://dl.min.io/client/mc/release/linux-${ARCH}/mc > /usr/local/bin/mc && \
chmod +x /usr/local/bin/mc; \
fi
RUN curl --fail https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.4.6 K3D_INSTALL_DIR="/usr/local/bin" bash

ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS CROSS_ARCH USE_DOCKER_BUILDX
ENV DAPPER_SOURCE /go/src/github.com/rancher/backup-restore-operator/
Expand Down
7 changes: 6 additions & 1 deletion scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ set -e

cd $(dirname $0)

export CLUSTER_NAME="backup-restore-operator"

./build
./test
./validate
./validate-ci
./package
./chart/test
./hull
# ./integration
# integration tests
./cleanup-cluster.sh
./setup-cluster.sh
./integration
4 changes: 4 additions & 0 deletions scripts/cleanup-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -e
set -x

k3d cluster delete ${CLUSTER_NAME} || true
38 changes: 38 additions & 0 deletions scripts/setup-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -e
set -x

# waits until all nodes are ready
wait_for_nodes(){
echo "wait until all agents are ready"
while :
do
readyNodes=1
statusList=$(kubectl get nodes --no-headers | awk '{ print $2}')
# shellcheck disable=SC2162
while read status
do
if [ "$status" == "NotReady" ] || [ "$status" == "" ]
then
readyNodes=0
break
fi
done <<< "$(echo -e "$statusList")"
# all nodes are ready; exit
if [[ $readyNodes == 1 ]]
then
break
fi
sleep 1
done
}

k3d cluster create ${CLUSTER_NAME}
wait_for_nodes

echo "${CLUSTER_NAME} ready"

IMAGE=${REPO}/backup-restore-operator:${TAG}

k3d import image ${IMAGE} -c ${CLUSTER_NAME}

0 comments on commit ca96f62

Please sign in to comment.