Skip to content
Snippets Groups Projects
Commit 4fd7f8a8 authored by Dmitry Petrov's avatar Dmitry Petrov
Browse files

report_image_diff: get rid of hardcode

Parse machines, pipeline names and distros from gitlab yaml file instead of
harcoding these values in the script.
parent 05d6a8db
No related branches found
No related tags found
1 merge request!395CI: handle_artifacts,image_diff: various fixes for pipeline in charge of preserving build artifacts
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import base64
import fnmatch import fnmatch
import logging import logging
import sys
from difflib import unified_diff from difflib import unified_diff
from gitlab import Gitlab from gitlab import Gitlab
from ruamel.yaml import YAML
import common import common
from buildartifacts import BuildArtifacts from buildartifacts import BuildArtifacts
...@@ -113,18 +116,36 @@ def main(): ...@@ -113,18 +116,36 @@ def main():
)[0] )[0]
build__mr = FullBuildPipeline(manifest_project, manifest_commit__mr.id) build__mr = FullBuildPipeline(manifest_project, manifest_commit__mr.id)
machines = ( yml_file = manifest_project.files.get(
"seco-genio510", file_path=".gitlab-ci.yml", ref=args.target_branch
"seco-genio700",
"seco-mx6",
"seco-mx6ull",
"seco-mx8mm",
"seco-mx8mp",
) )
pipelines_and_distros = { yaml = YAML(typ="safe")
"fngsystem-pipeline": "seconorth-fngsystem", yml_dict = yaml.load(base64.b64decode(yml_file.content).decode("utf-8"))
"yocto-pipeline": "seconorth-wayland", try:
} machines = yml_dict["generate-build-pipeline"]["variables"]["MACHINES"].split()
except KeyError:
sys.exit("Failed to extract MACHINES from .gitlab-ci.yml")
pipelines_and_distros = {}
for key in yml_dict.keys():
if not fnmatch.fnmatch(key, "*-pipeline"):
continue
if fnmatch.fnmatch(key, "generate-*") or fnmatch.fnmatch(key, "sdk-*"):
continue
try:
if yml_dict[key]["variables"]["MANUAL_BUILD"].lower() == "true":
continue
except KeyError:
pass
if fnmatch.fnmatch(key, "generate-*") or fnmatch.fnmatch(key, "sdk-*"):
continue
try:
pipelines_and_distros[key] = yml_dict[key]["variables"]["YOCTO_DISTRO"]
except KeyError:
sys.exit(f"Failed to extract YOCTO_DISTRO for '{key}' from .gitlab-ci.yml")
summary = "" summary = ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment