Both callers now consistently pass the transport in the "transport"
parameter, so parsing imageName could only be incorrect.
This could possibly fix cases like pulling docker://dir:localpath,
and the debug log will no longer say
"error parsing image name %q, trying with transport %q: %v" on every pull attempt.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1361
Approved by: rhatdan
Should not change behavior, except possibly failing early if the server
returns an invalid tag name.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1361
Approved by: rhatdan
pullImage has a dedicated transport: parameter, don't pass the transport
in the image name as well. The semantics of the imageName parameter to
pullImage is now unambiguous.
Should not change behavior, pullImage was trying
alltransports.ParseImageName(imageName) first.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1361
Approved by: rhatdan
The result of ParseImageName("docker://"...) is not a storageRef.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1361
Approved by: rhatdan
For some reason, the CI does not report any of these; on macOS
I see many more reports (including complaints about the standard
library), this only cleans up the trivial cases.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1365
Approved by: rhatdan
Change references to Transfer to transfer to make it internal only.
It should be determined from the image specification and only determined
in one place.
Make buildah.Pull use registries.conf
Currently buildah pull does not resolve images based on registries.conf
This does not match the behaviour of buildah from or buildah bud
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1319
Approved by: rhatdan
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Add Quiet to the PullOptions and PushOptions structures.
If set to true output will be in 'quiet' mode. This
will primarily be used by callers such as OpenShift.
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Closes: #1302
Approved by: rhatdan
Add API hooks for designating locations to be used as blob caches when
pulling and pushing images. When we commit read-only copies of
container layers for use in images, if we're using blob caching, store a
copy of the layer in the blob cache directory so that it can be found.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1149
Approved by: rhatdan
Copying an image now returns the manifest of the written image. Return
the digest of that manifest, and a canonical reference, from our Commit
and Push APIs.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1097
Approved by: rhatdan
Use the value now returned by util.ResolveImage instead of trying to
recompute it.
Then drop the no longer used getRegistries. (It might be reasonable
to split that part of util.ResolveImage to make it shorter; but it should
not ideally have any independent second-guessing callers. So, just
keep the inlined one instead; that way we certainly don't break it.)
Also drop the no longer used hasRegistry.
CHANGES BEHAVIOR:
- Most notably, the "short name but no search registries" code
has been broken for some time; pullImage was called with
localhost/$shortname, which was a qualified name, so the
specialized error handling was never attempted.
- Temporarily, the error handling in the "short name but no
search registries" code trigers even if there were actually
valid values to try (in practice there is always localhost/$shortname,
and possibly also options.Registry/$shortname). The next commit
will improve it again.
- We now have more legitimate access to the original short name,
so include it in the error message (it was technically available
before, but using it was awkward).
NOTE: registriesConfPath is computed using the sysregistries
package, but actual access happens using the sysregistriesv2 package.
That should be cleaned up eventually.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #909
Approved by: rhatdan
Make sure that when attempting to diagnose an error, if we encounter an
error during the diagnostic attempt, we return the original error rather
than the error encountered in trying to diagnose it. Log that one.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1072
Approved by: rhatdan
If we're handed a name for a source image, and
alltransports.ParseImageName() doesn't like it as-is, we normally try
prefixing the Transport option and parsing it again. If that option
isn't set, though, we return an error, when we should be trying the
default ("docker"), which is how NewBuilder() does things.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1072
Approved by: rhatdan
Check if reading and writing from the registry named by an image is
allowed when the transport is "docker".
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1056
Approved by: rhatdan
The image library's copy routine doesn't itself consult the registries
configuration in order to decide whether or not to disable TLS
verification when communicating with a registry, so it's on us to use
the name of a source or destination image to decide whether to set the
flag for that behavior.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1056
Approved by: rhatdan
Instead of throwing out the upstream error message, save it and return
it if we can't come up with a more-specific suggestion. This softens
the approach from 043fd2e3 (Add registry errors for pull,
2018-06-01, #747), because that could make debugging harder [1].
[1]: https://github.com/projectatomic/buildah/issues/849
Signed-off-by: W. Trevor King <wking@tremily.us>
Closes: #1014
Approved by: rhatdan
- The result is not used anywhere
- In the common case of pulling from docker:// this does not do
anything notable (only sets up configuration, no network checks)
- ... but it can be pretty expensive for compressed archives,
creating an uncompressed on-disk copy.
- copy.Image soon after the removed code calls srcRef.NewImageSource
internally anyway.
This should not change behavior on success; it may change which error is
reported if there is more than one reason for the pull to fail.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #922
Approved by: TomSweeneyRedHat
Provide a Pull() function that can be called directly, to go with the
Push() function.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #918
Approved by: rhatdan
Instead of ignoring the global --registries-conf option and using only
$REGISTRIES_CONFIG_PATH, use it for the option default.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #854
Approved by: rhatdan
pushing with format <transport>:<path> is valid now.
Add support to pull images from oci-archive that have no image ref name.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #697
Approved by: rhatdan
Changes to paramters in functions.
Change to the error returned by the oci and oci-archive transport.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #578
Approved by: rhatdan
buildah from now supports pulling images using the following transports:
docker-archive, oci-archive, and dir.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #524
Approved by: TomSweeneyRedHat
When locating an image for pulling, inspection, or pushing, if we're
given an image name that doesn't include a domain/registry, try building
a set of candidate names using the configured registries as domains, and
then pull/inspect/push using the first of those names that works.
If a name that we're given corresponds to a prefix of the ID of a local
image, skip completion and use the ID directly instead.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #360
Approved by: rhatdan
buildah push supports manifest type conversion when pushing using the 'dir' transport
Manifest types include oci, v2s1, and v2s2
e.g buildah push --format v2s2 alpine dir:my-directory
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Closes: #321
Approved by: rhatdan
Whenever we create a containers/image/signature.PolicyContext, make sure
we don't forget to destroy it.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #231
Approved by: rhatdan
Replace --registry command line flags with --transport. For backward
compatibility, add Transport as an addtional setting that we prepend to
the still-optional Registry setting if the Transport and image name
alone don't provide a parseable image reference.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #235
Approved by: rhatdan
Fix our instantiation behavior when the source image reference is not a
named reference.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #235
Approved by: rhatdan
Impove error reporting by wrapping all returned err functions with
error.Wrapf
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Closes: #124
Approved by: nalind
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Closes: #125
Approved by: nalind
Have 'from', 'commit', and 'build-using-dockerfile' report progress via
stderr (so that capturing output from 'from' and 'commit' still works as
expected) unless --quiet is used to suppress the reporting.
Closes#94.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #98
Approved by: rhatdan
When we pull down an image to use as a starting point, we no longer need
to attach any additional names to it, as the image library can now find
it correctly without requiring us to do so.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #99
Approved by: rhatdan
Correctly set the tag portion of the name that we assign to images that
we've pulled.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #42
Approved by: nalind
types.ImageSource.Close() can return an error now, and ParseImageName()
moved to containers/image/transports/alltransports.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Pull most of the core logic from the CLI into a package that should be
easier to consume as a library. Add a "config" command that updates the
builder object's configuration.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>