setup tests for single namespace and dind

This commit is contained in:
Nikola Jokic
2023-11-28 10:55:31 +01:00
parent a9eb5b6c45
commit 819a9264a0
4 changed files with 173 additions and 37 deletions

View File

@@ -14,6 +14,25 @@ WORKFLOW_FILE="arc-test-workflow.yaml"
ARC_NAME="arc"
ARC_NAMESPACE="arc-systems"
function install_arc() {
echo "Creating namespace ${ARC_NAMESPACE}"
kubectl create namespace "${SCALE_SET_NAMESPACE}"
echo "Installing ARC"
helm install "${ARC_NAME}" \
--namespace "${ARC_NAMESPACE}" \
--create-namespace \
--set image.repository="${IMAGE_NAME}" \
--set image.tag="${IMAGE_TAG}" \
${ROOT_DIR}/charts/gha-rynner-scale-set-controller \
--debug
if ! NAME="${ARC_NAME}" NAMESPACE="${ARC_NAMESPACE}" wait_for_arc; then
NAMESPACE="${ARC_NAMESPACE}" log_arc
return 1
fi
}
function install_scale_set() {
echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}"
helm install "${SCALE_SET_NAME}" \
@@ -31,28 +50,6 @@ function install_scale_set() {
fi
}
function run_workflow() {
gh workflow run -R "${TARGET_ORG}/${TARGET_REPO}" "${WORKFLOW_FILE}"
local count=0
while true; do
STATUS=$(gh run list -R "${TARGET_ORG}/${TARGET_REPO}" --limit 1 --limit 1 --json status --jq '.[0].status')
if [ "${STATUS}" != "completed" ]; then
sleep 30
count=$((count + 1))
continue
fi
CONCLUSION=$(gh run list -R "${TARGET_ORG}/${TARGET_REPO}" --limit 1 --limit 1 --json conclusion --jq '.[0].conclusion')
if [[ "${CONCLUSION}" != "success" ]]; then
echo "Workflow failed"
return 1
fi
return 0
done
}
function main() {
local failed=()