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