This commit is contained in:
2024-04-25 13:34:45 +02:00
parent 389e619e31
commit b0ca70f37d
3 changed files with 23 additions and 13 deletions

View File

@@ -44,7 +44,16 @@ def load_config(root_dir, ci_root_dir):
"""Load the configuration from the configuration directory.""" """Load the configuration from the configuration directory."""
ret = { ret = {
"files": [], "files": [],
"languages": ["markdown", "docker", "rust", "shell", "python", "yaml", "js", "make"], "languages": [
"markdown",
"docker",
"rust",
"shell",
"python",
"yaml",
"js",
"make",
],
"markdown": {"extentions": ["md"], "mdl-args": ["."]}, "markdown": {"extentions": ["md"], "mdl-args": ["."]},
"docker": {"extentions": ["Dockerfile"]}, "docker": {"extentions": ["Dockerfile"]},
"rust": {"extentions": ["rs"]}, "rust": {"extentions": ["rs"]},
@@ -58,16 +67,13 @@ def load_config(root_dir, ci_root_dir):
"extentions": ["yaml", "yml"], "extentions": ["yaml", "yml"],
"detect": True, "detect": True,
"ansible": {"enable": False}, "ansible": {"enable": False},
"kube": {"enable": False, "kubelint-args":[""]}, "kube": {"enable": False, "kubelint-args": [""]},
}, },
"js": { "js": {
"extentions": ["ts", "js"], "extentions": ["ts", "js"],
"files": ["package.json", "yarn.lock", "schema.prisma"], "files": ["package.json", "yarn.lock", "schema.prisma"],
}, },
"make": { "make": {"files": ["Makefile"], "checkmake-args": []},
"files": ["Makefile"],
"checkmake-args": []
},
} }
if not os.path.isdir(ci_root_dir): if not os.path.isdir(ci_root_dir):
return ret return ret
@@ -138,9 +144,9 @@ def append_stage(to, key, val, files):
if not key in to: if not key in to:
to[key] = [] to[key] = []
# Not possible right now # Not possible right now
#if "{basename}.yaml".format(basename=val) in files: # if "{basename}.yaml".format(basename=val) in files:
# to[key].append("{stage}-custom".format(stage=val)) # to[key].append("{stage}-custom".format(stage=val))
#else: # else:
to[key].append(val) to[key].append(val)
@@ -236,10 +242,14 @@ def get_results(config, files, root_dir):
else [] else []
), ),
"kubelint-args": ( "kubelint-args": (
config["yaml"]["kube"]["kubelint-args"] if "kube" in config["yaml"] and "kubelint-args" in config["yaml"]["kube"] else [] config["yaml"]["kube"]["kubelint-args"]
if "kube" in config["yaml"] and "kubelint-args" in config["yaml"]["kube"]
else []
), ),
"mdl-args": ( "mdl-args": (
config["markdown"]["mdl-args"] if "mdl-args" in config["markdown"] else ["."] config["markdown"]["mdl-args"]
if "mdl-args" in config["markdown"]
else ["."]
), ),
"black-args": ( "black-args": (
config["python"]["black-args"] if "black-args" in config["python"] else [] config["python"]["black-args"] if "black-args" in config["python"] else []
@@ -283,7 +293,7 @@ def get_results(config, files, root_dir):
if "{stage}-custom.yaml" in config["files"]: if "{stage}-custom.yaml" in config["files"]:
stages[stage].append("{stage}-custom") stages[stage].append("{stage}-custom")
# Unsupported by tekton... yet :P # Unsupported by tekton... yet :P
#if len(stages[stage])>0: # if len(stages[stage])>0:
# append_stage(stages, "global", "on-{stage}".format(stage = stage), config["files"]) # append_stage(stages, "global", "on-{stage}".format(stage = stage), config["files"])
return stages, args return stages, args

View File

@@ -265,7 +265,7 @@ spec:
- name: shared-workspace - name: shared-workspace
workspace: source workspace: source
- name: publish-docker - name: publish-docker
runAfter: ["lint-make","lint-shell","lint-docker","lint-yaml","lint-black","lint-python"] runAfter: ["lint-md","lint-kube","lint-make","lint-shell","lint-docker","lint-yaml","lint-black","lint-python"]
when: when:
- input: "publish-docker" - input: "publish-docker"
operator: in operator: in

View File

@@ -249,7 +249,7 @@ spec:
- name: shared-workspace - name: shared-workspace
workspace: source workspace: source
- name: publish-docker - name: publish-docker
runAfter: ["lint-shell","lint-docker","lint-yaml","lint-black","lint-python"] runAfter: ["lint-md","lint-kube","lint-make","lint-shell","lint-docker","lint-yaml","lint-black","lint-python"]
when: when:
- input: "publish-docker" - input: "publish-docker"
operator: in operator: in