From f5dd86a4e1e26a52a98d504986b1671ceb81c916 Mon Sep 17 00:00:00 2001 From: saw-jan Date: Mon, 20 Dec 2021 10:56:18 +0545 Subject: [PATCH] generate trigger as per the event --- .drone.star | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.drone.star b/.drone.star index 7173fccbe94..f3251688403 100644 --- a/.drone.star +++ b/.drone.star @@ -61,6 +61,7 @@ config = { ], "skip": False, "earlyFail": True, + "cron": "nightly", }, "apiWebdav": { "suites": [ @@ -68,6 +69,7 @@ config = { ], "skip": False, "earlyFail": True, + "cron": "nightly", }, }, "rocketchat": { @@ -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"] @@ -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