There's a long story here -- usually I randomly visit repositories and offer spelling fixes. But in this case, I'm actually trying to fix a real problem in another repository and hoping to use manifest-tool to achieve that.
The main goal is to be able to add a new tag (latest) to a specific image. But, my testing environment doesn't have enough things (and I don't have write access to docker hub), so I'm cheating by trying to copy an image from docker hub to gcr.io.
Anyway, here's the step's I'm taking:
use inspect to get a list of images (in a format that I get to massage)
cat that file (or use manifest-tool on busybox:latest, which in theory is what i'm trying to do, but, I don't want to upset docker hub limits -- I did that while trying to make a PR to add manifest-tool to brew.sh...) and convert it into a format that would be compatible w/ manifest-tool push
FATA[0000] Cannot use source images from a different registry than the target image: docker.io != gcr.io
The early part tells me that there are different registries at play.
The later part tells me which the registries are.
It doesn't clearly indicate which is the source registry and which is the target registry. (Yes, there's some general sense of parallelism / distribution in English, but error messages are not a great place to assume that. Being explicit is really valuable. Devs are used to people not being consistent in their error messages.)
This would be easier to read:
FATA[0000] Cannot use source images from a registry (docker.io) different than the target image (gcr.io)
But, it'd probably be better to use full image tags instead of just registry names. I have no idea what docker.io is in this context. Or even what gcr.io is. My manifest only has one gcr.io. It turns out that the image things I generated were bad (and needed to have a prefix) and thus they were defaulting to docker.io.
Had the message said:
FATA[0000] Cannot use source image (docker.io/sha256:dcdf379c574e1773d703f0c0d56d67594e7a91d6b84d11ff46799f60fb081c52) from a registry (docker.io) different than the target image (gcr.io/$GCR_PROJECT/josh/busybox:latest)
It would have been much clearer what I did wrong.
Note that I'm removing the s from images. The code in question is iterating over the list and failing at first fault. It has a specific image in mind, and might as well report that image. The human running the program will deduce that the error applies to all future images and not just the one.
If there's a longer list (I only have 2 here), then telling me the specific image to look for in the longer list will make it much easier to debug what's going on than giving me a generic warning about repositories.
There's a long story here -- usually I randomly visit repositories and offer spelling fixes. But in this case, I'm actually trying to fix a real problem in another repository and hoping to use manifest-tool to achieve that.
The main goal is to be able to add a new tag (
latest
) to a specific image. But, my testing environment doesn't have enough things (and I don't have write access to docker hub), so I'm cheating by trying to copy an image from docker hub to gcr.io.Anyway, here's the step's I'm taking:
inspect
to get a list of images (in a format that I get to massage)manifest-tool
to brew.sh...) and convert it into a format that would be compatible w/manifest-tool push
push
to create a new tag for my imageThis message is problematic:
This would be easier to read:
But, it'd probably be better to use full image tags instead of just registry names. I have no idea what
docker.io
is in this context. Or even whatgcr.io
is. My manifest only has onegcr.io
. It turns out that theimage
things I generated were bad (and needed to have a prefix) and thus they were defaulting to docker.io.Had the message said:
It would have been much clearer what I did wrong.
Note that I'm removing the
s
fromimages
. The code in question is iterating over the list and failing at first fault. It has a specific image in mind, and might as well report that image. The human running the program will deduce that the error applies to all future images and not just the one.If there's a longer list (I only have 2 here), then telling me the specific image to look for in the longer list will make it much easier to debug what's going on than giving me a generic warning about repositories.
Here's a fixed version of my script
```sh (cat foox || manifest-tool inspect busybox:latest) |perl -e 'while (<>) { if (/^Name:\s+(\S+):/) { $name=$1; print "image: $name:latest\n"."manifests:\n"; } elsif (/Digest: (\S+)/) { $digest=$1; } elsif (/OS: (\S+)/) { $os=$1; } elsif (/Arch: (\S+)/) {print "- image: $name\@$digest\n platform:\n architecture: $1\n os: $os\n"; $os=""; $digest=""; } }' > fooy ```