Support for Azure is added to most* of the scripts. For scripts to work
with Azure, az tool from azure-cli[1] package must be present in PATH.
Aside from usage strings, the scripts are not changed. The support is
added as specialization of generic functions in lib/ and helpers/.
Dockerfile is also updated to install azure-cli from Microsoft
repository.
* push-images.sh script is not updated as it needs bigger rewrite. It
doesn't use functions in lib/ and helpers/.
Currently the URL is constructed from $REGISTRY_URL and $NAMESPACE. This
works on Docker Hub and AWS ECR. However, in Azure CR, the namespace is
subdomain of azurecr.io. Base all API calls on $REGISTRY_NAMESPACE_URL
instead which is constructed in respective _login_$REGISTRY_registry1.
Put supported registries and namespaces into dictionary
Validation functions worked with data, registries and namespaces,
hardcoded. To simplify adding more registries and namespaces, put them
into single dictionary. The dictionary maps namespace names into
registry regexes.
print_manifest_for_image(): proper cleanup and return
The trap is replaced on each call of the function, so previously created
temporary files are not removed. Also on error return value is still 0.
Instead of checking for HTTP status, let the curl fail on non-success
status by passing -f switch.
This patch adds a Dockerfile which installs all needed dependencies to
run the image tagger. This should also serve as documentation on how to
properly set one's environment to run the image tagger scripts.
It's currently somewhat cumbersome to diagnose when an error happens
during the multi-arch tagging process. I thought I'd improve this by
saving the (possible) error message returned by the registry in a file
and then displaying it if appropriate.
A simpler option would be to pass "-o /dev/stderr" when invoking curl,
but I'm afraid that we might pollute the output with some unforseen
string being returned by the registry.