- Move go package used by both `integration-cli` and `integration` to
`internal/test/fixtures`.
- Remove fixtures that are not used anymore (moved to `docker/cli` a
while ago) : deploy, notary, secrets.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
... | ... |
@@ -19,9 +19,9 @@ import ( |
19 | 19 |
"github.com/docker/docker/integration-cli/cli/build/fakestorage" |
20 | 20 |
"github.com/docker/docker/integration-cli/daemon" |
21 | 21 |
"github.com/docker/docker/integration-cli/environment" |
22 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
23 | 22 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
24 | 23 |
ienv "github.com/docker/docker/internal/test/environment" |
24 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
25 | 25 |
"github.com/docker/docker/internal/test/registry" |
26 | 26 |
"github.com/docker/docker/pkg/reexec" |
27 | 27 |
"github.com/go-check/check" |
... | ... |
@@ -14,8 +14,8 @@ import ( |
14 | 14 |
"github.com/docker/docker/api/types/swarm/runtime" |
15 | 15 |
"github.com/docker/docker/integration-cli/checker" |
16 | 16 |
"github.com/docker/docker/integration-cli/daemon" |
17 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
18 | 17 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
18 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
19 | 19 |
"github.com/docker/docker/internal/test/registry" |
20 | 20 |
"github.com/go-check/check" |
21 | 21 |
"golang.org/x/net/context" |
... | ... |
@@ -14,7 +14,7 @@ import ( |
14 | 14 |
"github.com/docker/docker/integration-cli/checker" |
15 | 15 |
"github.com/docker/docker/integration-cli/cli" |
16 | 16 |
"github.com/docker/docker/integration-cli/daemon" |
17 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
17 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
18 | 18 |
"github.com/go-check/check" |
19 | 19 |
"golang.org/x/net/context" |
20 | 20 |
) |
... | ... |
@@ -332,7 +332,7 @@ func listTar(f io.Reader) ([]string, error) { |
332 | 332 |
func (s *DockerSuite) TestLoadZeroSizeLayer(c *check.C) { |
333 | 333 |
testRequires(c, DaemonIsLinux) |
334 | 334 |
|
335 |
- dockerCmd(c, "load", "-i", "fixtures/load/emptyLayer.tar") |
|
335 |
+ dockerCmd(c, "load", "-i", "testdata/emptyLayer.tar") |
|
336 | 336 |
} |
337 | 337 |
|
338 | 338 |
func (s *DockerSuite) TestSaveLoadParents(c *check.C) { |
339 | 339 |
deleted file mode 100644 |
... | ... |
@@ -1,9 +0,0 @@ |
1 |
- |
|
2 |
-version: "3" |
|
3 |
-services: |
|
4 |
- web: |
|
5 |
- image: busybox@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 |
|
6 |
- command: top |
|
7 |
- db: |
|
8 |
- image: busybox@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 |
|
9 |
- command: "tail -f /dev/null" |
12 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,20 +0,0 @@ |
1 |
- |
|
2 |
-version: "3.1" |
|
3 |
-services: |
|
4 |
- web: |
|
5 |
- image: busybox@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 |
|
6 |
- command: top |
|
7 |
- secrets: |
|
8 |
- - special |
|
9 |
- - source: super |
|
10 |
- target: foo.txt |
|
11 |
- mode: 0400 |
|
12 |
- - star |
|
13 |
-secrets: |
|
14 |
- special: |
|
15 |
- file: fixtures/secrets/default |
|
16 |
- super: |
|
17 |
- file: fixtures/secrets/default |
|
18 |
- star: |
|
19 |
- external: |
|
20 |
- name: outside |
23 | 3 |
deleted file mode 100644 |
... | ... |
@@ -1,197 +0,0 @@ |
1 |
-package load // import "github.com/docker/docker/integration-cli/fixtures/load" |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "bufio" |
|
5 |
- "bytes" |
|
6 |
- "os" |
|
7 |
- "os/exec" |
|
8 |
- "path/filepath" |
|
9 |
- "strings" |
|
10 |
- "sync" |
|
11 |
- |
|
12 |
- "context" |
|
13 |
- |
|
14 |
- "github.com/docker/docker/api/types" |
|
15 |
- "github.com/docker/docker/client" |
|
16 |
- "github.com/docker/docker/pkg/jsonmessage" |
|
17 |
- "github.com/docker/docker/pkg/term" |
|
18 |
- "github.com/pkg/errors" |
|
19 |
-) |
|
20 |
- |
|
21 |
-const frozenImgDir = "/docker-frozen-images" |
|
22 |
- |
|
23 |
-// FrozenImagesLinux loads the frozen image set for the integration suite |
|
24 |
-// If the images are not available locally it will download them |
|
25 |
-// TODO: This loads whatever is in the frozen image dir, regardless of what |
|
26 |
-// images were passed in. If the images need to be downloaded, then it will respect |
|
27 |
-// the passed in images |
|
28 |
-func FrozenImagesLinux(client client.APIClient, images ...string) error { |
|
29 |
- var loadImages []struct{ srcName, destName string } |
|
30 |
- for _, img := range images { |
|
31 |
- if !imageExists(client, img) { |
|
32 |
- srcName := img |
|
33 |
- // hello-world:latest gets re-tagged as hello-world:frozen |
|
34 |
- // there are some tests that use hello-world:latest specifically so it pulls |
|
35 |
- // the image and hello-world:frozen is used for when we just want a super |
|
36 |
- // small image |
|
37 |
- if img == "hello-world:frozen" { |
|
38 |
- srcName = "hello-world:latest" |
|
39 |
- } |
|
40 |
- loadImages = append(loadImages, struct{ srcName, destName string }{ |
|
41 |
- srcName: srcName, |
|
42 |
- destName: img, |
|
43 |
- }) |
|
44 |
- } |
|
45 |
- } |
|
46 |
- if len(loadImages) == 0 { |
|
47 |
- // everything is loaded, we're done |
|
48 |
- return nil |
|
49 |
- } |
|
50 |
- |
|
51 |
- ctx := context.Background() |
|
52 |
- fi, err := os.Stat(frozenImgDir) |
|
53 |
- if err != nil || !fi.IsDir() { |
|
54 |
- srcImages := make([]string, 0, len(loadImages)) |
|
55 |
- for _, img := range loadImages { |
|
56 |
- srcImages = append(srcImages, img.srcName) |
|
57 |
- } |
|
58 |
- if err := pullImages(ctx, client, srcImages); err != nil { |
|
59 |
- return errors.Wrap(err, "error pulling image list") |
|
60 |
- } |
|
61 |
- } else { |
|
62 |
- if err := loadFrozenImages(ctx, client); err != nil { |
|
63 |
- return err |
|
64 |
- } |
|
65 |
- } |
|
66 |
- |
|
67 |
- for _, img := range loadImages { |
|
68 |
- if img.srcName != img.destName { |
|
69 |
- if err := client.ImageTag(ctx, img.srcName, img.destName); err != nil { |
|
70 |
- return errors.Wrapf(err, "failed to tag %s as %s", img.srcName, img.destName) |
|
71 |
- } |
|
72 |
- if _, err := client.ImageRemove(ctx, img.srcName, types.ImageRemoveOptions{}); err != nil { |
|
73 |
- return errors.Wrapf(err, "failed to remove %s", img.srcName) |
|
74 |
- } |
|
75 |
- } |
|
76 |
- } |
|
77 |
- return nil |
|
78 |
-} |
|
79 |
- |
|
80 |
-func imageExists(client client.APIClient, name string) bool { |
|
81 |
- _, _, err := client.ImageInspectWithRaw(context.Background(), name) |
|
82 |
- return err == nil |
|
83 |
-} |
|
84 |
- |
|
85 |
-func loadFrozenImages(ctx context.Context, client client.APIClient) error { |
|
86 |
- tar, err := exec.LookPath("tar") |
|
87 |
- if err != nil { |
|
88 |
- return errors.Wrap(err, "could not find tar binary") |
|
89 |
- } |
|
90 |
- tarCmd := exec.Command(tar, "-cC", frozenImgDir, ".") |
|
91 |
- out, err := tarCmd.StdoutPipe() |
|
92 |
- if err != nil { |
|
93 |
- return errors.Wrap(err, "error getting stdout pipe for tar command") |
|
94 |
- } |
|
95 |
- |
|
96 |
- errBuf := bytes.NewBuffer(nil) |
|
97 |
- tarCmd.Stderr = errBuf |
|
98 |
- tarCmd.Start() |
|
99 |
- defer tarCmd.Wait() |
|
100 |
- |
|
101 |
- resp, err := client.ImageLoad(ctx, out, true) |
|
102 |
- if err != nil { |
|
103 |
- return errors.Wrap(err, "failed to load frozen images") |
|
104 |
- } |
|
105 |
- defer resp.Body.Close() |
|
106 |
- fd, isTerminal := term.GetFdInfo(os.Stdout) |
|
107 |
- return jsonmessage.DisplayJSONMessagesStream(resp.Body, os.Stdout, fd, isTerminal, nil) |
|
108 |
-} |
|
109 |
- |
|
110 |
-func pullImages(ctx context.Context, client client.APIClient, images []string) error { |
|
111 |
- cwd, err := os.Getwd() |
|
112 |
- if err != nil { |
|
113 |
- return errors.Wrap(err, "error getting path to dockerfile") |
|
114 |
- } |
|
115 |
- dockerfile := os.Getenv("DOCKERFILE") |
|
116 |
- if dockerfile == "" { |
|
117 |
- dockerfile = "Dockerfile" |
|
118 |
- } |
|
119 |
- dockerfilePath := filepath.Join(filepath.Dir(filepath.Clean(cwd)), dockerfile) |
|
120 |
- pullRefs, err := readFrozenImageList(dockerfilePath, images) |
|
121 |
- if err != nil { |
|
122 |
- return errors.Wrap(err, "error reading frozen image list") |
|
123 |
- } |
|
124 |
- |
|
125 |
- var wg sync.WaitGroup |
|
126 |
- chErr := make(chan error, len(images)) |
|
127 |
- for tag, ref := range pullRefs { |
|
128 |
- wg.Add(1) |
|
129 |
- go func(tag, ref string) { |
|
130 |
- defer wg.Done() |
|
131 |
- if err := pullTagAndRemove(ctx, client, ref, tag); err != nil { |
|
132 |
- chErr <- err |
|
133 |
- return |
|
134 |
- } |
|
135 |
- }(tag, ref) |
|
136 |
- } |
|
137 |
- wg.Wait() |
|
138 |
- close(chErr) |
|
139 |
- return <-chErr |
|
140 |
-} |
|
141 |
- |
|
142 |
-func pullTagAndRemove(ctx context.Context, client client.APIClient, ref string, tag string) error { |
|
143 |
- resp, err := client.ImagePull(ctx, ref, types.ImagePullOptions{}) |
|
144 |
- if err != nil { |
|
145 |
- return errors.Wrapf(err, "failed to pull %s", ref) |
|
146 |
- } |
|
147 |
- defer resp.Close() |
|
148 |
- fd, isTerminal := term.GetFdInfo(os.Stdout) |
|
149 |
- if err := jsonmessage.DisplayJSONMessagesStream(resp, os.Stdout, fd, isTerminal, nil); err != nil { |
|
150 |
- return err |
|
151 |
- } |
|
152 |
- |
|
153 |
- if err := client.ImageTag(ctx, ref, tag); err != nil { |
|
154 |
- return errors.Wrapf(err, "failed to tag %s as %s", ref, tag) |
|
155 |
- } |
|
156 |
- _, err = client.ImageRemove(ctx, ref, types.ImageRemoveOptions{}) |
|
157 |
- return errors.Wrapf(err, "failed to remove %s", ref) |
|
158 |
- |
|
159 |
-} |
|
160 |
- |
|
161 |
-func readFrozenImageList(dockerfilePath string, images []string) (map[string]string, error) { |
|
162 |
- f, err := os.Open(dockerfilePath) |
|
163 |
- if err != nil { |
|
164 |
- return nil, errors.Wrap(err, "error reading dockerfile") |
|
165 |
- } |
|
166 |
- defer f.Close() |
|
167 |
- ls := make(map[string]string) |
|
168 |
- |
|
169 |
- scanner := bufio.NewScanner(f) |
|
170 |
- for scanner.Scan() { |
|
171 |
- line := strings.Fields(scanner.Text()) |
|
172 |
- if len(line) < 3 { |
|
173 |
- continue |
|
174 |
- } |
|
175 |
- if !(line[0] == "RUN" && line[1] == "./contrib/download-frozen-image-v2.sh") { |
|
176 |
- continue |
|
177 |
- } |
|
178 |
- |
|
179 |
- for scanner.Scan() { |
|
180 |
- img := strings.TrimSpace(scanner.Text()) |
|
181 |
- img = strings.TrimSuffix(img, "\\") |
|
182 |
- img = strings.TrimSpace(img) |
|
183 |
- split := strings.Split(img, "@") |
|
184 |
- if len(split) < 2 { |
|
185 |
- break |
|
186 |
- } |
|
187 |
- |
|
188 |
- for _, i := range images { |
|
189 |
- if split[0] == i { |
|
190 |
- ls[i] = img |
|
191 |
- break |
|
192 |
- } |
|
193 |
- } |
|
194 |
- } |
|
195 |
- } |
|
196 |
- return ls, nil |
|
197 |
-} |
198 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,21 +0,0 @@ |
1 |
-MIIDhTCCAm2gAwIBAgIJAP2EcMN2UXPcMA0GCSqGSIb3DQEBCwUAMFcxCzAJBgNV |
|
2 |
-BAYTAlVTMQswCQYDVQQIEwJDQTEVMBMGA1UEBxMMU2FuRnJhbmNpc2NvMQ8wDQYD |
|
3 |
-VQQKEwZEb2NrZXIxEzARBgNVBAMTCmRlbGVnYXRpb24wH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DMAzCCpWlEPbZoFMl6F49+7jG0/TiqM/WRUSQnNtufPMbrR9Je4QM1 |
|
24 |
-L1UCANCPaHFOncKYer15NfIV1ctt5MZKImevDsUaQO8CUlO+dzd5H8KvHw9E29gA |
|
25 |
-B22v8k3jIjsYeRL+UJ/sBnWHgxdAe/NEM+TdlP2oP9D1gTifutPqAg== |
26 | 1 |
deleted file mode 100755 |
... | ... |
@@ -1,18 +0,0 @@ |
1 |
-for selfsigned in delgkey1 delgkey2 delgkey3 delgkey4; do |
|
2 |
- subj='/C=US/ST=CA/L=SanFrancisco/O=Docker/CN=delegation' |
|
3 |
- |
|
4 |
- openssl genrsa -out "${selfsigned}.key" 2048 |
|
5 |
- openssl req -new -key "${selfsigned}.key" -out "${selfsigned}.csr" -sha256 -subj "${subj}" |
|
6 |
- cat > "${selfsigned}.cnf" <<EOL |
|
7 |
-[selfsigned] |
|
8 |
-basicConstraints = critical,CA:FALSE |
|
9 |
-keyUsage = critical, digitalSignature, keyEncipherment |
|
10 |
-extendedKeyUsage=codeSigning |
|
11 |
-subjectKeyIdentifier=hash |
|
12 |
-EOL |
|
13 |
- |
|
14 |
- openssl x509 -req -days 3560 -in "${selfsigned}.csr" -signkey "${selfsigned}.key" -sha256 \ |
|
15 |
- -out "${selfsigned}.crt" -extfile "${selfsigned}.cnf" -extensions selfsigned |
|
16 |
- |
|
17 |
- rm "${selfsigned}.cnf" "${selfsigned}.csr" |
|
18 |
-done |
19 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,19 +0,0 @@ |
1 |
-MIIDCTCCAfOgAwIBAgIQTOoFF+ypXwgdXnXHuCTvYDALBgkqhkiG9w0BAQswJjER |
|
2 |
-MA8GA1UEChMIUXVpY2tUTFMxETAPBgNVBAMTCFF1aWNrVExTMB4XDTE1MDcxNzE5 |
|
3 |
-NDg1M1oXDTE4MDcwMTE5NDg1M1owJzERMA8GA1UEChMIUXVpY2tUTFMxEjAQBgNV |
|
4 |
-BAMTCWxvY2FsaG9zdDC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l5WsViNMIx6p2OJapu0dzbv2 |
|
17 |
-KTXrnoRCafcH92k0dUX1ahE9eyc8KX6VhbWwXLMCgYATGCCuEDoC+gVAMzM8jOQF |
|
18 |
-xrBMjwr+IP+GvskUv/pg5tJ9V/FRR5dmkWDJ4p9lCUWkZTqZ6FCqHFKVTLkg2LjG |
|
19 |
-VWS34HLOAwskxrCRXJG22KEW/TWWr31j46yFpjZzJwrzOvftMfpo+BI3V8IH/f+x |
|
20 |
-EtxLzYKdoRy6x8VH67YgwQKBgHor2vjV45142FuK83AHa6SqOZXSuvWWrGJ6Ep7p |
|
21 |
-doSN2jRaLXi2S9AaznOdy6JxFGUCGJHrcccpXgsGrjNtFLXxJKTFa1sYtwQkALsk |
|
22 |
-ZOltJQF09D1krGC0driHntrUMvqOiKye+sS0DRS6cIuaCUAhUiELwoC5SaoV0zKy |
|
23 |
-IDUxAoGAOK8Xq+3/sqe79vTpw25RXl+nkAmOAeKjqf3Kh6jbnBhr81rmefyKXB9a |
|
24 |
-uj0b980tzUnliwA5cCOsyxfN2vASvMnJxFE721QZI04arlcPFHcFqCtmNnUYTcLp |
|
25 |
-0hgn/yLZptcoxpy+eTBu3eNsxz1Bu/Tx/198+2Wr3MbtGpLNIcA= |
26 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,34 +0,0 @@ |
1 |
-package main |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "fmt" |
|
5 |
- "net" |
|
6 |
- "net/http" |
|
7 |
- "os" |
|
8 |
- "path/filepath" |
|
9 |
-) |
|
10 |
- |
|
11 |
-func main() { |
|
12 |
- p, err := filepath.Abs(filepath.Join("run", "docker", "plugins")) |
|
13 |
- if err != nil { |
|
14 |
- panic(err) |
|
15 |
- } |
|
16 |
- if err := os.MkdirAll(p, 0755); err != nil { |
|
17 |
- panic(err) |
|
18 |
- } |
|
19 |
- l, err := net.Listen("unix", filepath.Join(p, "basic.sock")) |
|
20 |
- if err != nil { |
|
21 |
- panic(err) |
|
22 |
- } |
|
23 |
- |
|
24 |
- mux := http.NewServeMux() |
|
25 |
- server := http.Server{ |
|
26 |
- Addr: l.Addr().String(), |
|
27 |
- Handler: http.NewServeMux(), |
|
28 |
- } |
|
29 |
- mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) { |
|
30 |
- w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json") |
|
31 |
- fmt.Println(w, `{"Implements": ["dummy"]}`) |
|
32 |
- }) |
|
33 |
- server.Serve(l) |
|
34 |
-} |
35 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,215 +0,0 @@ |
1 |
-package plugin // import "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "encoding/json" |
|
5 |
- "io" |
|
6 |
- "io/ioutil" |
|
7 |
- "os" |
|
8 |
- "os/exec" |
|
9 |
- "path/filepath" |
|
10 |
- "time" |
|
11 |
- |
|
12 |
- "github.com/docker/docker/api/types" |
|
13 |
- "github.com/docker/docker/pkg/archive" |
|
14 |
- "github.com/docker/docker/plugin" |
|
15 |
- "github.com/docker/docker/registry" |
|
16 |
- "github.com/pkg/errors" |
|
17 |
- "golang.org/x/net/context" |
|
18 |
-) |
|
19 |
- |
|
20 |
-// CreateOpt is is passed used to change the default plugin config before |
|
21 |
-// creating it |
|
22 |
-type CreateOpt func(*Config) |
|
23 |
- |
|
24 |
-// Config wraps types.PluginConfig to provide some extra state for options |
|
25 |
-// extra customizations on the plugin details, such as using a custom binary to |
|
26 |
-// create the plugin with. |
|
27 |
-type Config struct { |
|
28 |
- *types.PluginConfig |
|
29 |
- binPath string |
|
30 |
-} |
|
31 |
- |
|
32 |
-// WithBinary is a CreateOpt to set an custom binary to create the plugin with. |
|
33 |
-// This binary must be statically compiled. |
|
34 |
-func WithBinary(bin string) CreateOpt { |
|
35 |
- return func(cfg *Config) { |
|
36 |
- cfg.binPath = bin |
|
37 |
- } |
|
38 |
-} |
|
39 |
- |
|
40 |
-// CreateClient is the interface used for `BuildPlugin` to interact with the |
|
41 |
-// daemon. |
|
42 |
-type CreateClient interface { |
|
43 |
- PluginCreate(context.Context, io.Reader, types.PluginCreateOptions) error |
|
44 |
-} |
|
45 |
- |
|
46 |
-// Create creates a new plugin with the specified name |
|
47 |
-func Create(ctx context.Context, c CreateClient, name string, opts ...CreateOpt) error { |
|
48 |
- tmpDir, err := ioutil.TempDir("", "create-test-plugin") |
|
49 |
- if err != nil { |
|
50 |
- return err |
|
51 |
- } |
|
52 |
- defer os.RemoveAll(tmpDir) |
|
53 |
- |
|
54 |
- tar, err := makePluginBundle(tmpDir, opts...) |
|
55 |
- if err != nil { |
|
56 |
- return err |
|
57 |
- } |
|
58 |
- defer tar.Close() |
|
59 |
- |
|
60 |
- ctx, cancel := context.WithTimeout(ctx, 30*time.Second) |
|
61 |
- defer cancel() |
|
62 |
- |
|
63 |
- return c.PluginCreate(ctx, tar, types.PluginCreateOptions{RepoName: name}) |
|
64 |
-} |
|
65 |
- |
|
66 |
-// CreateInRegistry makes a plugin (locally) and pushes it to a registry. |
|
67 |
-// This does not use a dockerd instance to create or push the plugin. |
|
68 |
-// If you just want to create a plugin in some daemon, use `Create`. |
|
69 |
-// |
|
70 |
-// This can be useful when testing plugins on swarm where you don't really want |
|
71 |
-// the plugin to exist on any of the daemons (immediately) and there needs to be |
|
72 |
-// some way to distribute the plugin. |
|
73 |
-func CreateInRegistry(ctx context.Context, repo string, auth *types.AuthConfig, opts ...CreateOpt) error { |
|
74 |
- tmpDir, err := ioutil.TempDir("", "create-test-plugin-local") |
|
75 |
- if err != nil { |
|
76 |
- return err |
|
77 |
- } |
|
78 |
- defer os.RemoveAll(tmpDir) |
|
79 |
- |
|
80 |
- inPath := filepath.Join(tmpDir, "plugin") |
|
81 |
- if err := os.MkdirAll(inPath, 0755); err != nil { |
|
82 |
- return errors.Wrap(err, "error creating plugin root") |
|
83 |
- } |
|
84 |
- |
|
85 |
- tar, err := makePluginBundle(inPath, opts...) |
|
86 |
- if err != nil { |
|
87 |
- return err |
|
88 |
- } |
|
89 |
- defer tar.Close() |
|
90 |
- |
|
91 |
- dummyExec := func(m *plugin.Manager) (plugin.Executor, error) { |
|
92 |
- return nil, nil |
|
93 |
- } |
|
94 |
- |
|
95 |
- regService, err := registry.NewService(registry.ServiceOptions{V2Only: true}) |
|
96 |
- if err != nil { |
|
97 |
- return err |
|
98 |
- } |
|
99 |
- |
|
100 |
- managerConfig := plugin.ManagerConfig{ |
|
101 |
- Store: plugin.NewStore(), |
|
102 |
- RegistryService: regService, |
|
103 |
- Root: filepath.Join(tmpDir, "root"), |
|
104 |
- ExecRoot: "/run/docker", // manager init fails if not set |
|
105 |
- CreateExecutor: dummyExec, |
|
106 |
- LogPluginEvent: func(id, name, action string) {}, // panics when not set |
|
107 |
- } |
|
108 |
- manager, err := plugin.NewManager(managerConfig) |
|
109 |
- if err != nil { |
|
110 |
- return errors.Wrap(err, "error creating plugin manager") |
|
111 |
- } |
|
112 |
- |
|
113 |
- ctx, cancel := context.WithTimeout(ctx, 30*time.Second) |
|
114 |
- defer cancel() |
|
115 |
- if err := manager.CreateFromContext(ctx, tar, &types.PluginCreateOptions{RepoName: repo}); err != nil { |
|
116 |
- return err |
|
117 |
- } |
|
118 |
- |
|
119 |
- if auth == nil { |
|
120 |
- auth = &types.AuthConfig{} |
|
121 |
- } |
|
122 |
- err = manager.Push(ctx, repo, nil, auth, ioutil.Discard) |
|
123 |
- return errors.Wrap(err, "error pushing plugin") |
|
124 |
-} |
|
125 |
- |
|
126 |
-func makePluginBundle(inPath string, opts ...CreateOpt) (io.ReadCloser, error) { |
|
127 |
- p := &types.PluginConfig{ |
|
128 |
- Interface: types.PluginConfigInterface{ |
|
129 |
- Socket: "basic.sock", |
|
130 |
- Types: []types.PluginInterfaceType{{Capability: "docker.dummy/1.0"}}, |
|
131 |
- }, |
|
132 |
- Entrypoint: []string{"/basic"}, |
|
133 |
- } |
|
134 |
- cfg := &Config{ |
|
135 |
- PluginConfig: p, |
|
136 |
- } |
|
137 |
- for _, o := range opts { |
|
138 |
- o(cfg) |
|
139 |
- } |
|
140 |
- if cfg.binPath == "" { |
|
141 |
- binPath, err := ensureBasicPluginBin() |
|
142 |
- if err != nil { |
|
143 |
- return nil, err |
|
144 |
- } |
|
145 |
- cfg.binPath = binPath |
|
146 |
- } |
|
147 |
- |
|
148 |
- configJSON, err := json.Marshal(p) |
|
149 |
- if err != nil { |
|
150 |
- return nil, err |
|
151 |
- } |
|
152 |
- if err := ioutil.WriteFile(filepath.Join(inPath, "config.json"), configJSON, 0644); err != nil { |
|
153 |
- return nil, err |
|
154 |
- } |
|
155 |
- if err := os.MkdirAll(filepath.Join(inPath, "rootfs", filepath.Dir(p.Entrypoint[0])), 0755); err != nil { |
|
156 |
- return nil, errors.Wrap(err, "error creating plugin rootfs dir") |
|
157 |
- } |
|
158 |
- |
|
159 |
- // Ensure the mount target paths exist |
|
160 |
- for _, m := range p.Mounts { |
|
161 |
- var stat os.FileInfo |
|
162 |
- if m.Source != nil { |
|
163 |
- stat, err = os.Stat(*m.Source) |
|
164 |
- if err != nil && !os.IsNotExist(err) { |
|
165 |
- return nil, err |
|
166 |
- } |
|
167 |
- } |
|
168 |
- |
|
169 |
- if stat == nil || stat.IsDir() { |
|
170 |
- var mode os.FileMode = 0755 |
|
171 |
- if stat != nil { |
|
172 |
- mode = stat.Mode() |
|
173 |
- } |
|
174 |
- if err := os.MkdirAll(filepath.Join(inPath, "rootfs", m.Destination), mode); err != nil { |
|
175 |
- return nil, errors.Wrap(err, "error preparing plugin mount destination path") |
|
176 |
- } |
|
177 |
- } else { |
|
178 |
- if err := os.MkdirAll(filepath.Join(inPath, "rootfs", filepath.Dir(m.Destination)), 0755); err != nil { |
|
179 |
- return nil, errors.Wrap(err, "error preparing plugin mount destination dir") |
|
180 |
- } |
|
181 |
- f, err := os.Create(filepath.Join(inPath, "rootfs", m.Destination)) |
|
182 |
- if err != nil && !os.IsExist(err) { |
|
183 |
- return nil, errors.Wrap(err, "error preparing plugin mount destination file") |
|
184 |
- } |
|
185 |
- if f != nil { |
|
186 |
- f.Close() |
|
187 |
- } |
|
188 |
- } |
|
189 |
- } |
|
190 |
- if err := archive.NewDefaultArchiver().CopyFileWithTar(cfg.binPath, filepath.Join(inPath, "rootfs", p.Entrypoint[0])); err != nil { |
|
191 |
- return nil, errors.Wrap(err, "error copying plugin binary to rootfs path") |
|
192 |
- } |
|
193 |
- tar, err := archive.Tar(inPath, archive.Uncompressed) |
|
194 |
- return tar, errors.Wrap(err, "error making plugin archive") |
|
195 |
-} |
|
196 |
- |
|
197 |
-func ensureBasicPluginBin() (string, error) { |
|
198 |
- name := "docker-basic-plugin" |
|
199 |
- p, err := exec.LookPath(name) |
|
200 |
- if err == nil { |
|
201 |
- return p, nil |
|
202 |
- } |
|
203 |
- |
|
204 |
- goBin, err := exec.LookPath("go") |
|
205 |
- if err != nil { |
|
206 |
- return "", err |
|
207 |
- } |
|
208 |
- installPath := filepath.Join(os.Getenv("GOPATH"), "bin", name) |
|
209 |
- cmd := exec.Command(goBin, "build", "-o", installPath, "./"+filepath.Join("fixtures", "plugin", "basic")) |
|
210 |
- cmd.Env = append(cmd.Env, "CGO_ENABLED=0") |
|
211 |
- if out, err := cmd.CombinedOutput(); err != nil { |
|
212 |
- return "", errors.Wrapf(err, "error building basic plugin bin: %s", string(out)) |
|
213 |
- } |
|
214 |
- return installPath, nil |
|
215 |
-} |
... | ... |
@@ -9,7 +9,7 @@ import ( |
9 | 9 |
"time" |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/types" |
12 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
12 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
13 | 13 |
"github.com/docker/docker/pkg/locker" |
14 | 14 |
"github.com/pkg/errors" |
15 | 15 |
) |
... | ... |
@@ -9,7 +9,7 @@ import ( |
9 | 9 |
"time" |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/types" |
12 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
12 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
13 | 13 |
"github.com/docker/docker/pkg/locker" |
14 | 14 |
"github.com/pkg/errors" |
15 | 15 |
) |
... | ... |
@@ -7,8 +7,8 @@ import ( |
7 | 7 |
"testing" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/types" |
10 |
- "github.com/docker/docker/integration-cli/fixtures/plugin" |
|
11 | 10 |
"github.com/docker/docker/internal/test/daemon" |
11 |
+ "github.com/docker/docker/internal/test/fixtures/plugin" |
|
12 | 12 |
"github.com/gotestyourself/gotestyourself/assert" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -8,7 +8,7 @@ import ( |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/types" |
10 | 10 |
"github.com/docker/docker/client" |
11 |
- "github.com/docker/docker/integration-cli/fixtures/load" |
|
11 |
+ "github.com/docker/docker/internal/test/fixtures/load" |
|
12 | 12 |
"github.com/pkg/errors" |
13 | 13 |
"golang.org/x/net/context" |
14 | 14 |
) |
15 | 15 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,197 @@ |
0 |
+package load // import "github.com/docker/docker/internal/test/fixtures/load" |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "bufio" |
|
4 |
+ "bytes" |
|
5 |
+ "os" |
|
6 |
+ "os/exec" |
|
7 |
+ "path/filepath" |
|
8 |
+ "strings" |
|
9 |
+ "sync" |
|
10 |
+ |
|
11 |
+ "context" |
|
12 |
+ |
|
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ "github.com/docker/docker/client" |
|
15 |
+ "github.com/docker/docker/pkg/jsonmessage" |
|
16 |
+ "github.com/docker/docker/pkg/term" |
|
17 |
+ "github.com/pkg/errors" |
|
18 |
+) |
|
19 |
+ |
|
20 |
+const frozenImgDir = "/docker-frozen-images" |
|
21 |
+ |
|
22 |
+// FrozenImagesLinux loads the frozen image set for the integration suite |
|
23 |
+// If the images are not available locally it will download them |
|
24 |
+// TODO: This loads whatever is in the frozen image dir, regardless of what |
|
25 |
+// images were passed in. If the images need to be downloaded, then it will respect |
|
26 |
+// the passed in images |
|
27 |
+func FrozenImagesLinux(client client.APIClient, images ...string) error { |
|
28 |
+ var loadImages []struct{ srcName, destName string } |
|
29 |
+ for _, img := range images { |
|
30 |
+ if !imageExists(client, img) { |
|
31 |
+ srcName := img |
|
32 |
+ // hello-world:latest gets re-tagged as hello-world:frozen |
|
33 |
+ // there are some tests that use hello-world:latest specifically so it pulls |
|
34 |
+ // the image and hello-world:frozen is used for when we just want a super |
|
35 |
+ // small image |
|
36 |
+ if img == "hello-world:frozen" { |
|
37 |
+ srcName = "hello-world:latest" |
|
38 |
+ } |
|
39 |
+ loadImages = append(loadImages, struct{ srcName, destName string }{ |
|
40 |
+ srcName: srcName, |
|
41 |
+ destName: img, |
|
42 |
+ }) |
|
43 |
+ } |
|
44 |
+ } |
|
45 |
+ if len(loadImages) == 0 { |
|
46 |
+ // everything is loaded, we're done |
|
47 |
+ return nil |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+ ctx := context.Background() |
|
51 |
+ fi, err := os.Stat(frozenImgDir) |
|
52 |
+ if err != nil || !fi.IsDir() { |
|
53 |
+ srcImages := make([]string, 0, len(loadImages)) |
|
54 |
+ for _, img := range loadImages { |
|
55 |
+ srcImages = append(srcImages, img.srcName) |
|
56 |
+ } |
|
57 |
+ if err := pullImages(ctx, client, srcImages); err != nil { |
|
58 |
+ return errors.Wrap(err, "error pulling image list") |
|
59 |
+ } |
|
60 |
+ } else { |
|
61 |
+ if err := loadFrozenImages(ctx, client); err != nil { |
|
62 |
+ return err |
|
63 |
+ } |
|
64 |
+ } |
|
65 |
+ |
|
66 |
+ for _, img := range loadImages { |
|
67 |
+ if img.srcName != img.destName { |
|
68 |
+ if err := client.ImageTag(ctx, img.srcName, img.destName); err != nil { |
|
69 |
+ return errors.Wrapf(err, "failed to tag %s as %s", img.srcName, img.destName) |
|
70 |
+ } |
|
71 |
+ if _, err := client.ImageRemove(ctx, img.srcName, types.ImageRemoveOptions{}); err != nil { |
|
72 |
+ return errors.Wrapf(err, "failed to remove %s", img.srcName) |
|
73 |
+ } |
|
74 |
+ } |
|
75 |
+ } |
|
76 |
+ return nil |
|
77 |
+} |
|
78 |
+ |
|
79 |
+func imageExists(client client.APIClient, name string) bool { |
|
80 |
+ _, _, err := client.ImageInspectWithRaw(context.Background(), name) |
|
81 |
+ return err == nil |
|
82 |
+} |
|
83 |
+ |
|
84 |
+func loadFrozenImages(ctx context.Context, client client.APIClient) error { |
|
85 |
+ tar, err := exec.LookPath("tar") |
|
86 |
+ if err != nil { |
|
87 |
+ return errors.Wrap(err, "could not find tar binary") |
|
88 |
+ } |
|
89 |
+ tarCmd := exec.Command(tar, "-cC", frozenImgDir, ".") |
|
90 |
+ out, err := tarCmd.StdoutPipe() |
|
91 |
+ if err != nil { |
|
92 |
+ return errors.Wrap(err, "error getting stdout pipe for tar command") |
|
93 |
+ } |
|
94 |
+ |
|
95 |
+ errBuf := bytes.NewBuffer(nil) |
|
96 |
+ tarCmd.Stderr = errBuf |
|
97 |
+ tarCmd.Start() |
|
98 |
+ defer tarCmd.Wait() |
|
99 |
+ |
|
100 |
+ resp, err := client.ImageLoad(ctx, out, true) |
|
101 |
+ if err != nil { |
|
102 |
+ return errors.Wrap(err, "failed to load frozen images") |
|
103 |
+ } |
|
104 |
+ defer resp.Body.Close() |
|
105 |
+ fd, isTerminal := term.GetFdInfo(os.Stdout) |
|
106 |
+ return jsonmessage.DisplayJSONMessagesStream(resp.Body, os.Stdout, fd, isTerminal, nil) |
|
107 |
+} |
|
108 |
+ |
|
109 |
+func pullImages(ctx context.Context, client client.APIClient, images []string) error { |
|
110 |
+ cwd, err := os.Getwd() |
|
111 |
+ if err != nil { |
|
112 |
+ return errors.Wrap(err, "error getting path to dockerfile") |
|
113 |
+ } |
|
114 |
+ dockerfile := os.Getenv("DOCKERFILE") |
|
115 |
+ if dockerfile == "" { |
|
116 |
+ dockerfile = "Dockerfile" |
|
117 |
+ } |
|
118 |
+ dockerfilePath := filepath.Join(filepath.Dir(filepath.Clean(cwd)), dockerfile) |
|
119 |
+ pullRefs, err := readFrozenImageList(dockerfilePath, images) |
|
120 |
+ if err != nil { |
|
121 |
+ return errors.Wrap(err, "error reading frozen image list") |
|
122 |
+ } |
|
123 |
+ |
|
124 |
+ var wg sync.WaitGroup |
|
125 |
+ chErr := make(chan error, len(images)) |
|
126 |
+ for tag, ref := range pullRefs { |
|
127 |
+ wg.Add(1) |
|
128 |
+ go func(tag, ref string) { |
|
129 |
+ defer wg.Done() |
|
130 |
+ if err := pullTagAndRemove(ctx, client, ref, tag); err != nil { |
|
131 |
+ chErr <- err |
|
132 |
+ return |
|
133 |
+ } |
|
134 |
+ }(tag, ref) |
|
135 |
+ } |
|
136 |
+ wg.Wait() |
|
137 |
+ close(chErr) |
|
138 |
+ return <-chErr |
|
139 |
+} |
|
140 |
+ |
|
141 |
+func pullTagAndRemove(ctx context.Context, client client.APIClient, ref string, tag string) error { |
|
142 |
+ resp, err := client.ImagePull(ctx, ref, types.ImagePullOptions{}) |
|
143 |
+ if err != nil { |
|
144 |
+ return errors.Wrapf(err, "failed to pull %s", ref) |
|
145 |
+ } |
|
146 |
+ defer resp.Close() |
|
147 |
+ fd, isTerminal := term.GetFdInfo(os.Stdout) |
|
148 |
+ if err := jsonmessage.DisplayJSONMessagesStream(resp, os.Stdout, fd, isTerminal, nil); err != nil { |
|
149 |
+ return err |
|
150 |
+ } |
|
151 |
+ |
|
152 |
+ if err := client.ImageTag(ctx, ref, tag); err != nil { |
|
153 |
+ return errors.Wrapf(err, "failed to tag %s as %s", ref, tag) |
|
154 |
+ } |
|
155 |
+ _, err = client.ImageRemove(ctx, ref, types.ImageRemoveOptions{}) |
|
156 |
+ return errors.Wrapf(err, "failed to remove %s", ref) |
|
157 |
+ |
|
158 |
+} |
|
159 |
+ |
|
160 |
+func readFrozenImageList(dockerfilePath string, images []string) (map[string]string, error) { |
|
161 |
+ f, err := os.Open(dockerfilePath) |
|
162 |
+ if err != nil { |
|
163 |
+ return nil, errors.Wrap(err, "error reading dockerfile") |
|
164 |
+ } |
|
165 |
+ defer f.Close() |
|
166 |
+ ls := make(map[string]string) |
|
167 |
+ |
|
168 |
+ scanner := bufio.NewScanner(f) |
|
169 |
+ for scanner.Scan() { |
|
170 |
+ line := strings.Fields(scanner.Text()) |
|
171 |
+ if len(line) < 3 { |
|
172 |
+ continue |
|
173 |
+ } |
|
174 |
+ if !(line[0] == "RUN" && line[1] == "./contrib/download-frozen-image-v2.sh") { |
|
175 |
+ continue |
|
176 |
+ } |
|
177 |
+ |
|
178 |
+ for scanner.Scan() { |
|
179 |
+ img := strings.TrimSpace(scanner.Text()) |
|
180 |
+ img = strings.TrimSuffix(img, "\\") |
|
181 |
+ img = strings.TrimSpace(img) |
|
182 |
+ split := strings.Split(img, "@") |
|
183 |
+ if len(split) < 2 { |
|
184 |
+ break |
|
185 |
+ } |
|
186 |
+ |
|
187 |
+ for _, i := range images { |
|
188 |
+ if split[0] == i { |
|
189 |
+ ls[i] = img |
|
190 |
+ break |
|
191 |
+ } |
|
192 |
+ } |
|
193 |
+ } |
|
194 |
+ } |
|
195 |
+ return ls, nil |
|
196 |
+} |
0 | 197 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
0 |
+package main |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "fmt" |
|
4 |
+ "net" |
|
5 |
+ "net/http" |
|
6 |
+ "os" |
|
7 |
+ "path/filepath" |
|
8 |
+) |
|
9 |
+ |
|
10 |
+func main() { |
|
11 |
+ p, err := filepath.Abs(filepath.Join("run", "docker", "plugins")) |
|
12 |
+ if err != nil { |
|
13 |
+ panic(err) |
|
14 |
+ } |
|
15 |
+ if err := os.MkdirAll(p, 0755); err != nil { |
|
16 |
+ panic(err) |
|
17 |
+ } |
|
18 |
+ l, err := net.Listen("unix", filepath.Join(p, "basic.sock")) |
|
19 |
+ if err != nil { |
|
20 |
+ panic(err) |
|
21 |
+ } |
|
22 |
+ |
|
23 |
+ mux := http.NewServeMux() |
|
24 |
+ server := http.Server{ |
|
25 |
+ Addr: l.Addr().String(), |
|
26 |
+ Handler: http.NewServeMux(), |
|
27 |
+ } |
|
28 |
+ mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) { |
|
29 |
+ w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json") |
|
30 |
+ fmt.Println(w, `{"Implements": ["dummy"]}`) |
|
31 |
+ }) |
|
32 |
+ server.Serve(l) |
|
33 |
+} |
0 | 34 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,216 @@ |
0 |
+package plugin // import "github.com/docker/docker/internal/test/fixtures/plugin" |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "encoding/json" |
|
4 |
+ "io" |
|
5 |
+ "io/ioutil" |
|
6 |
+ "os" |
|
7 |
+ "os/exec" |
|
8 |
+ "path/filepath" |
|
9 |
+ "time" |
|
10 |
+ |
|
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/pkg/archive" |
|
13 |
+ "github.com/docker/docker/plugin" |
|
14 |
+ "github.com/docker/docker/registry" |
|
15 |
+ "github.com/pkg/errors" |
|
16 |
+ "golang.org/x/net/context" |
|
17 |
+) |
|
18 |
+ |
|
19 |
+// CreateOpt is is passed used to change the default plugin config before |
|
20 |
+// creating it |
|
21 |
+type CreateOpt func(*Config) |
|
22 |
+ |
|
23 |
+// Config wraps types.PluginConfig to provide some extra state for options |
|
24 |
+// extra customizations on the plugin details, such as using a custom binary to |
|
25 |
+// create the plugin with. |
|
26 |
+type Config struct { |
|
27 |
+ *types.PluginConfig |
|
28 |
+ binPath string |
|
29 |
+} |
|
30 |
+ |
|
31 |
+// WithBinary is a CreateOpt to set an custom binary to create the plugin with. |
|
32 |
+// This binary must be statically compiled. |
|
33 |
+func WithBinary(bin string) CreateOpt { |
|
34 |
+ return func(cfg *Config) { |
|
35 |
+ cfg.binPath = bin |
|
36 |
+ } |
|
37 |
+} |
|
38 |
+ |
|
39 |
+// CreateClient is the interface used for `BuildPlugin` to interact with the |
|
40 |
+// daemon. |
|
41 |
+type CreateClient interface { |
|
42 |
+ PluginCreate(context.Context, io.Reader, types.PluginCreateOptions) error |
|
43 |
+} |
|
44 |
+ |
|
45 |
+// Create creates a new plugin with the specified name |
|
46 |
+func Create(ctx context.Context, c CreateClient, name string, opts ...CreateOpt) error { |
|
47 |
+ tmpDir, err := ioutil.TempDir("", "create-test-plugin") |
|
48 |
+ if err != nil { |
|
49 |
+ return err |
|
50 |
+ } |
|
51 |
+ defer os.RemoveAll(tmpDir) |
|
52 |
+ |
|
53 |
+ tar, err := makePluginBundle(tmpDir, opts...) |
|
54 |
+ if err != nil { |
|
55 |
+ return err |
|
56 |
+ } |
|
57 |
+ defer tar.Close() |
|
58 |
+ |
|
59 |
+ ctx, cancel := context.WithTimeout(ctx, 30*time.Second) |
|
60 |
+ defer cancel() |
|
61 |
+ |
|
62 |
+ return c.PluginCreate(ctx, tar, types.PluginCreateOptions{RepoName: name}) |
|
63 |
+} |
|
64 |
+ |
|
65 |
+// CreateInRegistry makes a plugin (locally) and pushes it to a registry. |
|
66 |
+// This does not use a dockerd instance to create or push the plugin. |
|
67 |
+// If you just want to create a plugin in some daemon, use `Create`. |
|
68 |
+// |
|
69 |
+// This can be useful when testing plugins on swarm where you don't really want |
|
70 |
+// the plugin to exist on any of the daemons (immediately) and there needs to be |
|
71 |
+// some way to distribute the plugin. |
|
72 |
+func CreateInRegistry(ctx context.Context, repo string, auth *types.AuthConfig, opts ...CreateOpt) error { |
|
73 |
+ tmpDir, err := ioutil.TempDir("", "create-test-plugin-local") |
|
74 |
+ if err != nil { |
|
75 |
+ return err |
|
76 |
+ } |
|
77 |
+ defer os.RemoveAll(tmpDir) |
|
78 |
+ |
|
79 |
+ inPath := filepath.Join(tmpDir, "plugin") |
|
80 |
+ if err := os.MkdirAll(inPath, 0755); err != nil { |
|
81 |
+ return errors.Wrap(err, "error creating plugin root") |
|
82 |
+ } |
|
83 |
+ |
|
84 |
+ tar, err := makePluginBundle(inPath, opts...) |
|
85 |
+ if err != nil { |
|
86 |
+ return err |
|
87 |
+ } |
|
88 |
+ defer tar.Close() |
|
89 |
+ |
|
90 |
+ dummyExec := func(m *plugin.Manager) (plugin.Executor, error) { |
|
91 |
+ return nil, nil |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ regService, err := registry.NewService(registry.ServiceOptions{V2Only: true}) |
|
95 |
+ if err != nil { |
|
96 |
+ return err |
|
97 |
+ } |
|
98 |
+ |
|
99 |
+ managerConfig := plugin.ManagerConfig{ |
|
100 |
+ Store: plugin.NewStore(), |
|
101 |
+ RegistryService: regService, |
|
102 |
+ Root: filepath.Join(tmpDir, "root"), |
|
103 |
+ ExecRoot: "/run/docker", // manager init fails if not set |
|
104 |
+ CreateExecutor: dummyExec, |
|
105 |
+ LogPluginEvent: func(id, name, action string) {}, // panics when not set |
|
106 |
+ } |
|
107 |
+ manager, err := plugin.NewManager(managerConfig) |
|
108 |
+ if err != nil { |
|
109 |
+ return errors.Wrap(err, "error creating plugin manager") |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ ctx, cancel := context.WithTimeout(ctx, 30*time.Second) |
|
113 |
+ defer cancel() |
|
114 |
+ if err := manager.CreateFromContext(ctx, tar, &types.PluginCreateOptions{RepoName: repo}); err != nil { |
|
115 |
+ return err |
|
116 |
+ } |
|
117 |
+ |
|
118 |
+ if auth == nil { |
|
119 |
+ auth = &types.AuthConfig{} |
|
120 |
+ } |
|
121 |
+ err = manager.Push(ctx, repo, nil, auth, ioutil.Discard) |
|
122 |
+ return errors.Wrap(err, "error pushing plugin") |
|
123 |
+} |
|
124 |
+ |
|
125 |
+func makePluginBundle(inPath string, opts ...CreateOpt) (io.ReadCloser, error) { |
|
126 |
+ p := &types.PluginConfig{ |
|
127 |
+ Interface: types.PluginConfigInterface{ |
|
128 |
+ Socket: "basic.sock", |
|
129 |
+ Types: []types.PluginInterfaceType{{Capability: "docker.dummy/1.0"}}, |
|
130 |
+ }, |
|
131 |
+ Entrypoint: []string{"/basic"}, |
|
132 |
+ } |
|
133 |
+ cfg := &Config{ |
|
134 |
+ PluginConfig: p, |
|
135 |
+ } |
|
136 |
+ for _, o := range opts { |
|
137 |
+ o(cfg) |
|
138 |
+ } |
|
139 |
+ if cfg.binPath == "" { |
|
140 |
+ binPath, err := ensureBasicPluginBin() |
|
141 |
+ if err != nil { |
|
142 |
+ return nil, err |
|
143 |
+ } |
|
144 |
+ cfg.binPath = binPath |
|
145 |
+ } |
|
146 |
+ |
|
147 |
+ configJSON, err := json.Marshal(p) |
|
148 |
+ if err != nil { |
|
149 |
+ return nil, err |
|
150 |
+ } |
|
151 |
+ if err := ioutil.WriteFile(filepath.Join(inPath, "config.json"), configJSON, 0644); err != nil { |
|
152 |
+ return nil, err |
|
153 |
+ } |
|
154 |
+ if err := os.MkdirAll(filepath.Join(inPath, "rootfs", filepath.Dir(p.Entrypoint[0])), 0755); err != nil { |
|
155 |
+ return nil, errors.Wrap(err, "error creating plugin rootfs dir") |
|
156 |
+ } |
|
157 |
+ |
|
158 |
+ // Ensure the mount target paths exist |
|
159 |
+ for _, m := range p.Mounts { |
|
160 |
+ var stat os.FileInfo |
|
161 |
+ if m.Source != nil { |
|
162 |
+ stat, err = os.Stat(*m.Source) |
|
163 |
+ if err != nil && !os.IsNotExist(err) { |
|
164 |
+ return nil, err |
|
165 |
+ } |
|
166 |
+ } |
|
167 |
+ |
|
168 |
+ if stat == nil || stat.IsDir() { |
|
169 |
+ var mode os.FileMode = 0755 |
|
170 |
+ if stat != nil { |
|
171 |
+ mode = stat.Mode() |
|
172 |
+ } |
|
173 |
+ if err := os.MkdirAll(filepath.Join(inPath, "rootfs", m.Destination), mode); err != nil { |
|
174 |
+ return nil, errors.Wrap(err, "error preparing plugin mount destination path") |
|
175 |
+ } |
|
176 |
+ } else { |
|
177 |
+ if err := os.MkdirAll(filepath.Join(inPath, "rootfs", filepath.Dir(m.Destination)), 0755); err != nil { |
|
178 |
+ return nil, errors.Wrap(err, "error preparing plugin mount destination dir") |
|
179 |
+ } |
|
180 |
+ f, err := os.Create(filepath.Join(inPath, "rootfs", m.Destination)) |
|
181 |
+ if err != nil && !os.IsExist(err) { |
|
182 |
+ return nil, errors.Wrap(err, "error preparing plugin mount destination file") |
|
183 |
+ } |
|
184 |
+ if f != nil { |
|
185 |
+ f.Close() |
|
186 |
+ } |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ if err := archive.NewDefaultArchiver().CopyFileWithTar(cfg.binPath, filepath.Join(inPath, "rootfs", p.Entrypoint[0])); err != nil { |
|
190 |
+ return nil, errors.Wrap(err, "error copying plugin binary to rootfs path") |
|
191 |
+ } |
|
192 |
+ tar, err := archive.Tar(inPath, archive.Uncompressed) |
|
193 |
+ return tar, errors.Wrap(err, "error making plugin archive") |
|
194 |
+} |
|
195 |
+ |
|
196 |
+func ensureBasicPluginBin() (string, error) { |
|
197 |
+ name := "docker-basic-plugin" |
|
198 |
+ p, err := exec.LookPath(name) |
|
199 |
+ if err == nil { |
|
200 |
+ return p, nil |
|
201 |
+ } |
|
202 |
+ |
|
203 |
+ goBin, err := exec.LookPath("go") |
|
204 |
+ if err != nil { |
|
205 |
+ return "", err |
|
206 |
+ } |
|
207 |
+ installPath := filepath.Join(os.Getenv("GOPATH"), "bin", name) |
|
208 |
+ sourcePath := filepath.Join("github.com", "docker", "docker", "internal", "test", "fixtures", "plugin", "basic") |
|
209 |
+ cmd := exec.Command(goBin, "build", "-o", installPath, sourcePath) |
|
210 |
+ cmd.Env = append(cmd.Env, "GOPATH="+os.Getenv("GOPATH"), "CGO_ENABLED=0") |
|
211 |
+ if out, err := cmd.CombinedOutput(); err != nil { |
|
212 |
+ return "", errors.Wrapf(err, "error building basic plugin bin: %s", string(out)) |
|
213 |
+ } |
|
214 |
+ return installPath, nil |
|
215 |
+} |