Skip to content

Commit c0825b8

Browse files
committed
helm setup to run tests
1 parent 4d5fba1 commit c0825b8

File tree

1 file changed

+123
-38
lines changed

1 file changed

+123
-38
lines changed

.drone.star

Lines changed: 123 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -474,46 +474,43 @@ def main(ctx):
474474

475475
pipelines = []
476476

477-
build_release_helpers = \
478-
changelog() + \
479-
docs() + \
480-
licenseCheck(ctx) + \
481-
deleteStaleBranches(ctx)
477+
# build_release_helpers = \
478+
# changelog() + \
479+
# docs() + \
480+
# licenseCheck(ctx)
482481

483482
test_pipelines = \
484-
codestyle(ctx) + \
485-
checkGherkinLint(ctx) + \
486-
checkTestSuitesInExpectedFailures(ctx) + \
487-
buildWebCache(ctx) + \
488-
getGoBinForTesting(ctx) + \
489-
buildOcisBinaryForTesting(ctx) + \
490-
checkStarlark() + \
491-
build_release_helpers + \
492-
testOcisAndUploadResults(ctx) + \
493-
testPipelines(ctx)
494-
495-
build_release_pipelines = \
496-
dockerReleases(ctx) + \
497-
binaryReleases(ctx)
498-
499-
test_pipelines.append(
500-
pipelineDependsOn(
501-
purgeBuildArtifactCache(ctx),
502-
testPipelines(ctx),
503-
),
504-
)
505-
506-
test_pipelines.append(
507-
pipelineDependsOn(
508-
uploadAPITestCoverageReport(ctx),
509-
testPipelines(ctx),
510-
),
511-
)
512-
513-
pipelines = test_pipelines + build_release_pipelines
514-
515-
# nightly Trivy security scan (non-blocking)
516-
pipelines.append(trivyScan(ctx))
483+
deployments(ctx)
484+
# codestyle(ctx) + \
485+
# checkGherkinLint(ctx) + \
486+
# checkTestSuitesInExpectedFailures(ctx) + \
487+
# buildWebCache(ctx) + \
488+
# getGoBinForTesting(ctx) + \
489+
# buildOcisBinaryForTesting(ctx) + \
490+
# checkStarlark() + \
491+
# build_release_helpers + \
492+
# testOcisAndUploadResults(ctx) + \
493+
# testPipelines(ctx) + \
494+
495+
# build_release_pipelines = \
496+
# dockerReleases(ctx) + \
497+
# binaryReleases(ctx)
498+
499+
# test_pipelines.append(
500+
# pipelineDependsOn(
501+
# purgeBuildArtifactCache(ctx),
502+
# testPipelines(ctx),
503+
# ),
504+
# )
505+
506+
# test_pipelines.append(
507+
# pipelineDependsOn(
508+
# uploadAPITestCoverageReport(ctx),
509+
# testPipelines(ctx),
510+
# ),
511+
# )
512+
513+
pipelines = deployments(ctx) #test_pipelines + build_release_pipelines
517514

518515
if ctx.build.event == "cron":
519516
pipelines = \
@@ -3754,3 +3751,91 @@ def trivyScan(ctx):
37543751
],
37553752
},
37563753
}
3754+
3755+
def deployments(ctx):
3756+
result = {
3757+
"kind": "pipeline",
3758+
"type": "docker",
3759+
"name": "k3d",
3760+
"privileged": True,
3761+
"steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx),
3762+
"services": [
3763+
{
3764+
"name": "k3d",
3765+
"image": "ghcr.io/k3d-io/k3d:5-dind",
3766+
"user": "root",
3767+
"commands": [
3768+
"git clone https://github.com/owncloud/ocis-charts.git",
3769+
"cd ocis-charts",
3770+
"nohup dockerd-entrypoint.sh &",
3771+
"until docker ps 2>&1 > /dev/null; do sleep 1s; done",
3772+
"k3d cluster create --config ci/k3d-drone.yaml --api-port k3d:6445",
3773+
"until kubectl get deployment coredns -n kube-system -o go-template='{{.status.availableReplicas}}' | grep -v -e '<no value>'; do sleep 1s; done",
3774+
"k3d kubeconfig get drone > kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3775+
"chmod 0600 kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3776+
"printf '@@@@@@@@@@@@@@@@@@@@@@@\n@@@@ k3d is ready @@@@\n@@@@@@@@@@@@@@@@@@@@@@@\n'",
3777+
"kubectl get events -Aw",
3778+
],
3779+
},
3780+
],
3781+
"depends_on": [],
3782+
"volumes": [
3783+
{
3784+
"name": "gopath",
3785+
"temp": {},
3786+
},
3787+
],
3788+
"trigger": {
3789+
"ref": [
3790+
"refs/pull/**",
3791+
],
3792+
},
3793+
}
3794+
3795+
result["trigger"]["ref"].append("refs/heads/master")
3796+
3797+
return [result]
3798+
3799+
def wait(config):
3800+
return [{
3801+
"name": "wait",
3802+
"image": "docker.io/bitnami/kubectl:1.31",
3803+
"user": "root",
3804+
"commands": [
3805+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3806+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3807+
"kubectl config view",
3808+
"kubectl get pods -A",
3809+
],
3810+
}]
3811+
3812+
def showPodsAfterInstall(config):
3813+
return [{
3814+
"name": "testPodsAfterInstall",
3815+
"image": "docker.io/bitnami/kubectl:1.31",
3816+
"user": "root",
3817+
"commands": [
3818+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3819+
"until test -f $${KUBECONFIG}; do sleep 1s; done",
3820+
"kubectl get pods -n ocis",
3821+
"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
3822+
"kubectl get ingress -n ocis",
3823+
"if [ \"$(kubectl get ingress -n ocis | wc -l)\" -le \"1\" ]; then exit 1; fi",
3824+
],
3825+
}]
3826+
3827+
def install(ctx):
3828+
return [{
3829+
"name": "helm-install",
3830+
"image": "owncloudci/golang:latest",
3831+
"commands": [
3832+
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
3833+
"make helm-install-atomic",
3834+
],
3835+
"volumes": [
3836+
{
3837+
"name": "gopath",
3838+
"path": "/go",
3839+
},
3840+
],
3841+
}]

0 commit comments

Comments
 (0)