Skip to content

Commit

Permalink
generate trigger as per the event
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Dec 21, 2021
1 parent 74eedb3 commit f5dd86a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ config = {
],
"skip": False,
"earlyFail": True,
"cron": "nightly",
},
"apiWebdav": {
"suites": [
"apiWebdavOperations",
],
"skip": False,
"earlyFail": True,
"cron": "nightly",
},
},
"rocketchat": {
Expand Down Expand Up @@ -1937,23 +1939,23 @@ def parallelDeployAcceptancePipeline(ctx):
"filterTags": "~@skip",
}

for category, matrix in config["parallelApiTests"].items():
if "skip" in matrix and matrix["skip"]:
for category, params in config["parallelApiTests"].items():
if "skip" in params and params["skip"]:
return pipelines

early_fail = matrix["earlyFail"] if "earlyFail" in matrix else False
early_fail = params["earlyFail"] if "earlyFail" in params else False

if type(matrix["suites"]) == "list":
if type(params["suites"]) == "list":
suites = {}
for suite in matrix["suites"]:
for suite in params["suites"]:
suites[suite] = suite
else:
suites = matrix["suites"]
suites = params["suites"]

for suite, suiteName in suites.items():
params = {}
for item in default:
params[item] = matrix[item] if item in matrix else default[item]
params[item] = params[item] if item in params else default[item]

environment = {}
environment["BEHAT_FILTER_TAGS"] = params["filterTags"]
Expand Down Expand Up @@ -1989,15 +1991,18 @@ def parallelDeployAcceptancePipeline(ctx):
pipeOCISConfigVol,
pipelineVolumeOC10Tests,
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
# "cron": "nightly",
},
"trigger": {},
}

if (ctx.build.event == "cron"):
pipeline["trigger"]["cron"] = params["cron"] if "cron" in params and params["cron"] != "" else "nightly"
else:
pipeline["trigger"]["ref"] = [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
]

pipelines.append(pipeline)

return pipelines
Expand Down

0 comments on commit f5dd86a

Please sign in to comment.