Skip to content

Commit

Permalink
trigger k6 test in CI
Browse files Browse the repository at this point in the history
starlark formay fix

use secrets which enabled for pull requests

do not fail ocis-log and open-grafana-dashboard
  • Loading branch information
ScharfViktor committed Oct 15, 2024
1 parent cc63a8b commit 3e6ea4f
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ def main(ctx):
),
)

pipelines = pipelines + k6LoadTests(ctx)

pipelineSanityChecks(ctx, pipelines)
return pipelines

Expand Down Expand Up @@ -419,6 +417,9 @@ def testPipelines(ctx):

pipelines += e2eTestPipeline(ctx)

if ("skip" not in config["k6LoadTests"] or not config["k6LoadTests"]["skip"]) and ("k6-test" in ctx.build.title.lower() or ctx.build.event == "cron"):
pipelines.append(k6LoadTests(ctx))

return pipelines

def getGoBinForTesting(ctx):
Expand Down Expand Up @@ -2973,27 +2974,27 @@ def logRequests():
def k6LoadTests(ctx):
ocis_remote_environment = {
"SSH_OCIS_REMOTE": {
"from_secret": "ssh_ocis_remote",
"from_secret": "k6_ssh_ocis_remote",
},
"SSH_OCIS_USERNAME": {
"from_secret": "ssh_ocis_user",
"from_secret": "k6_ssh_ocis_user",
},
"SSH_OCIS_PASSWORD": {
"from_secret": "ssh_ocis_pass",
"from_secret": "k6_ssh_ocis_pass",
},
"TEST_SERVER_URL": {
"from_secret": "ssh_ocis_server_url",
"from_secret": "k6_ssh_ocis_server_url",
},
}
k6_remote_environment = {
"SSH_K6_REMOTE": {
"from_secret": "ssh_k6_remote",
"from_secret": "k6_ssh_k6_remote",
},
"SSH_K6_USERNAME": {
"from_secret": "ssh_k6_user",
"from_secret": "k6_ssh_k6_user",
},
"SSH_K6_PASSWORD": {
"from_secret": "ssh_k6_pass",
"from_secret": "k6_ssh_k6_pass",
},
}
environment = {}
Expand All @@ -3005,6 +3006,12 @@ def k6LoadTests(ctx):

ocis_git_base_url = "https://raw.githubusercontent.com/owncloud/ocis"
script_link = "%s/%s/tests/config/drone/run_k6_tests.sh" % (ocis_git_base_url, ctx.build.commit)

event_array = ["cron"]

if "k6-test" in ctx.build.title.lower():
event_array.append("pull_request")

return [{
"kind": "pipeline",
"type": "docker",
Expand Down Expand Up @@ -3032,20 +3039,30 @@ def k6LoadTests(ctx):
"apk add --no-cache openssh-client sshpass",
"sh %s/run_k6_tests.sh --ocis-log" % (dirs["base"]),
],
"when": {
"status": [
"success",
"failure",
],
},
},
{
"name": "open-grafana-dashboard",
"image": OC_CI_ALPINE,
"commands": [
"echo 'Grafana Dashboard: https://grafana.k6.infra.owncloud.works'",
],
"when": {
"status": [
"success",
"failure",
],
},
},
],
"depends_on": [],
"trigger": {
"event": [
"cron",
],
"event": event_array,
},
}]

Expand Down

0 comments on commit 3e6ea4f

Please sign in to comment.