acceptance,e2e: Enhance deploy.sh to support more types of runnersets
This commit is contained in:
parent
c221b6e278
commit
3115d71471
|
|
@ -70,9 +70,8 @@ sleep 20
|
||||||
RUNNER_LABEL=${RUNNER_LABEL:-self-hosted}
|
RUNNER_LABEL=${RUNNER_LABEL:-self-hosted}
|
||||||
|
|
||||||
if [ -n "${TEST_REPO}" ]; then
|
if [ -n "${TEST_REPO}" ]; then
|
||||||
if [ "${USE_RUNNERSET}" -ne "false" ]; then
|
if [ "${USE_RUNNERSET}" != "false" ]; then
|
||||||
cat acceptance/testdata/repo.runnerset.yaml | envsubst | kubectl apply -f -
|
cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ENTERPRISE= TEST_ORG= RUNNER_MIN_REPLICAS=${REPO_RUNNER_MIN_REPLICAS} NAME=repo-runnerset envsubst | kubectl apply -f -
|
||||||
cat acceptance/testdata/repo.runnerset.hra.yaml | envsubst | kubectl apply -f -
|
|
||||||
else
|
else
|
||||||
echo 'Deploying runnerdeployment and hra. Set USE_RUNNERSET if you want to deploy runnerset instead.'
|
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.runnerdeploy.yaml | envsubst | kubectl apply -f -
|
||||||
|
|
@ -83,10 +82,18 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${TEST_ORG}" ]; then
|
if [ -n "${TEST_ORG}" ]; then
|
||||||
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= RUNNER_MIN_REPLICAS=${ORG_RUNNER_MIN_REPLICAS} NAME=org-runnerdeploy envsubst | kubectl apply -f -
|
if [ "${USE_RUNNERSET}" != "false" ]; then
|
||||||
|
cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= RUNNER_MIN_REPLICAS=${ORG_RUNNER_MIN_REPLICAS} NAME=org-runnerset envsubst | kubectl apply -f -
|
||||||
|
else
|
||||||
|
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= RUNNER_MIN_REPLICAS=${ORG_RUNNER_MIN_REPLICAS} NAME=org-runnerdeploy envsubst | kubectl apply -f -
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${TEST_ORG_GROUP}" ]; then
|
if [ -n "${TEST_ORG_GROUP}" ]; then
|
||||||
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= TEST_GROUP=${TEST_ORG_GROUP} NAME=orggroup-runnerdeploy envsubst | kubectl apply -f -
|
if [ "${USE_RUNNERSET}" != "false" ]; then
|
||||||
|
cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= RUNNER_MIN_REPLICAS=${ORG_RUNNER_MIN_REPLICAS} TEST_GROUP=${TEST_ORG_GROUP} NAME=orgroupg-runnerset envsubst | kubectl apply -f -
|
||||||
|
else
|
||||||
|
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ENTERPRISE= TEST_REPO= RUNNER_MIN_REPLICAS=${ORG_RUNNER_MIN_REPLICAS} TEST_GROUP=${TEST_ORG_GROUP} NAME=orggroup-runnerdeploy envsubst | kubectl apply -f -
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo 'Skipped deploying enterprise runnerdeployment. Set TEST_ORG_GROUP to deploy.'
|
echo 'Skipped deploying enterprise runnerdeployment. Set TEST_ORG_GROUP to deploy.'
|
||||||
fi
|
fi
|
||||||
|
|
@ -95,10 +102,18 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${TEST_ENTERPRISE}" ]; then
|
if [ -n "${TEST_ENTERPRISE}" ]; then
|
||||||
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ORG= TEST_REPO= NAME=enterprise-runnerdeploy envsubst | kubectl apply -f -
|
if [ "${USE_RUNNERSET}" != "false" ]; then
|
||||||
|
cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ORG= TEST_REPO= RUNNER_MIN_REPLICAS=${ENTERPRISE_RUNNER_MIN_REPLICAS} NAME=enterprise-runnerset envsubst | kubectl apply -f -
|
||||||
|
else
|
||||||
|
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ORG= TEST_REPO= RUNNER_MIN_REPLICAS=${ENTERPRISE_RUNNER_MIN_REPLICAS} NAME=enterprise-runnerdeploy envsubst | kubectl apply -f -
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${TEST_ENTERPRISE_GROUP}" ]; then
|
if [ -n "${TEST_ENTERPRISE_GROUP}" ]; then
|
||||||
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ORG= TEST_REPO= TEST_GROUP=${TEST_ENTERPRISE_GROUP} NAME=enterprisegroup-runnerdeploy envsubst | kubectl apply -f -
|
if [ "${USE_RUNNERSET}" != "false" ]; then
|
||||||
|
cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ORG= TEST_REPO= RUNNER_MIN_REPLICAS=${ENTERPRISE_RUNNER_MIN_REPLICAS} TEST_GROUP=${TEST_ENTERPRISE_GROUP} NAME=enterprisegroup-runnerset envsubst | kubectl apply -f -
|
||||||
|
else
|
||||||
|
cat acceptance/testdata/runnerdeploy.envsubst.yaml | TEST_ORG= TEST_REPO= RUNNER_MIN_REPLICAS=${ENTERPRISE_RUNNER_MIN_REPLICAS} TEST_GROUP=${TEST_ENTERPRISE_GROUP} NAME=enterprisegroup-runnerdeploy envsubst | kubectl apply -f -
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo 'Skipped deploying enterprise runnerdeployment. Set TEST_ENTERPRISE_GROUP to deploy.'
|
echo 'Skipped deploying enterprise runnerdeployment. Set TEST_ENTERPRISE_GROUP to deploy.'
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
apiVersion: actions.summerwind.dev/v1alpha1
|
apiVersion: actions.summerwind.dev/v1alpha1
|
||||||
kind: RunnerSet
|
kind: RunnerSet
|
||||||
metadata:
|
metadata:
|
||||||
name: example-runnerset
|
name: ${NAME}
|
||||||
spec:
|
spec:
|
||||||
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
||||||
# missing required field "selector" in dev.summerwind.actions.v1alpha1.RunnerSet.spec
|
# missing required field "selector" in dev.summerwind.actions.v1alpha1.RunnerSet.spec
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: example-runnerset
|
app: ${NAME}
|
||||||
|
|
||||||
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
||||||
# missing required field "serviceName" in dev.summerwind.actions.v1alpha1.RunnerSet.spec]
|
# missing required field "serviceName" in dev.summerwind.actions.v1alpha1.RunnerSet.spec]
|
||||||
serviceName: example-runnerset
|
serviceName: ${NAME}
|
||||||
|
|
||||||
#replicas: 1
|
#replicas: 1
|
||||||
|
|
||||||
|
|
@ -20,16 +20,23 @@ spec:
|
||||||
# result in queued jobs hanging forever.
|
# result in queued jobs hanging forever.
|
||||||
ephemeral: ${TEST_EPHEMERAL}
|
ephemeral: ${TEST_EPHEMERAL}
|
||||||
|
|
||||||
|
enterprise: ${TEST_ENTERPRISE}
|
||||||
|
group: ${TEST_GROUP}
|
||||||
|
organization: ${TEST_ORG}
|
||||||
repository: ${TEST_REPO}
|
repository: ${TEST_REPO}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom runner image
|
# Custom runner image
|
||||||
#
|
#
|
||||||
image: ${RUNNER_NAME}:${RUNNER_TAG}
|
image: ${RUNNER_NAME}:${RUNNER_TAG}
|
||||||
|
|
||||||
#
|
#
|
||||||
# dockerd within runner container
|
# dockerd within runner container
|
||||||
#
|
#
|
||||||
## Replace `mumoshu/actions-runner-dind:dev` with your dind image
|
## Replace `mumoshu/actions-runner-dind:dev` with your dind image
|
||||||
#dockerdWithinRunnerContainer: true
|
#dockerdWithinRunnerContainer: true
|
||||||
|
dockerdWithinRunnerContainer: ${RUNNER_DOCKERD_WITHIN_RUNNER_CONTAINER}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set the MTU used by dockerd-managed network interfaces (including docker-build-ubuntu)
|
# Set the MTU used by dockerd-managed network interfaces (including docker-build-ubuntu)
|
||||||
#
|
#
|
||||||
|
|
@ -47,7 +54,7 @@ spec:
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: example-runnerset
|
app: ${NAME}
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: runner
|
- name: runner
|
||||||
|
|
@ -57,3 +64,19 @@ spec:
|
||||||
value: "${RUNNER_FEATURE_FLAG_EPHEMERAL}"
|
value: "${RUNNER_FEATURE_FLAG_EPHEMERAL}"
|
||||||
#- name: docker
|
#- name: docker
|
||||||
# #image: mumoshu/actions-runner-dind:dev
|
# #image: mumoshu/actions-runner-dind:dev
|
||||||
|
---
|
||||||
|
apiVersion: actions.summerwind.dev/v1alpha1
|
||||||
|
kind: HorizontalRunnerAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: ${NAME}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
kind: RunnerSet
|
||||||
|
name: ${NAME}
|
||||||
|
scaleUpTriggers:
|
||||||
|
- githubEvent: {}
|
||||||
|
amount: 1
|
||||||
|
duration: "10m"
|
||||||
|
minReplicas: ${RUNNER_MIN_REPLICAS}
|
||||||
|
maxReplicas: 10
|
||||||
|
scaleDownDelaySecondsAfterScaleOut: ${RUNNER_SCALE_DOWN_DELAY_SECONDS_AFTER_SCALE_OUT}
|
||||||
|
|
@ -277,7 +277,9 @@ func (e *env) installActionsRunnerController(t *testing.T) {
|
||||||
"TEST_ID=" + e.testID,
|
"TEST_ID=" + e.testID,
|
||||||
fmt.Sprintf("RUNNER_FEATURE_FLAG_EPHEMERAL=%v", e.featureFlagEphemeral),
|
fmt.Sprintf("RUNNER_FEATURE_FLAG_EPHEMERAL=%v", e.featureFlagEphemeral),
|
||||||
fmt.Sprintf("RUNNER_SCALE_DOWN_DELAY_SECONDS_AFTER_SCALE_OUT=%d", e.scaleDownDelaySecondsAfterScaleOut),
|
fmt.Sprintf("RUNNER_SCALE_DOWN_DELAY_SECONDS_AFTER_SCALE_OUT=%d", e.scaleDownDelaySecondsAfterScaleOut),
|
||||||
|
fmt.Sprintf("REPO_RUNNER_MIN_REPLICAS=%d", e.minReplicas),
|
||||||
fmt.Sprintf("ORG_RUNNER_MIN_REPLICAS=%d", e.minReplicas),
|
fmt.Sprintf("ORG_RUNNER_MIN_REPLICAS=%d", e.minReplicas),
|
||||||
|
fmt.Sprintf("ENTERPRISE_RUNNER_MIN_REPLICAS=%d", e.minReplicas),
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.dockerdWithinRunnerContainer {
|
if e.dockerdWithinRunnerContainer {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue