@@ -1108,19 +1108,19 @@ def localApiTestPipeline(ctx):
11081108 ([] if run_on_k8s else restoreBuildArtifactCache (ctx , "ocis-binary-amd64" , "ocis/bin" )) +
11091109 (tikaService () if params ["tikaNeeded" ] and not run_on_k8s else tikaServiceK8s () if params ["tikaNeeded" ] and run_on_k8s else []) +
11101110 (waitForServices ("online-offices" , ["collabora:9980" , "onlyoffice:443" , "fakeoffice:8080" ]) if params ["collaborationServiceNeeded" ] else []) +
1111- (waitK3sCluster () + deployOcis () + waitForOcis (ocis_url = ocis_url ) + ociswrapper () + waitForOciswrapper () if run_on_k8s else ocisServer (storage , extra_server_environment = params ["extraServerEnvironment" ], with_wrapper = True , tika_enabled = params ["tikaNeeded" ], volumes = ([stepVolumeOcisStorage ]))) +
1112- (waitForClamavService () if params ["antivirusNeeded" ] else []) +
1113- (waitForEmailService () if params ["emailNeeded" ] else []) +
1111+ (waitK3sCluster () + ( clamavServiceK8s () if params [ "antivirusNeeded" ] and run_on_k8s else []) + ( emailServiceK8s () if params [ "emailNeeded" ] and run_on_k8s else []) + deployOcis () + waitForOcis (ocis_url = ocis_url ) + ociswrapper () + waitForOciswrapper () if run_on_k8s else ocisServer (storage , extra_server_environment = params ["extraServerEnvironment" ], with_wrapper = True , tika_enabled = params ["tikaNeeded" ], volumes = ([stepVolumeOcisStorage ]))) +
1112+ (waitForClamavService () if params ["antivirusNeeded" ] and not run_on_k8s else exposeAntivirusServiceK8s () if params [ "antivirusNeeded" ] and run_on_k8s else []) +
1113+ (waitForEmailService () if params ["emailNeeded" ] and not run_on_k8s else exposeEmailServiceK8s () if params [ "emailNeeded" ] and run_on_k8s else []) +
11141114 (ocisServer (storage , deploy_type = "federation" , extra_server_environment = params ["extraServerEnvironment" ]) if params ["federationServer" ] else []) +
11151115 ((wopiCollaborationService ("fakeoffice" ) + wopiCollaborationService ("collabora" ) + wopiCollaborationService ("onlyoffice" )) if params ["collaborationServiceNeeded" ] else []) +
11161116 (ocisHealthCheck ("wopi" , ["wopi-collabora:9304" , "wopi-onlyoffice:9304" , "wopi-fakeoffice:9304" ]) if params ["collaborationServiceNeeded" ] else []) +
11171117 localApiTests (name , params ["suites" ], storage , params ["extraEnvironment" ], run_with_remote_php , ocis_url = ocis_url , k8s = run_on_k8s ) +
11181118 apiTestFailureLog () +
11191119 (generateCoverageFromAPITest (ctx , name ) if not run_on_k8s else []),
1120- "services" : (emailService () if params [ "emailNeeded" ] else []) +
1121- (clamavService () if params ["antivirusNeeded" ] else []) +
1122- (( fakeOffice () + collaboraService () + onlyofficeService ()) if params ["collaborationServiceNeeded" ] else []) +
1123- (k3sCluster () if run_on_k8s else []),
1120+ "services" : (k3sCluster () if run_on_k8s else []) +
1121+ (emailService () if params ["emailNeeded" ] and not run_on_k8s else []) +
1122+ (clamavService () if params ["antivirusNeeded" ] and not run_on_k8s else []) +
1123+ (( fakeOffice () + collaboraService () + onlyofficeService ()) if params [ "collaborationServiceNeeded" ] else []),
11241124 "depends_on" : getPipelineNames (buildOcisBinaryForTesting (ctx )),
11251125 "trigger" : {
11261126 "ref" : [
@@ -3836,6 +3836,49 @@ def deployOcis():
38363836 ],
38373837 }]
38383838
3839+ def clamavServiceK8s ():
3840+ return [{
3841+ "name" : "clamav" ,
3842+ "image" : OC_CI_ALPINE ,
3843+ "commands" : [
3844+ "cp -r %s/tests/config/drone/k8s/clamav %s/ocis-charts/charts/ocis/templates/" % (dirs ["base" ], dirs ["base" ]),
3845+ "sed -i 's/{{ *\\ \\ .Values\\ \\ .features\\ \\ .virusscan\\ \\ .infectedFileHandling *| *quote *}}/\" delete\" /' %s/ocis-charts/charts/ocis/templates/antivirus/deployment.yaml" % dirs ["base" ],
3846+ "sed -i 's/{{ *\\ \\ .Values\\ \\ .features\\ \\ .virusscan\\ \\ .infectedFileHandling *| *quote *}}/\" delete\" /' %s/ocis-charts/charts/ocis/templates/antivirus/deployment.yaml" % dirs ["base" ],
3847+ "sed -i '/name: ANTIVIRUS_SCANNER_TYPE/{n;s/value: *\" icap\" /value: \" clamav\" /}' %s/ocis-charts/charts/ocis/templates/antivirus/deployment.yaml" % dirs ["base" ],
3848+ "sed -i '/- name: ANTIVIRUS_SCANNER_TYPE/i\\ \\ - name: ANTIVIRUS_CLAMAV_SOCKET\\ \n value: \" tcp://clamav:3310\" ' %s/ocis-charts/charts/ocis/templates/antivirus/deployment.yaml" % dirs ["base" ],
3849+ ],
3850+ }]
3851+
3852+ def emailServiceK8s ():
3853+ return [{
3854+ "name" : "copy-%s-service" % EMAIL_SMTP_HOST ,
3855+ "image" : OC_CI_ALPINE ,
3856+ "commands" : [
3857+ "cp -r %s/tests/config/drone/k8s/mailpit %s/ocis-charts/charts/ocis/templates/" % (dirs ["base" ], dirs ["base" ]),
3858+ ],
3859+ }]
3860+
3861+ def exposeEmailServiceK8s ():
3862+ return [{
3863+ "name" : EMAIL_SMTP_HOST ,
3864+ "image" : "ghcr.io/k3d-io/k3d:5-dind" ,
3865+ "commands" : [
3866+ "kubectl port-forward svc/mailpit %s:%s -n ocis" % (EMAIL_PORT , EMAIL_PORT ),
3867+ "kubectl port-forward svc/mailpit 9174:9174 -n ocis" ,
3868+ ],
3869+ "detach" : True ,
3870+ }]
3871+
3872+ def exposeAntivirusServiceK8s ():
3873+ return [{
3874+ "name" : EMAIL_SMTP_HOST ,
3875+ "image" : "ghcr.io/k3d-io/k3d:5-dind" ,
3876+ "commands" : [
3877+ "kubectl port-forward svc/antivirus 9297:9277 -n ocis" ,
3878+ ],
3879+ "detach" : True ,
3880+ }]
3881+
38393882def ociswrapper ():
38403883 return [{
38413884 "name" : "ociswrapper" ,
@@ -3846,6 +3889,8 @@ def ociswrapper():
38463889 "until test -f $${KUBECONFIG}; do sleep 1s; done" ,
38473890 "kubectl get pods -A" ,
38483891 "kubectl get ingress -A" ,
3892+ "kubectl describe pods $(kubectl get pods -n ocis -l app=antivirus -o jsonpath=\" {.items[0].metadata.name}\" ) -n ocis" ,
3893+ "kubectl describe pods $(kubectl get pods -n ocis -l app=postprocessing -o jsonpath=\" {.items[0].metadata.name}\" ) -n ocis" ,
38493894 "%s/bin/ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run" % dirs ["ocisWrapper" ],
38503895 ],
38513896 "detach" : True ,
0 commit comments