Commit Graph

60 Commits

Author SHA1 Message Date
Tianon Gravi 419da33551 Add more test coverage for manifest/ 2022-11-17 16:10:52 -08:00
Tianon Gravi f54c8e397a Rewrite "bashbrew children" and "bashbrew parents"
This time, they are distinct implementations because the problem they are solving is inherently different.

For listing children of a given name, we *have* to walk the entire library (since we only have tag -> FROM mappings, not the reverse, which is fundamentally the question that "children" answers).

On the flip side, listing the parents of a given name is as straightforward as looking up the FROM values and walking until we can't anymore.

In my own testing, these new implementations are significantly more correct, and handle more edge cases (including things we couldn't support before like `bashbrew children --depth=1 scratch`, `bashbrew children mcr.microsoft.com/windows/servercore`, etc).

They also more correctly handle edge cases like tags that are `FROM` a "`SharedTag`" such that they don't walk up/down both sides of the tree (for example, `orientdb:3.2` -> `FROM eclipse-temurin:8-jdk`, which is both Windows *and* Linux, even though `orientdb:3.2` is Linux-only).
2022-11-14 14:32:20 -08:00
Justin Chadwell 981ff1d376 buildkit: introduce initial support
This patch adds a new `Builder` entry to the RFC2822 image manifest
files, allowing individual image components to opt into buildkit
support, using docker buildx.

Additionally, docker build is changed to explicitly set
DOCKER_BUILDKIT=0 to force a non-buildkit build in preparation for
the switching default in any upcoming docker versions.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-09-20 16:55:23 +01:00
Tianon Gravi 69f43237ee Finally deprecate the legacy line-based format 2022-06-08 16:41:02 -07:00
Tianon Gravi 8c7ed36470 Add explicit Manifest2822Maintainer struct
This allows us to more easily/reliably generate lists of users to ping on PRs (with the goal to ping them automatically, if one of them is not the PR author).

This is technically a breaking change, but I consider myself probably the most prolific user of bashbrew format strings (which is where this breakage would exhibit itself -- `bashbrew cat` should be unaffected), and I have exactly one script broken by it.  That script was doing some processing to generate this exact data, so IMO this is a win. 😁

    bashbrew cat --format='- `{{ $.RepoName }}`:{{ range .Manifest.Global.Maintainers }} @{{ .Handle }}{{ end }}' ...
2021-02-01 11:00:04 -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 718495e812 As a first step towards line-based manifest file deprecation, stop returning line-based parsing errors 2020-08-19 13:49:08 -07:00
Tianon Gravi 3ff8c5ce0d Add "(Shared)Tags" validation 2019-06-26 16:47:34 -07:00
Tianon Gravi c37ef753c4 Update test to verify "path.Clean" behavior 2019-06-18 16:21:09 -07:00
Tianon Gravi 23fe0d7295 Adjust "GitCommitRegex" to account for potential future sha256 commit IDs 2019-06-18 16:18:51 -07:00
Tianon Gravi ab12b4904b Fix "path.Clean" behavior to take arch-specific Directory values into account too 2019-06-18 16:18:28 -07:00
Tianon Gravi 7d4d3222cd Invoke "path.Clean" on "Directory" values in go-dockerlibrary itself (instead of only doing so just before "git archive" inside bashbrew) 2019-06-05 15:49:21 -07:00
Tianon Gravi 7e50189a05 Use pointers more consistently, allow "fetch" tag validation to check SharedTags too 2019-01-28 16:03:21 -08:00
Tianon Gravi 3c2181232e Force line-based files to have valid "Maintainers" too
This copies the exact `mainfest.Global.Maintainers` validation from `rfc2822.go`.
2019-01-07 16:12:21 -08:00
Tianon Gravi 49776e367d Adjust test to instead use the same example manifest for consistency 2018-07-25 14:30:21 -07:00
Giuseppe Valente 5cfb31e65b manifest: test non-default arch 2018-04-25 16:06:23 -07:00
Giuseppe Valente 3532dbec44 manifest: test ArchFile() 2018-04-25 15:54:15 -07:00
Giuseppe Valente 3f4644cf4f manifest: add File: attribute
It is useful to have multiple dockerfiles in a single directory, if for
example multiple apps need to have access to the root of the repo to be
built.
2018-04-13 16:11:33 -07:00
Tianon Gravi 21d68d83eb Add Architectures sorting, deduplication, and validation 2017-06-13 14:34:23 -07:00
Tianon Gravi ce6f973ced Add new functions to ensure global arch-specific values are inherited properly 2017-06-05 12:54:57 -07:00
Tianon Gravi 663a091da1 Add a few missing bits 2017-06-01 16:37:35 -07:00
Tianon Gravi 08c08a33e1 Add GitRepo and GitCommit setters 2017-06-01 14:58:09 -07:00
Tianon Gravi 68838fa86d Add new "DefaultArchitecture" value 2017-06-01 14:24:33 -07:00
Tianon Gravi 6c0c78bdb5 Fix the case of default Architectures being added to any Global Architectures 2017-06-01 14:13:35 -07:00
Tianon Gravi d84bfcca38 Add a few new fields for slightly more code coverage 2017-06-01 11:38:22 -07:00
Tianon Gravi 40117df115 Add more tweaks, functionality, and tests to the Architectures implementation 2017-06-01 11:16:29 -07:00
Joe Ferguson 76cdafaca6 Add arch-specific fields 2017-05-24 16:12:36 -07:00
Tianon Gravi ae1ac322eb Add a simple test for a "manifest.Parse" error 2017-05-02 10:36:50 -07:00
Tianon Gravi 5c0cbe7322 Add an example of reading a local manifest file too 2017-04-03 15:37:39 -07:00
Tianon Gravi 02a23d8a95 Increase coverage further by adding an example for "manifest.Fetch" 2017-04-03 15:29:23 -07:00
Tianon Gravi 6355cdbae8 Apply gofmt 2017-04-03 15:20:35 -07:00
Tianon Gravi ef736bc836 Add example Constraints for another 0.4% test coverage increase 2017-04-03 15:17:09 -07:00
Tianon Gravi 499d4731a3 Add "line-based" maintainers to our example for a 0.4% coverage increase 2017-04-03 15:13:42 -07:00
Tianon Gravi 9536e92ebd Convert "example.go" into a real Go "Example" function (77% test coverage right off the bat!) 2017-04-03 15:10:40 -07:00
Tianon Gravi ff63f9df03 Fix GetSharedTagGroups ordering and update our hacky example code to have some SharedTags examples 2017-02-10 11:05:35 -08:00
Tianon Gravi c48fd9a499 First pass at implementing GetSharedTagGroups 2017-02-10 10:25:54 -08:00
Tianon Gravi 8488b2f8fc Add initial support for an explicit "SharedTags" field
Things we know we'll need to be able to do with the new `SharedTags` (and are thus included in this initial file format support):

- get list of all shared tags from a manifest (`manifest.GetAllSharedTags()`)
- get list of shared tags from an entry (`entry.SharedTags`)
- get list of entries given a shared tag (`manifest.GetSharedTag(tag)`)
2017-02-06 16:25:53 -08:00
Tianon Gravi 08ef5a968e Fix return values 2017-01-24 13:50:52 -08:00
Tianon Gravi 3a995f9639 Move GitFetch and GitCommit content enforcement back to Parse2822 (since they have a different format when coming from line-based legacy files) 2017-01-24 13:50:02 -08:00
Tianon Gravi 187e703bbf Return an error for duplicated tags in a single entry as well 2017-01-24 13:38:56 -08:00
Tianon Gravi a65f578c6d Fix error message formatting to be consistent 2017-01-24 13:12:29 -08:00
Tianon Gravi 29ebe1cee3 Also verify that Maintainers are valid in individual entry objects 2017-01-24 13:03:52 -08:00
Tianon Gravi 8bde624aad Move more "bad entry" error handling into manifest.AddEntry, wher eit really belongs 2017-01-24 13:02:23 -08:00
Tianon Gravi b3ac43e115 Update "duplicate tag" error message to include the tag list from both entries (for easier identification) 2017-01-24 12:54:44 -08:00
Tianon Gravi 0066f2058b Minor whitespace change 2017-01-24 10:41:19 -08:00
Tianon Gravi 9442670fdd Add very basic line-based "maintainer:" comment parsing (passing contents directly into the manifest struct without any verification for now) 2016-07-20 11:12:33 -07:00
Tianon Gravi d6068c47a7 Allow only "http" and "https" URLs 2016-06-08 10:36:33 -07:00
Tianon Gravi c1549952f3 Facepalm 2016-06-08 10:24:38 -07:00
Tianon Gravi ac3ac95930 First attempt to unstick Windows 2016-06-08 10:23:10 -07:00
Tianon Gravi 7d56be63f3 Be slightly less aggressive about using the current directory's "repo" 2016-06-01 17:08:02 -07:00