pipeline: handle exit_with_target_not_supported_error() (retcode 44) as warning and not error

- split errors and warnings into multiple lines, so a bit easier to see in the logs what the real error was
- also turn down a few spurious warnings to debugs
This commit is contained in:
Ricardo Pardini
2023-08-23 18:28:14 +02:00
committed by Igor
parent 688e415832
commit 274d394ab2
3 changed files with 22 additions and 12 deletions

View File

@@ -363,9 +363,16 @@ def armbian_run_command_and_parse_json_from_stdout(exec_cmd: list[str], params:
except subprocess.CalledProcessError as e:
# decode utf8 manually, universal_newlines messes up bash encoding
logs = parse_log_lines_from_stderr(e.stderr)
log.error(f"Error calling Armbian command: {' '.join(exec_cmd)}")
log.error(f"Error details: params: {params} - return code: {e.returncode} - stderr: {'; '.join(logs[-5:])}")
return {"in": params, "out": {}, "logs": logs, "config_ok": False}
if e.returncode == 44:
# special handling for exit_with_target_not_supported_error() in armbian core.
log.warning(f"Skipped target: {' '.join(exec_cmd)}")
log.warning(f"Skipped target details 1: {'; '.join(logs[-5:])}")
return {"in": params, "out": {}, "logs": logs, "config_ok": False, "target_not_supported": True}
else:
log.error(f"Error calling Armbian command: {' '.join(exec_cmd)}")
log.error(f"Error details 1: params: {params}")
log.error(f"Error details 2: code: {e.returncode} - {'; '.join(logs[-5:])}")
return {"in": params, "out": {}, "logs": logs, "config_ok": False}
if result is not None:
if result.stderr:

View File

@@ -27,8 +27,11 @@ all_artifacts: list[dict] = []
# loop over the build infos. for each, construct a structure with the artifacts.
for build_info in build_infos:
if build_info["config_ok"] == False:
log.warning(f"Skipping failed config '{build_info['in']}'...")
if build_info["config_ok"] is False:
if ("target_not_supported" in build_info) and (build_info["target_not_supported"] is True):
log.debug(f"Skipping 'target not supported' config '{build_info['in']}'...")
else:
log.warning(f"Skipping *failed* config '{build_info['in']}'...")
continue
outvars = build_info["out"]
@@ -52,17 +55,17 @@ for build_info in build_infos:
pipeline = build_info["in"]["pipeline"]
if "build-artifacts" in pipeline:
if pipeline["build-artifacts"] == False:
log.warning(f"Skipping artifact '{artifact_name}' (pipeline build-artifacts '{pipeline['build-artifacts']}' config)...")
log.debug(f"Skipping artifact '{artifact_name}' (pipeline build-artifacts '{pipeline['build-artifacts']}' config)...")
continue
else:
log.warning(f"Keeping artifact '{artifact_name}' (pipeline build-artifacts '{pipeline['build-artifacts']}' config)...")
log.debug(f"Keeping artifact '{artifact_name}' (pipeline build-artifacts '{pipeline['build-artifacts']}' config)...")
if "only-artifacts" in pipeline:
only_artifacts = pipeline["only-artifacts"]
if artifact_name not in only_artifacts:
log.warning(f"Skipping artifact '{artifact_name}' (pipeline only-artifacts '{','.join(only_artifacts)}' config)...")
log.debug(f"Skipping artifact '{artifact_name}' (pipeline only-artifacts '{','.join(only_artifacts)}' config)...")
continue
else:
log.warning(f"Keeping artifact '{artifact_name}' (pipeline only-artifacts '{','.join(only_artifacts)}' config)...")
log.debug(f"Keeping artifact '{artifact_name}' (pipeline only-artifacts '{','.join(only_artifacts)}' config)...")
inputs: dict[str, str] = {}
for input_raw in inputs_raw_array:

View File

@@ -57,7 +57,7 @@ for oci_name in tags_by_oci_name:
if len(tags) > 1:
list_tags_escaped_quoted = ', '.join([f"'{tag}'" for tag in tags])
log.warning(
f"Artifact '{oci_name}' has {len(tags)} different tags: {list_tags_escaped_quoted} - this is certainly a problem, go fix the artifact.")
f"Artifact '{oci_name}' has {len(tags)} different tags: {list_tags_escaped_quoted}")
# map images to in.target_id
images_by_target_id = {}
@@ -107,10 +107,10 @@ for target_id, image in images_by_target_id.items():
if "pipeline" in image["in"]:
if "build-image" in image["in"]["pipeline"]:
if not image["in"]["pipeline"]["build-image"]:
log.warning(f"Image {image['in']['target_id']} has a pipeline build-image false, skipping")
log.debug(f"Image {image['in']['target_id']} has a pipeline build-image false, skipping")
continue
else:
log.warning(f"Image {image['in']['target_id']} has a pipeline build-image true, processing")
log.debug(f"Image {image['in']['target_id']} has a pipeline build-image true, processing")
if target_id not in artifacts_by_target_id:
continue