mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-10 19:50:30 +00:00
This enhances the E2E test suite introduced in #658 to also include the following steps: - Install GitHub Actions workflow - Trigger a workflow run via a git commit - Verify the workflow run result In the workflow, we use `kubectl create cm --from-literal` to create a configmap that contains an unique test ID. In the last step we obtain the configmap from within the E2E test and check the test ID to match the expected one. To install a GitHub Actions workflow, we clone a GitHub repository denoted by the TEST_REPO envvar, progmatically generate a few files with some Go code, run `git-add`, `git-commit`, and then `git-push` to actually push the files to the repository. A single commit containing an updated workflow definition and an updated file seems to run a workflow derived to the definition introduced in the commit, which was a bit surpirising and useful behaviour. At this point, the E2E test fully covers all the steps for a GitHub token based installation. We need to add scenarios for more deployment options, like GitHub App, RunnerDeployment, HRA, and so on. But each of them would worth another pull request.
76 lines
2.8 KiB
Bash
Executable File
76 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
tpe=${ACCEPTANCE_TEST_SECRET_TYPE}
|
|
|
|
VALUES_FILE=${VALUES_FILE:-$(dirname $0)/values.yaml}
|
|
|
|
if [ "${tpe}" == "token" ]; then
|
|
if ! kubectl get secret controller-manager -n actions-runner-system >/dev/null; then
|
|
kubectl create secret generic controller-manager \
|
|
-n actions-runner-system \
|
|
--from-literal=github_token=${GITHUB_TOKEN:?GITHUB_TOKEN must not be empty}
|
|
fi
|
|
elif [ "${tpe}" == "app" ]; then
|
|
kubectl create secret generic controller-manager \
|
|
-n actions-runner-system \
|
|
--from-literal=github_app_id=${APP_ID:?must not be empty} \
|
|
--from-literal=github_app_installation_id=${INSTALLATION_ID:?must not be empty} \
|
|
--from-file=github_app_private_key=${PRIVATE_KEY_FILE_PATH:?must not be empty}
|
|
else
|
|
echo "ACCEPTANCE_TEST_SECRET_TYPE must be set to either \"token\" or \"app\"" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
tool=${ACCEPTANCE_TEST_DEPLOYMENT_TOOL}
|
|
|
|
if [ "${tool}" == "helm" ]; then
|
|
helm upgrade --install actions-runner-controller \
|
|
charts/actions-runner-controller \
|
|
-n actions-runner-system \
|
|
--create-namespace \
|
|
--set syncPeriod=${SYNC_PERIOD} \
|
|
--set authSecret.create=false \
|
|
--set image.repository=${NAME} \
|
|
--set image.tag=${VERSION} \
|
|
-f ${VALUES_FILE}
|
|
kubectl apply -f charts/actions-runner-controller/crds
|
|
kubectl -n actions-runner-system wait deploy/actions-runner-controller --for condition=available --timeout 60s
|
|
else
|
|
kubectl apply \
|
|
-n actions-runner-system \
|
|
-f release/actions-runner-controller.yaml
|
|
kubectl -n actions-runner-system wait deploy/controller-manager --for condition=available --timeout 120s
|
|
fi
|
|
|
|
# Adhocly wait for some time until actions-runner-controller's admission webhook gets ready
|
|
sleep 20
|
|
|
|
RUNNER_LABEL=${RUNNER_LABEL:-self-hosted}
|
|
|
|
if [ -n "${TEST_REPO}" ]; then
|
|
if [ -n "USE_RUNNERSET" ]; then
|
|
cat acceptance/testdata/repo.runnerset.yaml | envsubst | kubectl apply -f -
|
|
cat acceptance/testdata/repo.runnerset.hra.yaml | envsubst | kubectl apply -f -
|
|
else
|
|
echo 'Deploying runnerdeployment and hra. Set USE_RUNNERSET if you want to deploy runnerset instead.'
|
|
cat acceptance/testdata/repo.runnerdeploy.yaml | envsubst | kubectl apply -f -
|
|
cat acceptance/testdata/repo.hra.yaml | envsubst | kubectl apply -f -
|
|
fi
|
|
else
|
|
echo 'Skipped deploying runnerdeployment and hra. Set TEST_REPO to "yourorg/yourrepo" to deploy.'
|
|
fi
|
|
|
|
if [ -n "${TEST_ORG}" ]; then
|
|
cat acceptance/testdata/org.runnerdeploy.yaml | envsubst | kubectl apply -f -
|
|
|
|
if [ -n "${TEST_ORG_REPO}" ]; then
|
|
cat acceptance/testdata/org.hra.yaml | envsubst | kubectl apply -f -
|
|
else
|
|
echo 'Skipped deploying organizational hra. Set TEST_ORG_REPO to "yourorg/yourrepo" to deploy.'
|
|
fi
|
|
else
|
|
echo 'Skipped deploying organizational runnerdeployment. Set TEST_ORG to deploy.'
|
|
fi
|