Skip to content

Strip path prefix when given an image name in .preflight-certification

Ryan Egesdahl requested to merge strip-slashes-from-given-image-name into main

When given an image name, we currently do not strip characters up to and including the final slash when creating _CERTIFY_IMAGE_NAME, which we use to name the PID file and the resulting report file. However, we do strip that prefix when we're not given an image name and we use CI_REGISTRY_IMAGE.

The assumption seems to be that we should never give an image name that contains a prefix; however, that limits us to never scanning images that we may place in a staging location to certify prior to release. On the other hand, it would work perfectly if the image name weren't specified, so the behavior isn't consistent between the two cases.

In this change, we strip the leading characters up to and including the final slash for both cases, which is consistent and lets us scan the image users want us to. The downside is that two images with the same "name" but in different "paths" could conflict if scanned in the same pipeline. This should be much less common than the "staging" example, though.

Changelog: fixed

Merge request reports

Loading