Commit Graph

28 Commits

Author SHA1 Message Date
Tianon Gravi eeaf85b4d2 Add support for BASHBREW_BUILDKIT_SBOM_GENERATOR and provenance
Since Docker's image store can't represent these, we round trip them through our self-managed (or external) containerd image store, which also makes pushing more efficient.
2023-03-02 14:40:46 -08:00
Tianon Gravi 449eb48090 Add "path.Clean" and more comments in gitfs's "resolveSymlink" function 2022-12-16 09:09:58 -08:00
Tianon Gravi 99c15f44c2 Fix "gitfs"'s "Mode()" function and transparently follow symlinks 2022-12-15 11:42:13 -08:00
Tianon Gravi 0b7ae64b2f Add "Builder: oci-import" support
In the case of base images (`debian`, `alpine`, `ubuntu`, etc), using a `Dockerfile` as our method of ingestion doesn't really buy us very much.  It made sense at the time it was implemented ("all `Dockerfile`, all the time"), but at this point they're all some variation on `FROM scratch \n ADD foo.tar.xz / \n CMD ["/bin/some-shell"]`, and cannot reasonably be "rebuilt" when their base image changes (which is one of the key functions of the official images) since they _are_ the base images in question.

Functionally, consuming a tarball in this way isn't _that_ much different from consuming a raw tarball that's part of, say, an OCI image layout (https://github.com/opencontainers/image-spec/blob/v1.0.2/image-layout.md) -- it's some tarball plus some metadata about what to do with it.

For less trivial images, there's a significant difference (and I'm not proposing to use this for anything beyond simple one-layer base images), but for a single layer this would be basically identical.

As a more specific use case, the Debian `rootfs.tar.xz` files are currently [100% reproducible](https://github.com/debuerreotype/debuerreotype).  Unfortunately, some of that gets lost when it gets imported into Docker, and thus it takes some additional effort to get from the Docker-generated rootfs back to the original debuerreotype-generated file.

This adds the ability to consume an OCI image directly, to go even further and have a 100% fully reproducible image digest as well, which makes it easier to trace a given published image back to the reproducible source generated by the upstream tooling (especially if a given image is also pushed by the maintainer elsewhere).

Here's an example `oci-debian` file I was using for testing this:

    Maintainers: Foo (@bar)
    GitRepo: https://github.com/tianon/docker-debian-artifacts.git
    GitFetch: refs/heads/oci-arm32v5
    Architectures: arm32v5
    GitCommit: d6ac440e7760b6b16e3d3da6f2b56736b9c10065
    Builder: oci-import
    File: index.json

    Tags: bullseye, bullseye-20221114, 11.5, 11, latest
    Directory: bullseye/oci

    Tags: bullseye-slim, bullseye-20221114-slim, 11.5-slim, 11-slim
    Directory: bullseye/slim/oci
2022-12-15 11:42:10 -08:00
Tianon Gravi 143301cc9e Merge github.com/docker-library/go-dockerlibrary into bashbrew
This adjusts import paths, go.mod, and adds a new "Dockerfile.test" to run the unit tests.
2020-08-19 16:21:07 -07:00
Tianon Gravi 8e25067487 Update Go versions to 1.12 and 1.13
See https://golang.org/doc/go1.12#text/template, especially:

> If a user-defined function called by a template panics, the panic is now caught and returned as an error by the `Execute` or `ExecuteTemplate` method.
2019-12-10 16:36:34 -08:00
Tianon Gravi 57f0420223 Add new "getenv" templatelib function
Three usages:

- getenv "FOO"
- getenv "FOO" "default"
- getenv "FOO" "set" "unset"
2017-07-12 16:06:44 -07:00
Tianon Gravi 818247f8b4 Add examples/tests for "pkg/execpipe" (100% coverage!) 2017-04-03 15:02:26 -07:00
Tianon Gravi b7dd34a9b2 Update coverage in "pkg/templatelib" to 100% 2017-04-03 12:57:27 -07:00
Tianon Gravi 3da366f1ac Rename example functions so they actually show up 2017-04-03 12:29:03 -07:00
Tianon Gravi fa89a44b4d Rename example functions so they show up in godoc properly 2017-04-03 12:25:50 -07:00
Tianon Gravi 8177bb8839 Add some examples/tests for "pkg/templatelib" (94.9% coverage) 2017-04-03 12:20:49 -07:00
Tianon Gravi 273a3770eb Update "pkg/stripper" coverage to 100% with a smaller buffer size 2017-04-03 11:19:48 -07:00
Tianon Gravi 8e09786a2f Add an example of our CommentStripper that doubles as a test 2017-04-01 08:10:49 -07:00
Tianon Gravi 2406f9a744 Add some godocs for templatelib (mostly so I don't forget again how to use it, but also for others) 2017-02-20 11:07:45 -08:00
Tianon Gravi 945a488370 Rename "execpipe.New" to "execpipe.Run" so it's more clear that it invokes "Start" too 2016-06-24 17:31:43 -07:00
Tianon Gravi 449c8e950c Add new "execpipe" package for easily streaming the output of commands in a sane, simple "io.Reader" way 2016-06-24 17:09:19 -07:00
Tianon Gravi c98d0c2b3d Stop being a dummy reinventing the wheel and use template.IsTrue 2016-06-03 09:15:36 -07:00
Tianon Gravi 3db02d3b23 Add "empty string is false" to "ternary" 2016-06-02 20:41:21 -07:00
Tianon Gravi 5e6bbb37cb Make ternary more forgiving of "interesting" boolean-like values 2016-06-02 17:30:32 -07:00
Tianon Gravi 29dc82bbab More reflection tweaking 2016-06-02 17:23:48 -07:00
Tianon Gravi 032bdbe949 Use proper reflection instead of simple type switching 2016-06-02 17:21:11 -07:00
Tianon Gravi 5c8be71405 Generify some of the "action factory" logic in templatelib, thus allowing "first" and "last" to work on arbitrary types instead of just strings 2016-06-02 17:14:33 -07:00
Tianon Gravi e4fd05106a Screw it, let functions take only one argument instead of requiring two 2016-06-02 17:05:15 -07:00
Tianon Gravi e55c34e8a6 Add new "ternary" templatelib function 2016-06-02 17:01:09 -07:00
Tianon Gravi 939e8fc63d Fix minor typo 2016-06-02 16:49:58 -07:00
Tianon Gravi 369f346d90 Add a new "pkg/templatelib" package with the start of a simple text/template "stdlib" 2016-06-02 16:46:29 -07:00
Tianon Gravi c09c7f0323 Rename misc -> pkg (https://twitter.com/davecheney/status/733156157192175616) 2016-05-25 15:49:51 -07:00