← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~cjwatson/launchpad:scan-generic-detect-float-version into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/soyuz/model/archivejob.py b/lib/lp/soyuz/model/archivejob.py
> index f73cec1..0d9bf2c 100644
> --- a/lib/lp/soyuz/model/archivejob.py
> +++ b/lib/lp/soyuz/model/archivejob.py
> @@ -623,6 +623,14 @@ class CIBuildUploadJob(ArchiveJobDerived):
>              or "version" not in properties
>          ):
>              return {}
> +        if not isinstance(properties["version"], str):
> +            logger.warning(
> +                "Failed to scan generic artifacts: expected version to be a "
> +                "string, got %r (%s)",
> +                properties["version"],
> +                type(properties["version"]).__name__,
> +            )
> +            return {}

I wondered whether it would be possible to check the data already at an earlier stage. From a high level this sounded like a thing pydantic should take care of, ie validation/conversion. The version is passed into the process via output.properties, right? But these are generic key/value pairs. Or could we already make the build fail when version is not a string?

>  
>          all_metadata = {}
>          for path in paths:


-- 
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/430891
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:scan-generic-detect-float-version into launchpad:master.



References