1
0
mirror of https://github.com/containers/buildah.git synced 2025-04-25 14:42:29 +03:00

39 Commits

Author SHA1 Message Date
Nalin Dahyabhai
62c01da3e4 Correctly set DockerInsecureSkipTLSVerify when pulling images
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
2018-10-05 15:30:11 +00:00
Daniel J Walsh
ba012ddec6
Move buildah from projecatatomic/buildah to containers/buildah
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-18 08:06:11 -04:00
Zhou Hao
8ff6c26495 push: show image digest after push succeed
After change :

```
➜  buildah git:(push-fix) ✗ sudo ./buildah push 71c dir:/home/zhouhao/test/buildah
Getting image source signatures
Copying blob sha256:cdb3f9544e4c61d45da1ea44f7d92386639a052c620d1550376f22f5b46981af
 55.73 MiB / 55.73 MiB [====================================================] 1s
Copying blob sha256:7f2cffb520ed710c0871cd07f4fd8041d67fb9b4a74e03d036db55c23a085840
 51.81 MiB / 51.81 MiB [====================================================] 0s
Copying blob sha256:64ef7c2d456f323178e92fd11fd6819c4b913ffedf3d27f8bf12702e6f953d36
 3.50 KiB / 3.50 KiB [======================================================] 0s
Copying config sha256:71c43202b8ac897ff4d048d3b37bdf4eb543ec5c03fd017c3e12c616c6792206
 5.88 KiB / 5.88 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
Succefully pushed /home/zhouhao/test/buildah@d963acde7543161ad481fa33d4d03dcbd826826385c8155a5d6b3c89cb297fbb
```

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #992
Approved by: rhatdan
2018-09-10 14:22:57 +00:00
Nalin Dahyabhai
b533b5bb0e commit: recognize committing to second storage locations
Recognize cases when we're committing to local storage, but in a
location other than where the working container is, by checking if the
base image (by ID, in case it's tagged and the tag points to a different
image with different layers) is present in the destination's store.

In those cases, we can't just assume that we can skip exporting the base
image's layers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-06-25 16:46:41 -04:00
umohnani8
6c4bef7f2e Add --layers and --no-cache to buildah bud
This patch adds in the caching feature to buildah bud.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #784
Approved by: rhatdan
2018-06-12 20:20:39 +00:00
Daniel J Walsh
b66e853145 Add OnBuild support for Dockerfiles
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #722
Approved by: mheon
2018-05-31 13:30:29 +00:00
Nalin Dahyabhai
71f0f9d063 build-using-dockerfile: add --annotation
Add an --annotation flag to "buildah build-using-dockerfile".

Refactor the logic for --label handling to use SetLabel() to set them in
the image configuration in Executor.Commit(), instead of passing them as
a field in CommitOptions for Builder.Commit() and expecting it to do so.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #716
Approved by: rhatdan
2018-05-22 19:27:45 +00:00
Nalin Dahyabhai
c806e6e065 Implement --squash for build-using-dockerfile and commit
Handle a Squash option when committing images, and make it available as
a flag for "buildah commit" and "buildah build-using-dockerfile".

Breaks up containerImageRef.NewImageSource to keep the complexity more
manageable.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #714
Approved by: rhatdan
2018-05-22 16:43:58 +00:00
Daniel J Walsh
02cc30ba17 Add support for buildah bud --label
We want to be able to add labels when building a container image.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #698
Approved by: umohnani8
2018-05-18 14:03:35 +00:00
Matthew Heon
a4f5707eeb Do not print directly to stdout in Commit()
Buildah is being used as a library in Podman, and as such should
avoid printing directly to standard streams. Instead, return an
image ID which can be printed by the caller (if desired)

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #647
Approved by: rhatdan
2018-05-02 21:03:39 +00:00
Nalin Dahyabhai
44468f811c Force "localhost" as a default registry
Extend util.ResolveName() to prepend "localhost" to the list of
registries, and teach util.FindImage(), util.ExpandNames(), and
util.AddImageNames() to use util.ResolveName().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #648
Approved by: rhatdan
2018-05-02 19:52:53 +00:00
Daniel J Walsh
3088277ee8 Add support for --iidfile to bud and commit
Add support for an --iidfile which specifies the file to write the
image id, when committing a new image.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #636
Approved by: TomSweeneyRedHat
2018-04-26 12:19:43 +00:00
umohnani8
9ffd47edca Vendor in latest containers/image and containers/storage
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
2018-04-13 16:56:21 +00:00
TomSweeneyRedHat
b81af1e212 Display imageId after commit
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #566
Approved by: rhatdan
2018-04-12 12:15:33 +00:00
Nalin Dahyabhai
12114812da Remove shallowCopy(), which shouldn't be saving us time any more
Remove shallowCopy(), which shouldn't be saving us time any more since
containers/image's storage transport's HasBlob() implementation was last
updated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #508
Approved by: rhatdan
2018-03-06 01:38:00 +00:00
Nalin Dahyabhai
9ff37b0cf0 shallowCopy: avoid a second read of the container's layer
Avoid reading the container's layer a second time in shallowCopy (after
the first time it's read, in NewImageSource()).

Our second copy of the diff isn't going to match the first one if it's
of any serious size, because when NaiveDiff is used to generate the
diff, whiteout entries have their times set to "now", rather than a
fixed value, which causes both the uncompressed and compressed digests
to differ from what NewImageSource() records in the manifest.

Instead, use the generic manifest-reading API that the image library
now provides to read the layer info list and the config blob info, and
use their values to PutBlob() them to the destination image.

We can probably drop shallowCopy() completely, since the newer version
of the image library has a more reliable HasBlob(), which should save us
the time that shallowCopy() was originally meant to save, but we should
probably consider the use of compression for this code path as part of
that, too.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #506
Approved by: rhatdan
2018-03-04 15:26:24 +00:00
Nalin Dahyabhai
47ac96155f Use configured registries to resolve image names
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
2017-12-14 22:21:16 +00:00
Nalin Dahyabhai
8b2b56d9b8 Update to work with newer image library
Update shallowCopy() to work with the newer version of image.
Remove things from Push() that we don't need to do any more.
Preserve digests in image names, make sure we update creation times, and
add a test to ensure that we can pull, commit, and push using such names
as sources.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #187
Approved by: rhatdan
2017-12-14 20:57:13 +00:00
TomSweeneyRedHat
15792b227a Allow push to use the image id
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #341
Approved by: nalind
2017-11-30 23:47:13 +00:00
Urvashi Mohnani
4419612150 Add manifest type conversion to buildah push
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
2017-11-15 13:38:28 +00:00
Daniel J Walsh
8ecefa978c Vendor in changes to support sirupsen/logrus
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-10 17:30:11 +00:00
Daniel J Walsh
f6c2a1e24e Make sure pushing ends up with CLI on a fresh new line
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #275
Approved by: rhatdan
2017-09-29 15:58:39 +00:00
TomSweeneyRedHat
c9c735e20d Add authentication to commit and push
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #250
Approved by: rhatdan
2017-08-29 15:20:19 +00:00
TomSweeneyRedHat
498f0ae9d7 Add credentials to buildah from
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Add credentials to buildah from

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #204
Approved by: nalind
2017-08-22 18:55:38 +00:00
Nalin Dahyabhai
265d2da6cf Always free signature.PolicyContexts
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
2017-08-14 12:02:07 +00:00
Nalin Dahyabhai
12a3abf6fa Update to match newer storage and image-spec APIs
Update to adjust to new types and method signatures in just-updated
vendored code.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #174
Approved by: rhatdan
2017-06-28 21:05:58 +00:00
Nalin Dahyabhai
cd6b5870e2 Make shallowCopy() not use a temporary image
Modify shallowCopy() to not use a temporary image.  Assume that the big
data items that we formerly added to the temporary image are small
enough that we can just hang on to them.

Write everything to the destination reference instead of a temporary
image, read it all back using the low level APIs, delete the image, and
then recreate it using the new layer and the saved items and names.

This lets us lift the requirement that we shallowCopy only to images
with names, so that build-using-dockerfile will work without them again.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #150
Approved by: rhatdan
2017-06-16 15:34:53 +00:00
Nalin Dahyabhai
3163a98bdd Add a "push" command
Add a "push" command, which pulls an image's layers from local storage,
recomputes the image's digest and manifest, and uses the image library
to write the result to the specified location.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
4a05d8643d Add an option to specify a Create date for images
Add CommitOption option that to allow a caller to specify a creation
timestamp to use in images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
b2baeb25f4 Take a shortcut when writing to local storage
When writing to local storage, take a couple of shortcuts: instead of
recompressing layers to ensure that the values we store in the image
manifest will be correct for content-addressibility, just pretend that
the layer ID is a blob hash value, and that it's a valid layer diffID.

Local storage doesn't generally care if these values are correct, and we
already have to recompute these values when exporting an image, but this
saves us quite a bit of time.

The image library's Copy() routine actually cares about and
sanity-checks these things, so if we're going to take advantage of the
shortcuts, we need to use its higher-level APIs to write a layer, write
the configuration, and write the manifest, then move those items that it
writes to an image with the right set of layers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Dan Walsh
33c2a8a418 gccgo is giving errors about using copy
golang-bin-1.8.1-1.fc26.x86_64
gcc-go-7.1.1-1.fc26.x86_64

Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #135
Approved by: nalind
2017-06-06 19:40:56 +00:00
Dan Walsh
8ced1276e5 Change functions that use a fmt.Errorf to wrap an err to error.Wrapf
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
2017-06-02 14:17:04 +00:00
Nalin Dahyabhai
4b6ba974cc Make the output image format selectable
Make it possible to select the output format for Commit() and the
imagebuildah package, and wire that through to a --format option in the
CLI's "commit" and "bud" commands.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai
7a5342be8d Add more detail to errors returned from Commit()
Add some context to errors returned from the Commit() method.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #115
Approved by: rhatdan
2017-05-23 15:53:11 +00:00
Nalin Dahyabhai
3065ea3d16 Add a "tag" command
Add a "tag" command, for adding names to locally-stored images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #110
Approved by: rhatdan
2017-05-19 19:59:47 +00:00
Nalin Dahyabhai
12e582ee1a Report pull/commit progress by default
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
2017-05-10 12:53:25 +00:00
Nalin Dahyabhai
4d155b93b4 imagebuildah: add AdditionalTags
Add an AdditionalTags field to the imagebuildah options structure, to
provide for additional tags which we'll want to apply to the image that
we're writing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #88
Approved by: rhatdan
2017-05-08 18:05:31 +00:00
Nalin Dahyabhai
20f2cb9dbe Fix a number of issues flagged by golint
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-10 14:46:09 -05:00
Nalin Dahyabhai
0ab0890e4e Massive refactoring
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>
2017-02-10 11:48:15 -05:00