images - expand name parsing to support digests
Curently the name parsing for harbour containers assumes quite a lot and thus is a reasonably fragile interface.
The really correct thing to do here would be:
- If the image does not have a hostname in the uri, then add the harbour host from config to the uri
- If the host in the uri matches the harbour host, then do get_harbor_images_for_name
- If not then do image_by_container_url, or raise
Unfortunatly we have logic around job config (e.g. mount defaults based
on buildpack) tied to Image and Image gets driven from the string...
For now expand the current parsing to support extended variants of the image, specifically:
- With the host specified (though ignore it)
- With a digest passed (and respect it)
Note: This does mean that for any image coming from harbour, the job spec will now be configured with the image digest.
This is intended to be the behaviour with components/build service (WIP) and is generally good as it provides assurance and is cache safe.
It will be noticable to users in the following cases:
-
The exported job (dump) will be modified, if the digest is not returned (builds-api does not return it today, WIP) - this is cosmetic and jobs-api has changed the format numerous times before.
-
If an image is re-built, the job needs to be re-created, this is the expected behaviour with components and any job "restarted" via the API will just work. It will break things that have been built via build-service, but then are managed outside of jobs (e.g. restarts), but that is quite an edge case to have been created via jobs, but then managed outside.
This has a side effect that for any image coming from harbour, the job will get configured with an image digest.
Needed-by: components-api!143 (merged)
Bug: T403322