Commit Graph

25 Commits

Author SHA1 Message Date
Miloslav Trmač ec4d02512d Simplify dead but dangerous-looking error handling
Drop error returns from makeDockerV2S2Image and makeOCIv1Image, they
are always nil.  Then drop the code which "handles" the errors
by silently ignoring them.

Right now that does not matter, but if make*Image ever did start
returning errors, the existing caller would silently ignore them
and record useless empty data.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #776
Approved by: rhatdan
2018-06-17 12:37:24 +00:00
Miloslav Trmač eceb6efb48 Don't ignore v2s1 history if docker_version is not set
buildah itself clears docker_version in Builder.fixupConfig; so,
buildah-created v2s1 images do not pass this test
(buildah from buildah-created-v2s1) creates an image with empty
history, which causes (buildah commit) to complain about the mismatch
between history and layer DiffID list.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #776
Approved by: rhatdan
2018-06-17 12:37:24 +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 523b1095d8 Add config --comment/--domainname/--history-comment/--hostname
Add options to "buildah config" for setting comment, domainname, and
hostname configuration bits, and the comment in history items which
describe layers that we add, and tests for them.  Add a test for the
--shell option while we're at it.

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

Closes: #641
Approved by: rhatdan
2018-04-27 16:33:13 +00:00
Zhou Hao f2c532a958 config: add support for StopSignal
Add a stop-singnal option for buildah-config.

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

Closes: #567
Approved by: rhatdan
2018-04-12 06:58:26 +00:00
baude 89e9d1bd85 Add accessor functions for comment and stop signal
Podman commit needs the ability to set a comment and stop signal
when committing a container to an image.  Adding set/get functions
for each.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #560
Approved by: nalind
2018-04-10 18:14:28 +00:00
Daniel J Walsh 5ce80091ba Add support for shell
Also vendor in the latest imagebuilder code and all the packages
that come with it.

Note: imagebuilder.NewBuilderForReader has been removed from imagebuilder
so I had to split the function up into two different calls.

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

Closes: #517
Approved by: rhatdan
2018-04-03 22:25:56 +00:00
Boaz Shuster ba128004ca Fix "make validate" warnings
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #405
Approved by: rhatdan
2018-01-22 14:46:54 +00:00
Nalin Dahyabhai ae7d2f3547 Ignore sequential duplicate layers when reading v2s1
When a v2s1 image is stored to disk, some of the layer blobs listed in
its manifest may be discarded as.  Account for this.

Start treating a failure to decode v1compat information as a fatal error
instead of trying to fake it.

Tweak how we build the created-by field in history when generating one
from v2s1 information to better match what we see in v2s2 images.

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

Closes: #383
Approved by: rhatdan
2018-01-08 21:06:35 +00:00
Daniel J Walsh 3e8ded8646 Add secrets patch to buildah
Signed-off-by: umohnani8 <umohnani@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-11-08 00:01:57 +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 7b5fed15ae Don't overwrite parent information when reading
Don't overwrite an image configuration's information about the source
image unless we're intending to create a new working container.

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 45d3e7953b Use errors.Errorf() instead of fmt.Errorf()
Use Errorf() from 'errors' rather than 'fmt' to help with stack traces.

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

Closes: #130
Approved by: rhatdan
2017-06-02 16:26:46 +00:00
Nalin Dahyabhai 88bf2ebdcf Also import configurations from V2S1 images
Since V2S1 image manifests don't include a config blob, when we
initialize a builder using an image with a V2S1 manifest, try to dig
configuration information out of the manifest's layer history, and build
a V2S2 image configuration using the results.

Leave the diffID list unpopulated, because we compute the right values
when we push the image, and to prevent us from mistakes if we ever try
to use them before that in the future.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai b7ccc2397b Import and namespace more types
Import more manifest and schema variables and types, and rename some of
them to incorporate version numbers.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:10 +00:00
Nalin Dahyabhai 57e6a500d6 Make sure maps in config blobs are always created
When we decode map elements, either from our own data, or when importing
from elsewhere, maps that don't contain any keys aren't created
automatically, so we need to check, and potentially create, maps when we
want to add something to them.

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

Closes: #114
Approved by: rhatdan
2017-05-23 15:40:48 +00:00
Nalin Dahyabhai 0109d21679 Initialize the builder's annotations from OCI data
If we're building on an OCI image, initialize the Builder object's
annotations using the annotations from the source image.

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

Closes: #116
Approved by: rhatdan
2017-05-23 15:33:39 +00:00
Nalin Dahyabhai fc880bcc86 Maintain multiple working container configs
Maintain the container configuration in multiple formats in the Buildah
object, initializing one based on the other, depending on which format
the source image used for its configuration.

Replace directly manipulated fields in the Buildah object (Annotations,
CreatedBy, OS, Architecture, Maintainer, User, Workdir, Env, Cmd,
Entrypoint, Expose, Labels, and Volumes) with accessor functions which
update both configurations and which read from whichever one we consider
to be authoritative.  Drop Args because we weren't using them.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Nalin Dahyabhai ce3505a4d7 Internalize some Docker types
Internalize the type declaration of a Docker image, so that we don't
need to pull in code when we just want to know how to parse out a JSON
object.  Carry a copy of the license that covered the sources from which
the definitions came.

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

Closes: #75
Approved by: nalind
2017-04-19 19:05:06 +00:00
Nalin Dahyabhai 0b51d4990a Add a build-using-dockerfile command
Add a build-using-dockerfile command (alias: bud) which uses
openshift/imagebuilder to wrap parsing and dispatching, and runc (or
another OCI runtime) to handle RUN instructions.

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

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai b7a598ca21 Fixup metalinter errors
Fix a number of issues flagged by gometalinter.

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

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai 22422cc399 Update to match API changes in dependencies
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-13 17:21:45 -05: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