Skip to content

Unknown artifact media types should be handled more gracefully #153

@nkraetzschmar

Description

@nkraetzschmar

What happened:

Currently when a feature image script or builder wide image script outputs a new image artifact type the OCI upload in fails with

ValueError: Media type for {file_name} is not defined. You may want to add the definition to parse_features_lib

What you expected to happen:

Adding new outputs should not break OCI uploads. Ideally there would be a warning that some artifact types are not supported, but otherwise this error should be gracefully handled by still continuing with the upload for all other artifacts; i.e. lookup_media_type_for_file_name should be modified to return None instead of raising an exception if the artifact type is unknown.

Alternatively, if we want to enforce all artifacts have a media type mapping, then this mapping has to be moved into the features / builder scripts owning the corresponding image scripts. Having a split brain between the source of the image script and the python lib for something that is a hard required map causes needless maintenance headaches. One could for example extend the existing .artifacts file with a media type annotation1.

How to reproduce it (as minimally and precisely as possible):

https://github.com/gardenlinux/gardenlinux/actions/runs/16668198895

Footnotes

  1. This would require some spec version notation or similar in the artifacts file to maintain backwards compatibility, or some way to ensure old versions are not published with new python-gardenlinux-lib versions - contradictory to the direction proposed by https://github.com/gardenlinux/gardenlinux/pull/2955

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions