Skip to content

Commit 3a5adb8

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

File tree

1 file changed

+115
-27
lines changed

1 file changed

+115
-27
lines changed

.drone.star

+115-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,90 @@ 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+
"user": "root",
3430+
"commands": [
3431+
"git clone https://github.com/owncloud/ocis-charts.git",
3432+
"cd ocis-charts",
3433+
"nohup dockerd-entrypoint.sh &",
3434+
"until docker ps 2>&1 > /dev/null; do sleep 1s; done",
3435+
"k3d cluster create --config ci/k3d-drone.yaml --api-port k3d:6445",
3436+
"until kubectl get deployment coredns -n kube-system -o go-template='{{.status.availableReplicas}}' | grep -v -e '<no value>'; do sleep 1s; done",
3437+
"k3d kubeconfig get drone > kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3438+
"chmod 0600 kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3439+
"printf '@@@@@@@@@@@@@@@@@@@@@@@\n@@@@ k3d is ready @@@@\n@@@@@@@@@@@@@@@@@@@@@@@\n'",
3440+
"kubectl get events -Aw",
3441+
],
3442+
},
3443+
],
3444+
"depends_on": [],
3445+
"volumes": [
3446+
{
3447+
"name": "gopath",
3448+
"temp": {},
3449+
},
3450+
],
3451+
"trigger": {
3452+
"ref": [
3453+
"refs/pull/**",
3454+
],
3455+
},
3456+
}
3457+
3458+
result["trigger"]["ref"].append("refs/heads/master")
3459+
3460+
return [result]
3461+
3462+
def wait(config):
3463+
return [{
3464+
"name": "wait",
3465+
"image": "docker.io/bitnami/kubectl:1.31",
3466+
"user": "root",
3467+
"commands": [
3468+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3469+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3470+
"kubectl config view",
3471+
"kubectl get pods -A",
3472+
],
3473+
}]
3474+
3475+
def showPodsAfterInstall(config):
3476+
return [{
3477+
"name": "testPodsAfterInstall",
3478+
"image": "docker.io/bitnami/kubectl:1.31",
3479+
"user": "root",
3480+
"commands": [
3481+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3482+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3483+
"kubectl get pods -n ocis",
3484+
"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
3485+
"kubectl get ingress -n ocis",
3486+
"if [ \"$(kubectl get ingress -n ocis | wc -l)\" -le \"1\" ]; then exit 1; fi",
3487+
],
3488+
}]
3489+
3490+
def install(ctx):
3491+
return [{
3492+
"name": "helm-install",
3493+
"image": "owncloudci/golang:latest",
3494+
"commands": [
3495+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3496+
"make helm-install-atomic",
3497+
],
3498+
"volumes": [
3499+
{
3500+
"name": "gopath",
3501+
"path": "/go",
3502+
},
3503+
],
3504+
}]

0 commit comments

Comments
 (0)