-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insecure-registry flag is not used when pushing referenced images #2020
Comments
I am guessing that the images you are referencing are not public? You can authenticate to a private registry by running |
our registry repo is private but authenticated with username/password. docker login my-registry.com succeeds. But I still get the same error when I run porter publish. BTW - as mentioned above, porter publish works fine if I pass --reference flag with value as assets image. |
When you specify --registry, it overrides the calculated destination where the bundle is pushed. When you set --reference porter doesn't even try to calculate the destination. After that the commands are exactly the same, so it appears to be a problem with your authorization to the calculated destination. Real quick, which version of Porter are you using? Older versions push to different destinations than the new versions of Porter. |
Thank you for the response. I tried with latest v1.0.0-alpha.19, I get the same error. |
If we remove the images section from porter.yaml, porter publish with same registry works. Looks like --insecure-registry is not being passed to the next set of calls. For example, in the error messages below, main app image nginx pushed but the next image is assets-nginx (comes from image section) is failed to copy.
|
Thanks for identifying the problem! I'll flag this as a bug and add it to the v1 milestone. |
Thank you. In the meantime, can you suggest any workaround? |
Not really sorry. Someone just needs to look into how we pass insecure-registry to our cnab-to-oci calls and fix how it's passed. |
okay - we were debugging cnab-to-oci library code, yet to figure out the fix |
I think I have the problem reproducing? It's not the same error, yours is oauth, mine is about certs signed by unknown authorities. I checked how we are calling cnab-to-oci and we are setting the registry as insecure so I'm not 100% sure what's causing the problem. I'm not sure why you get an oauth error, are you using docker registry or is it behind more layers of middleware? |
I guess I am assuming that your registry is using a self-signed certificate, is that the case? |
we use harbor registry with credentials and self-signed certs. We do docker login before push and we pass --insecure-registry flag. In your case, is your registry have credentials? |
Yeah I configured the registry with a self signed cert (I'm using docker registry directly). I'm not sure that what I am doing locally is reproducing what you are seeing. Can you look in the logs about that 500 error? That doesn't seem like a problem with ignoring the self-signed certs, if the request made it to the server and then the server errored out. |
First of all, appreciate the help @carolynvs. if it were an issue on local host we shouldn't be able to push any images, right? This works:
This does not:
Both those steps are executed in the same build context. The only diff between the two images is that the second one is listed under the "images" section in porter.yaml. |
okay - if your docker registry is not configured with credentials, can you please set credentials and give it a try. In our case, it appears that credentials are not honored when copying 2nd image. |
ah okay the referenced image I was testing with wasn't on a private registry. Trying that out now |
So I pulled the carolynvs/whalesayd image from docker and pushed it to my private registry (which is using credentials, via htpasswd, not oauth). Then I updated the examples/airgap bundle to reference the image in the private registry.
Are you able to pull that image that isn't working using the same creds that you are using with porter? |
okay - thank you for trying that. Here is the docker put output
|
Sorry I'm stumped, with without being able to reproduce locally I'm not sure how to help debug this. I have a branch of cnab-to-oci that prints out additional error messages that may help narrow down where in fixupBundle the call is failing if you want to try to debug locally cnabio/cnab-to-oci#113 |
Thank you.. Can you please share your porter.yaml and bundle.json you used for reproducing. To debug with this branch cnabio/cnab-to-oci#113, I can run below command right?
|
I tried to test with your branch.
DEBU[0001] Fixing up bundle bd-harbor-registry.mip.storage.xxxx.net/develop/prakash
0.1.1: Pulling from develop/prakash/helloworld Here is the bundle.json
|
cnab-to-oci push worked after adding digest and size params to the InvocationImages{}. |
quick update: In the images section ( of porter.yaml), tried to use my private docker repo instead of our internal harbor registry, this time porter publish command worked. Looks like remotes.CreateResolver() is not returning correct remotes.Resolver for the internal registry. |
Is there anything unique about the internal harbor registry? Is it a vanilla installation of harbor 2 that uses oauth? |
A few of my observations for this issue: I don't believe this is a problem with propagation of the --insecure-registry flag for referenced images. We've not had to use that flag when publishing to our harbor registry since porter/cnab-to-oci was fixed a while back. This only seems to happen when referencing an image from the same harbor registry. There seems to be a problem when uploading (POSTing) the blob to the target. But it's inconsistent. I had one bundle that would successfully publish and another bundle that referenced the same image that failed consistently. After deleting and retrying the successfully pushed target, it appeared the blobs still existed in the deleted target repo (a GET returned 200 despite the target clearly being deleted), so there was no attempt to recopy those blobs and the push succeeded again. I think that's down to harbor's caching. Unfortunately, I don't have admin access to harbor to force a garbage collection, which is done nightly, but I'll do some more digging today now that the cache has been cleared. |
@carolynvs in terms of the error received, using some of my own logging in cnab-to-oci, it fails when it tries to copy a blob from the referenced image (bd-harbor-registry.mip.storage.hpecorp.net/jem/alpine) to the target repo (https://bd-harbor-registry.mip.storage.hpecorp.net/v2/jem/publishrepo/pywebserver/).
|
We are running Harbor v2.1.3-b6de84c5, with a self-signed cert and local DB for authentication. It is not setup with OIDC. For all our normal/other work we have to update the local host's CA db with a root cert. From that point on docker can connect to it as a secure registry. The authorization happens as part of the normal operation when pushing and pulling images to/from the registry. |
I don't have a ready harbor installation around, but when I have time (likely next week) I'll try to replicate against a similar setup. |
But as I mentioned, cnab-to-oci is successfully pushing the invocation image to our harbor registry without any insecure-registry flag. And it successfully pushes referenced images to harbor. It just fails when the referenced image is also hosted on harbor. So I think that error might be misleading. Or at least it isn't an immediate auth problem. I can see through the logs that the other uploads are correctly using my docker config for auth and it validates the CA using my host's trust store. |
A couple of updates:
I'm hoping this is just a workaround to the issue above. |
What is the cnab-to-oci command that you are running (which works)? I can compare that callpath to what we are doing in porter. |
Steps to reproduce: Starting with sample bundle, verify it can be pushed to harbor:
Update the images section to include an external image and observe it copies that image as well:
Push the alpine image to harbor, reference that image and observe failure:
|
I can confirm that when using a later version of Harbor (Version v2.5.0) this problem goes away. Therefore this issue can be closed. |
That's great news! Thanks for letting us know. |
What is your question?
porter publish command fails after adding images section into poter.yaml
What have you tried already?
Added below part to the porter.yaml
Note:
registry URL: my-registry.com is masked one
The text was updated successfully, but these errors were encountered: