ServiceWeaver / weaver-kube

Run Service Weaver applications on vanilla Kubernetes.
Apache License 2.0
61 stars 19 forks source link

Check for error when uploading container image #16

Closed edigaryev closed 1 year ago

edigaryev commented 1 year ago

Problem: simply calling Docker's client ImagePush() method and checking for err != nil is not sufficient to detect all errors that might arise during the image uploading.

Here's an example of running waver-kube@main without being authenticated against Docker Hub:

Uploading Image edigaryev/weaver-service:tag33f0a7a7 to Docker Hub ...
{"status":"The push refers to repository [docker.io/edigaryev/weaver-service]"}
{"errorDetail":{"message":"An image does not exist locally with the tag: edigaryev/weaver-service"},"error":"An image does not exist locally with the tag: edigaryev/weaver-service"}

Generating kube deployment info ...
[...]
kube deployment information successfully generated in kube_33f0a7a7-2ead-4610-8d15-ec40538e6900.yaml

As you can see, a fatal error arises when uploading the image, but weaver-kube continues as if everything is OK.

Solution: parse each line of the ImagePush() output stream as JSON and look for errors.

spetrovic77 commented 1 year ago

Thanks for making this change @edigaryev

We talked about it and decided it's best to use the docker command, rather than the (clearly buggy) client libraries. Please see PR#14.

Thanks for taking an interest and contributing!

edigaryev commented 1 year ago

@spetrovic77 can you elaborate a bit more on the buggy Docker client?

I.e. do you have ImagePush() method not returning the error in mind, or are there other issues that @ServiceWeaver faced when working with Docker client?

Thanks!