Skip to content

Commit 5c0cbe7

Browse files
committed
Add an example of reading a local manifest file too
1 parent 02a23d8 commit 5c0cbe7

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

manifest/example_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,28 @@ i: g@h j
126126
// Directory: j
127127
}
128128

129-
func ExampleFetch() {
129+
func ExampleFetch_local() {
130+
repoName, tagName, man, err := manifest.Fetch("testdata", "bash:4.4")
131+
if err != nil {
132+
panic(err)
133+
}
134+
135+
fmt.Printf("%s:%s\n\n", repoName, tagName)
136+
137+
fmt.Println(man.GetTag(tagName))
138+
139+
// Output:
140+
// bash:4.4
141+
//
142+
// Maintainers: Tianon Gravi <[email protected]> (@tianon)
143+
// Tags: 4.4.12, 4.4, 4, latest
144+
// GitRepo: https://github.com/tianon/docker-bash.git
145+
// GitFetch: refs/heads/master
146+
// GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
147+
// Directory: 4.4
148+
}
149+
150+
func ExampleFetch_remote() {
130151
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")
131152
if err != nil {
132153
panic(err)

manifest/testdata/bash

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# this is a snapshot of https://github.com/docker-library/official-images/raw/1a3c4cd6d5cd53bd538a6f56a69f94c5b35325a7/library/bash
2+
3+
# this file is generated via https://github.com/tianon/docker-bash/blob/cd1de3dfc885b3395cd354ddb988922350b092a7/generate-stackbrew-library.sh
4+
5+
Maintainers: Tianon Gravi <[email protected]> (@tianon)
6+
GitRepo: https://github.com/tianon/docker-bash.git
7+
8+
Tags: 4.4.12, 4.4, 4, latest
9+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
10+
Directory: 4.4
11+
12+
Tags: 4.3.48, 4.3
13+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
14+
Directory: 4.3
15+
16+
Tags: 4.2.53, 4.2
17+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
18+
Directory: 4.2
19+
20+
Tags: 4.1.17, 4.1
21+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
22+
Directory: 4.1
23+
24+
Tags: 4.0.44, 4.0
25+
GitCommit: 4438745d601d10d300e363f24205a3ca75307803
26+
Directory: 4.0
27+
28+
Tags: 3.2.57, 3.2, 3
29+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
30+
Directory: 3.2
31+
32+
Tags: 3.1.23, 3.1
33+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
34+
Directory: 3.1
35+
36+
Tags: 3.0.22, 3.0
37+
GitCommit: 1cbb5cf49b4c53bd5a986abf7a1afeb9a80eac1e
38+
Directory: 3.0

0 commit comments

Comments
 (0)