Skip to content

Merge github.com/docker-library/go-dockerlibrary into bashbrew #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 123 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
7381759
Add initial LICENSE file matching docker-library/official-images
tianon May 25, 2016
8c208f7
Add initial "stripper" package
tianon May 25, 2016
b116436
Remove unneeded "LeadingWhitespaceStripper"
tianon May 25, 2016
c09c7f0
Rename misc -> pkg (https://twitter.com/davecheney/status/73315615719…
tianon May 25, 2016
fa86eff
Add initial .travis.yml
tianon May 25, 2016
ea2a799
Add initial "Manifest" reading package
tianon May 25, 2016
6a819d5
Update Travis Go versions
tianon May 27, 2016
2a759cb
Add example code for using the "manifest" package
tianon May 27, 2016
de54353
Add initial "manifest.Fetch" command
tianon May 27, 2016
f346802
Adjust the signature of Fetch to include the "repo name"
tianon May 27, 2016
0b0d493
Change the order manifest.Fetch parses so we can have a good fallback…
tianon May 27, 2016
e40181b
Also verify the "absoluteness" of the URL
tianon May 27, 2016
8a9af33
Update manifest.Fetch to also parse "tag" from repo strings
tianon May 27, 2016
04af83c
Add simple "HasTag" function for a Manifest2822Entry
tianon May 27, 2016
e74aa41
Catch errors for invalid tagName values
tianon May 27, 2016
a0797a5
Add more validation and better line-based "git tag" handling
tianon May 27, 2016
7d56be6
Be slightly less aggressive about using the current directory's "repo"
tianon Jun 2, 2016
369f346
Add a new "pkg/templatelib" package with the start of a simple text/t…
tianon Jun 2, 2016
939e8fc
Fix minor typo
tianon Jun 2, 2016
e55c34e
Add new "ternary" templatelib function
tianon Jun 3, 2016
e4fd051
Screw it, let functions take only one argument instead of requiring two
tianon Jun 3, 2016
5c8be71
Generify some of the "action factory" logic in templatelib, thus allo…
tianon Jun 3, 2016
032bdbe
Use proper reflection instead of simple type switching
tianon Jun 3, 2016
29dc82b
More reflection tweaking
tianon Jun 3, 2016
5e6bbb3
Make ternary more forgiving of "interesting" boolean-like values
tianon Jun 3, 2016
3db02d3
Add "empty string is false" to "ternary"
tianon Jun 3, 2016
c98d0c2
Stop being a dummy reinventing the wheel and use template.IsTrue
tianon Jun 3, 2016
e9ae280
Remove support for Go 1.5, add support for Go 1.7
tianon Jun 3, 2016
ac3ac95
First attempt to unstick Windows
tianon Jun 8, 2016
c154995
Facepalm
tianon Jun 8, 2016
d6068c4
Allow only "http" and "https" URLs
tianon Jun 8, 2016
449c8e9
Add new "execpipe" package for easily streaming the output of command…
tianon Jun 25, 2016
945a488
Rename "execpipe.New" to "execpipe.Run" so it's more clear that it in…
tianon Jun 25, 2016
9442670
Add very basic line-based "maintainer:" comment parsing (passing cont…
tianon Jul 20, 2016
3daa06d
Update Travis to Go 1.7rc2 and Go 1.6.3
tianon Jul 20, 2016
6c6566f
Merge pull request #1 from infosiftr/line-based-maintainers
tianon Jul 20, 2016
18031c0
Add Go 1.8 to Travis
tianon Jan 24, 2017
0066f20
Minor whitespace change
tianon Jan 24, 2017
b3ac43e
Update "duplicate tag" error message to include the tag list from bot…
tianon Jan 24, 2017
8bde624
Move more "bad entry" error handling into manifest.AddEntry, wher eit…
tianon Jan 24, 2017
29ebe1c
Also verify that Maintainers are valid in individual entry objects
tianon Jan 24, 2017
a65f578
Fix error message formatting to be consistent
tianon Jan 24, 2017
187e703
Return an error for duplicated tags in a single entry as well
tianon Jan 24, 2017
3a995f9
Move GitFetch and GitCommit content enforcement back to Parse2822 (si…
tianon Jan 24, 2017
08ef5a9
Fix return values
tianon Jan 24, 2017
8488b2f
Add initial support for an explicit "SharedTags" field
tianon Jan 24, 2017
c48fd9a
First pass at implementing GetSharedTagGroups
tianon Feb 10, 2017
ff63f9d
Fix GetSharedTagGroups ordering and update our hacky example code to …
tianon Feb 10, 2017
5ab0344
Merge pull request #2 from infosiftr/manifest-list-tags
yosifkit Feb 10, 2017
2406f9a
Add some godocs for templatelib (mostly so I don't forget again how t…
tianon Feb 20, 2017
7706c73
Merge pull request #3 from infosiftr/godoc
yosifkit Feb 20, 2017
eafb59f
Add a basic README
tianon Mar 31, 2017
2b0958e
Merge pull request #4 from infosiftr/readme
tianon Mar 31, 2017
8e09786
Add an example of our CommentStripper that doubles as a test
tianon Mar 31, 2017
d5b5f75
Merge pull request #5 from infosiftr/stripper-example-test
tianon Apr 1, 2017
273a377
Update "pkg/stripper" coverage to 100% with a smaller buffer size
tianon Apr 3, 2017
552554d
Update Travis to include go_import_path
tianon Apr 3, 2017
6199632
Add explicit Travis script for "-race -cover"
tianon Apr 3, 2017
5f5ae8d
Merge pull request #6 from infosiftr/100-percent-stripper-coverage
tianon Apr 3, 2017
e9173c5
Merge pull request #7 from infosiftr/race-cover
yosifkit Apr 3, 2017
8177bb8
Add some examples/tests for "pkg/templatelib" (94.9% coverage)
tianon Apr 3, 2017
fa89a44
Rename example functions so they show up in godoc properly
tianon Apr 3, 2017
3da366f
Rename example functions so they actually show up
tianon Apr 3, 2017
b7dd34a
Update coverage in "pkg/templatelib" to 100%
tianon Apr 3, 2017
818247f
Add examples/tests for "pkg/execpipe" (100% coverage!)
tianon Apr 3, 2017
9536e92
Convert "example.go" into a real Go "Example" function (77% test cove…
tianon Apr 3, 2017
499d473
Add "line-based" maintainers to our example for a 0.4% coverage increase
tianon Apr 3, 2017
ef736bc
Add example Constraints for another 0.4% test coverage increase
tianon Apr 3, 2017
6355cdb
Apply gofmt
tianon Apr 3, 2017
02a23d8
Increase coverage further by adding an example for "manifest.Fetch"
tianon Apr 3, 2017
5c0cbe7
Add an example of reading a local manifest file too
tianon Apr 3, 2017
704e5d9
Add codecov.io
tianon May 2, 2017
65c107f
Merge pull request #8 from infosiftr/codecov
tianon May 2, 2017
ae1ac32
Add a simple test for a "manifest.Parse" error
tianon May 2, 2017
61055e4
Merge pull request #9 from infosiftr/TestParseError
tianon May 2, 2017
76cdafa
Add arch-specific fields
yosifkit May 24, 2017
40117df
Add more tweaks, functionality, and tests to the Architectures implem…
tianon Jun 1, 2017
d84bfcc
Add a few new fields for slightly more code coverage
tianon Jun 1, 2017
235f7e4
Merge pull request #10 from infosiftr/arches
tianon Jun 1, 2017
6c0c78b
Fix the case of default Architectures being added to any Global Archi…
tianon Jun 1, 2017
840158d
Merge pull request #11 from infosiftr/fix-accidental-additive-default…
tianon Jun 1, 2017
68838fa
Add new "DefaultArchitecture" value
tianon Jun 1, 2017
08c08a3
Add GitRepo and GitCommit setters
tianon Jun 1, 2017
663a091
Add a few missing bits
tianon Jun 1, 2017
ce6f973
Add new functions to ensure global arch-specific values are inherited…
tianon Jun 5, 2017
ce3ef0e
Merge pull request #12 from infosiftr/arch-values-fixes
tianon Jun 5, 2017
b33efdf
Add a package for converting from a "bashbrew arch" to a full OCI "pl…
tianon Jun 7, 2017
4fd80f3
Merge pull request #13 from infosiftr/supported-arches
yosifkit Jun 12, 2017
21d68d8
Add Architectures sorting, deduplication, and validation
tianon Jun 13, 2017
29d359e
Merge pull request #14 from infosiftr/invalid-arches
yosifkit Jun 14, 2017
57f0420
Add new "getenv" templatelib function
tianon Jul 12, 2017
9948591
Merge pull request #15 from infosiftr/getenv
yosifkit Jul 12, 2017
3f4644c
manifest: add File: attribute
7AC Apr 13, 2018
e6408ba
Merge pull request #1 from 7AC/master
7AC Apr 16, 2018
3532dbe
manifest: test ArchFile()
7AC Apr 25, 2018
5cfb31e
manifest: test non-default arch
7AC Apr 25, 2018
49776e3
Adjust test to instead use the same example manifest for consistency
tianon Jul 25, 2018
5aeabff
Add more Go versions to Travis
tianon Jul 25, 2018
3225f01
Merge pull request #16 from aristanetworks/master
tianon Jul 25, 2018
9ac82ca
Add Windows to Travis matrix
tianon Oct 12, 2018
58d1893
Drop Go versions down to just the two Go upstream supports (latest an…
tianon Oct 12, 2018
dd7d405
Merge pull request #17 from infosiftr/travis-windows
tianon Oct 12, 2018
3c21812
Force line-based files to have valid "Maintainers" too
tianon Jan 8, 2019
78186ac
Merge pull request #19 from infosiftr/validate-maintainers-equally
yosifkit Jan 8, 2019
7e50189
Use pointers more consistently, allow "fetch" tag validation to check…
tianon Jan 29, 2019
7d4d322
Invoke "path.Clean" on "Directory" values in go-dockerlibrary itself …
tianon Jun 5, 2019
ab12b49
Fix "path.Clean" behavior to take arch-specific Directory values into…
tianon Jun 18, 2019
23fe0d7
Adjust "GitCommitRegex" to account for potential future sha256 commit…
tianon Jun 18, 2019
c37ef75
Update test to verify "path.Clean" behavior
tianon Jun 18, 2019
3ff8c5c
Add "(Shared)Tags" validation
tianon Jun 26, 2019
fed4653
Merge pull request #21 from infosiftr/invalid-tags
yosifkit Jun 27, 2019
fb43d90
Fix codecov on Windows workers by avoiding <()
tianon Dec 11, 2019
5b48368
Merge pull request #22 from infosiftr/codecov
tianon Dec 11, 2019
8e25067
Update Go versions to 1.12 and 1.13
tianon Dec 11, 2019
e326c47
Merge pull request #23 from infosiftr/go-version
tianon Dec 11, 2019
f3844f0
Add "mips64le" in SupportedArches
tianon Dec 27, 2019
8f28c0f
Merge pull request #24 from infosiftr/mips64le
tianon Apr 15, 2020
80cdc9e
Update README to point to bashbrew tool repo
gingerbus May 1, 2020
c5db18c
Merge pull request #25 from gingerbus/master
yosifkit May 1, 2020
718495e
As a first step towards line-based manifest file deprecation, stop re…
tianon Aug 19, 2020
f359152
Merge pull request #26 from infosiftr/line-based-errors
tianon Aug 19, 2020
25ef470
Remove redundant files
tianon Aug 19, 2020
143301c
Merge github.com/docker-library/go-dockerlibrary into bashbrew
tianon Aug 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
**
!architecture/
!bashbrew.sh
!cmd/
!go.mod
!go.sum
!manifest/
!pkg/
!scripts/
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ jobs:
bin/bashbrew list --uniq "$image"
bin/bashbrew cat "$image"
bin/bashbrew from --uniq "$image"
go-test:
name: Go Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Go Test
run: |
docker build --pull --file Dockerfile.test .
dockerfile:
name: Test Dockerfile
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ WORKDIR /usr/src/bashbrew
COPY go.mod go.sum ./
RUN go mod download; go mod verify

COPY bashbrew.sh ./
COPY cmd cmd
COPY . .
RUN export CGO_ENABLED=0; \
bash -x ./bashbrew.sh --version; \
rm -r ~/.cache/go-build; \
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.13-buster

SHELL ["bash", "-Eeuo", "pipefail", "-xc"]

WORKDIR /usr/src/bashbrew

COPY go.mod go.sum ./
RUN go mod download; go mod verify

COPY . .

RUN go test -v -race -coverprofile=coverage.out ./...

RUN go tool cover -func=coverage.out
26 changes: 26 additions & 0 deletions architecture/oci-platform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package architecture

// https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md#image-index-property-descriptions
// see "platform" (under "manifests")
type OCIPlatform struct {
OS string `json:"os"`
Architecture string `json:"architecture"`
Variant string `json:"variant,omitempty"`

//OSVersion string `json:"os.version,omitempty"`
//OSFeatures []string `json:"os.features,omitempty"`
}

var SupportedArches = map[string]OCIPlatform{
"amd64": {OS: "linux", Architecture: "amd64"},
"arm32v5": {OS: "linux", Architecture: "arm", Variant: "v5"},
"arm32v6": {OS: "linux", Architecture: "arm", Variant: "v6"},
"arm32v7": {OS: "linux", Architecture: "arm", Variant: "v7"},
"arm64v8": {OS: "linux", Architecture: "arm64", Variant: "v8"},
"i386": {OS: "linux", Architecture: "386"},
"mips64le": {OS: "linux", Architecture: "mips64le"},
"ppc64le": {OS: "linux", Architecture: "ppc64le"},
"s390x": {OS: "linux", Architecture: "s390x"},

"windows-amd64": {OS: "windows", Architecture: "amd64"},
}
4 changes: 2 additions & 2 deletions cmd/bashbrew/cmd-cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"text/template"

"github.com/codegangsta/cli"
"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/go-dockerlibrary/pkg/templatelib"
"github.com/docker-library/bashbrew/manifest"
"github.com/docker-library/bashbrew/pkg/templatelib"
)

var DefaultCatFormat = `
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/cmd-deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/codegangsta/cli"
"pault.ag/go/topsort"

"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
)

func cmdOffspring(c *cli.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/cmd-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path"

"github.com/codegangsta/cli"
"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
)

func cmdList(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/bashbrew/cmd-put-shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/codegangsta/cli"

"github.com/docker-library/go-dockerlibrary/architecture"
"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/architecture"
"github.com/docker-library/bashbrew/manifest"
)

func entriesToManifestToolYaml(singleArch bool, r Repo, entries ...*manifest.Manifest2822Entry) (string, time.Time, int, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/codegangsta/cli"
"github.com/docker-library/go-dockerlibrary/pkg/stripper"
"github.com/docker-library/bashbrew/pkg/stripper"
"pault.ag/go/debian/control"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"

"github.com/codegangsta/cli"
"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
)

type dockerfileMetadata struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/bashbrew/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/codegangsta/cli"

"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/go-dockerlibrary/pkg/execpipe"
"github.com/docker-library/bashbrew/manifest"
"github.com/docker-library/bashbrew/pkg/execpipe"

goGit "github.com/go-git/go-git/v5"
goGitConfig "github.com/go-git/go-git/v5/config"
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/codegangsta/cli"

"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
)

// TODO somewhere, ensure that the Docker engine we're talking to is API version 1.22+ (Docker 1.10+)
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sort"
"strings"

"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
)

func repos(all bool, args ...string) ([]string, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bashbrew/sort.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/docker-library/go-dockerlibrary/manifest"
"github.com/docker-library/bashbrew/manifest"
"pault.ag/go/topsort"
)

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.11

require (
github.com/codegangsta/cli v1.20.0
github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db
github.com/go-git/go-git/v5 v5.1.0
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db h1:qxSDuZDqrt7X9gU75CD3GliYYSMLbHcO69VP7XWmoxk=
github.com/docker-library/go-dockerlibrary v0.0.0-20200415185511-8f28c0fe22db/go.mod h1:ijRhN3WM71dD8TfohKoUdX46BT2uz/Ek5O+5PINI880=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
Expand Down
209 changes: 209 additions & 0 deletions manifest/example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
package manifest_test

import (
"bufio"
"fmt"
"strings"

"github.com/docker-library/bashbrew/manifest"
)

func Example() {
man, err := manifest.Parse(bufio.NewReader(strings.NewReader(`# RFC 2822

# I LOVE CAKE

Maintainers: InfoSiftr <[email protected]> (@infosiftr),
Johan Euphrosine <[email protected]> (@proppy)
GitFetch: refs/heads/master
GitRepo: https://github.com/docker-library/golang.git
SharedTags: latest
arm64v8-GitRepo: https://github.com/docker-library/golang.git
Architectures: amd64, amd64


# hi


# blasphemer


# Go 1.6
Tags: 1.6.1, 1.6, 1
arm64v8-GitRepo: https://github.com/docker-library/golang.git
Directory: 1.6
GitCommit: 0ce80411b9f41e9c3a21fc0a1bffba6ae761825a
Constraints: some-random-build-server


# Go 1.5
Tags: 1.5.3
GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
SharedTags: 1.5.3-debian, 1.5-debian
Directory: 1.5
s390x-GitCommit: b6c460e7cd79b595267870a98013ec3078b490df
i386-GitFetch: refs/heads/i386
ppc64le-Directory: 1.5/ppc64le/


Tags: 1.5
SharedTags: 1.5-debian
GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
Directory: 1.5
s390x-GitCommit: b6c460e7cd79b595267870a98013ec3078b490df
i386-GitFetch: refs/heads/i386
ppc64le-Directory: 1.5/ppc64le

Tags: 1.5-alpine
GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
Directory: 1.5
File: Dockerfile.alpine
s390x-File: Dockerfile.alpine.s390x.bad-boy

SharedTags: raspbian
GitCommit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
Tags: raspbian-s390x
Architectures: s390x, i386
File: Dockerfile-raspbian
s390x-File: Dockerfile


`)))
if err != nil {
panic(err)
}
fmt.Printf("-------------\n2822:\n%s\n", man)

fmt.Printf("\nShared Tag Groups:\n")
for _, group := range man.GetSharedTagGroups() {
fmt.Printf("\n - %s\n", strings.Join(group.SharedTags, ", "))
for _, entry := range group.Entries {
fmt.Printf(" - %s\n", entry.TagsString())
}
}
fmt.Printf("\n")

man, err = manifest.Parse(bufio.NewReader(strings.NewReader(`
# maintainer: InfoSiftr <[email protected]> (@infosiftr)
# maintainer: John Smith <[email protected]> (@example-jsmith)

# first set
a: b@c d
e: b@c d

# second set
f: g@h
i: g@h j
`)))
if err != nil {
panic(err)
}
fmt.Printf("-------------\nline-based:\n%v\n", man)

// Output:
// -------------
// 2822:
// Maintainers: InfoSiftr <[email protected]> (@infosiftr), Johan Euphrosine <[email protected]> (@proppy)
// SharedTags: latest
// GitRepo: https://github.com/docker-library/golang.git
// arm64v8-GitRepo: https://github.com/docker-library/golang.git
//
// Tags: 1.6.1, 1.6, 1
// GitCommit: 0ce80411b9f41e9c3a21fc0a1bffba6ae761825a
// Directory: 1.6
// Constraints: some-random-build-server
//
// Tags: 1.5.3, 1.5
// SharedTags: 1.5.3-debian, 1.5-debian
// GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
// Directory: 1.5
// i386-GitFetch: refs/heads/i386
// ppc64le-Directory: 1.5/ppc64le
// s390x-GitCommit: b6c460e7cd79b595267870a98013ec3078b490df
//
// Tags: 1.5-alpine
// GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
// Directory: 1.5
// File: Dockerfile.alpine
// s390x-File: Dockerfile.alpine.s390x.bad-boy
//
// Tags: raspbian-s390x
// SharedTags: raspbian
// Architectures: i386, s390x
// GitCommit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
// File: Dockerfile-raspbian
// s390x-File: Dockerfile
//
// Shared Tag Groups:
//
// - latest
// - 1.6.1, 1.6, 1
// - 1.5-alpine
//
// - 1.5.3-debian, 1.5-debian
// - 1.5.3, 1.5
//
// - raspbian
// - raspbian-s390x
//
// -------------
// line-based:
// Maintainers: InfoSiftr <[email protected]> (@infosiftr), John Smith <[email protected]> (@example-jsmith)
// GitFetch: refs/heads/*
//
// Tags: a, e
// GitRepo: b
// GitCommit: c
// Directory: d
//
// Tags: f
// GitRepo: g
// GitFetch: refs/tags/h
// GitCommit: FETCH_HEAD
//
// Tags: i
// GitRepo: g
// GitFetch: refs/tags/h
// GitCommit: FETCH_HEAD
// Directory: j
}

func ExampleFetch_local() {
repoName, tagName, man, err := manifest.Fetch("testdata", "bash:4.4")
if err != nil {
panic(err)
}

fmt.Printf("%s:%s\n\n", repoName, tagName)

fmt.Println(man.GetTag(tagName).ClearDefaults(manifest.DefaultManifestEntry).String())

// Output:
// bash:4.4
//
// Maintainers: Tianon Gravi <[email protected]> (@tianon)
// Tags: 4.4.12, 4.4, 4, latest
// GitRepo: https://github.com/tianon/docker-bash.git
// GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
// Directory: 4.4
}

func ExampleFetch_remote() {
repoName, tagName, man, err := manifest.Fetch("/home/jsmith/docker/official-images/library", "https://github.com/docker-library/official-images/raw/1a3c4cd6d5cd53bd538a6f56a69f94c5b35325a7/library/bash:4.4")
if err != nil {
panic(err)
}

fmt.Printf("%s:%s\n\n", repoName, tagName)

fmt.Println(man.GetTag(tagName).ClearDefaults(manifest.DefaultManifestEntry).String())

// Output:
// bash:4.4
//
// Maintainers: Tianon Gravi <[email protected]> (@tianon)
// Tags: 4.4.12, 4.4, 4, latest
// GitRepo: https://github.com/tianon/docker-bash.git
// GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
// Directory: 4.4
}
Loading