Skip to content

Commit 4610431

Browse files
committed
helm setup to run tests
1 parent 7faf28b commit 4610431

File tree

1 file changed

+114
-27
lines changed

1 file changed

+114
-27
lines changed

.drone.star

+114-27
Original file line numberDiff line numberDiff line change
@@ -432,35 +432,36 @@ def main(ctx):
432432

433433
pipelines = []
434434

435-
build_release_helpers = \
436-
changelog() + \
437-
docs() + \
438-
licenseCheck(ctx)
435+
# build_release_helpers = \
436+
# changelog() + \
437+
# docs() + \
438+
# licenseCheck(ctx)
439439

440440
test_pipelines = \
441-
codestyle(ctx) + \
442-
checkGherkinLint(ctx) + \
443-
checkTestSuitesInExpectedFailures(ctx) + \
444-
buildWebCache(ctx) + \
445-
getGoBinForTesting(ctx) + \
446-
buildOcisBinaryForTesting(ctx) + \
447-
checkStarlark() + \
448-
build_release_helpers + \
449-
testOcisAndUploadResults(ctx) + \
450-
testPipelines(ctx)
451-
452-
build_release_pipelines = \
453-
dockerReleases(ctx) + \
454-
binaryReleases(ctx)
455-
456-
test_pipelines.append(
457-
pipelineDependsOn(
458-
purgeBuildArtifactCache(ctx),
459-
testPipelines(ctx),
460-
),
461-
)
462-
463-
pipelines = test_pipelines + build_release_pipelines
441+
deployments(ctx)
442+
# codestyle(ctx) + \
443+
# checkGherkinLint(ctx) + \
444+
# checkTestSuitesInExpectedFailures(ctx) + \
445+
# buildWebCache(ctx) + \
446+
# getGoBinForTesting(ctx) + \
447+
# buildOcisBinaryForTesting(ctx) + \
448+
# checkStarlark() + \
449+
# build_release_helpers + \
450+
# testOcisAndUploadResults(ctx) + \
451+
# testPipelines(ctx) + \
452+
453+
# build_release_pipelines = \
454+
# dockerReleases(ctx) + \
455+
# binaryReleases(ctx)
456+
457+
# test_pipelines.append(
458+
# pipelineDependsOn(
459+
# purgeBuildArtifactCache(ctx),
460+
# testPipelines(ctx),
461+
# ),
462+
# )
463+
464+
pipelines = deployments(ctx) #test_pipelines + build_release_pipelines
464465

465466
if ctx.build.event == "cron":
466467
pipelines = \
@@ -3414,3 +3415,89 @@ def onlyofficeService():
34143415
],
34153416
},
34163417
]
3418+
3419+
def deployments(ctx):
3420+
result = {
3421+
"kind": "pipeline",
3422+
"type": "docker",
3423+
"name": "k3d",
3424+
"steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx),
3425+
"services": [
3426+
{
3427+
"name": "k3d",
3428+
"image": "ghcr.io/k3d-io/k3d:5-dind",
3429+
"commands": [
3430+
"git clone https://github.com/owncloud/ocis-charts.git",
3431+
"cd ocis-charts",
3432+
"nohup dockerd-entrypoint.sh &",
3433+
"until docker ps 2>&1 > /dev/null; do sleep 1s; done",
3434+
"k3d cluster create --config ci/k3d-drone.yaml --api-port k3d:6445",
3435+
"until kubectl get deployment coredns -n kube-system -o go-template='{{.status.availableReplicas}}' | grep -v -e '<no value>'; do sleep 1s; done",
3436+
"k3d kubeconfig get drone > kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3437+
"chmod 0600 kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3438+
"printf '@@@@@@@@@@@@@@@@@@@@@@@\n@@@@ k3d is ready @@@@\n@@@@@@@@@@@@@@@@@@@@@@@\n'",
3439+
"kubectl get events -Aw",
3440+
],
3441+
},
3442+
],
3443+
"depends_on": [],
3444+
"volumes": [
3445+
{
3446+
"name": "gopath",
3447+
"temp": {},
3448+
},
3449+
],
3450+
"trigger": {
3451+
"ref": [
3452+
"refs/pull/**",
3453+
],
3454+
},
3455+
}
3456+
3457+
result["trigger"]["ref"].append("refs/heads/master")
3458+
3459+
return [result]
3460+
3461+
def wait(config):
3462+
return [{
3463+
"name": "wait",
3464+
"image": "docker.io/bitnami/kubectl:1.31",
3465+
"user": "root",
3466+
"commands": [
3467+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3468+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3469+
"kubectl config view",
3470+
"kubectl get pods -A",
3471+
],
3472+
}]
3473+
3474+
def showPodsAfterInstall(config):
3475+
return [{
3476+
"name": "testPodsAfterInstall",
3477+
"image": "docker.io/bitnami/kubectl:1.31",
3478+
"user": "root",
3479+
"commands": [
3480+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3481+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3482+
"kubectl get pods -n ocis",
3483+
"if [ \"$(kubectl get pods -n ocis --field-selector status.phase=Running | wc -l)\" -le \"32\" ]; then exit 1; fi", # there are 32 pods + 1 header line
3484+
"kubectl get ingress -n ocis",
3485+
"if [ \"$(kubectl get ingress -n ocis | wc -l)\" -le \"1\" ]; then exit 1; fi",
3486+
],
3487+
}]
3488+
3489+
def install(ctx):
3490+
return [{
3491+
"name": "helm-install",
3492+
"image": "owncloudci/golang:latest",
3493+
"commands": [
3494+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3495+
"make helm-install-atomic",
3496+
],
3497+
"volumes": [
3498+
{
3499+
"name": "gopath",
3500+
"path": "/go",
3501+
},
3502+
],
3503+
}]

0 commit comments

Comments
 (0)