forked from containerd/containerd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request containerd#1196 from mlaventure/update-windows-run…
…time Update windows runtime
- Loading branch information
Showing
66 changed files
with
2,670 additions
and
1,580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "{build}" | ||
|
||
image: Visual Studio 2017 | ||
|
||
clone_folder: c:\gopath\src\github.com\containerd\containerd | ||
|
||
environment: | ||
GOPATH: C:\gopath | ||
CGO_ENABLED: 1 | ||
|
||
before_build: | ||
- choco install -y mingw | ||
- choco install codecov | ||
|
||
build_script: | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe fmt" | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe vet" | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe binaries" | ||
|
||
test_script: | ||
# TODO: need an equivalent of TRAVIS_COMMIT_RANGE | ||
# - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" C:\MinGW\bin\mingw32-make.exe dco | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe integration" | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe coverage" | ||
- bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe root-coverage" | ||
|
||
on_success: | ||
# Note that, a Codecov upload token is not required. | ||
- codecov -f coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !windows | ||
|
||
package archive | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !windows | ||
|
||
package archive | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !windows | ||
|
||
package containerd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// +build !windows | ||
|
||
package containerd | ||
|
||
const ( | ||
defaultRoot = "/var/lib/containerd-test" | ||
defaultAddress = "/run/containerd-test/containerd.sock" | ||
testImage = "docker.io/library/alpine:latest" | ||
) | ||
|
||
func platformTestSetup(client *Client) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package containerd | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
const ( | ||
defaultAddress = `\\.\pipe\containerd-containerd-test` | ||
testImage = "docker.io/library/go:nanoserver" | ||
) | ||
|
||
var ( | ||
dockerLayerFolders []string | ||
|
||
defaultRoot = filepath.Join(os.Getenv("programfiles"), "containerd", "root-test") | ||
) | ||
|
||
func platformTestSetup(client *Client) error { | ||
var ( | ||
roots []string | ||
layerChains = make(map[string]string) | ||
) | ||
// Since we can't pull images yet, we'll piggyback on the default | ||
// docker's images | ||
wfPath := `C:\ProgramData\docker\windowsfilter` | ||
wf, err := os.Open(wfPath) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to access docker layers @ %s", wfPath) | ||
} | ||
defer wf.Close() | ||
entries, err := wf.Readdirnames(0) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to read %s entries", wfPath) | ||
} | ||
|
||
for _, fn := range entries { | ||
layerChainPath := filepath.Join(wfPath, fn, "layerchain.json") | ||
lfi, err := os.Stat(layerChainPath) | ||
switch { | ||
case err == nil && lfi.Mode().IsRegular(): | ||
f, err := os.OpenFile(layerChainPath, os.O_RDONLY, 0660) | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, | ||
errors.Wrapf(err, "failed to open %s", layerChainPath)) | ||
continue | ||
} | ||
defer f.Close() | ||
l := make([]string, 0) | ||
if err := json.NewDecoder(f).Decode(&l); err != nil { | ||
fmt.Fprintln(os.Stderr, | ||
errors.Wrapf(err, "failed to decode %s", layerChainPath)) | ||
continue | ||
} | ||
switch { | ||
case len(l) == 1: | ||
layerChains[l[0]] = filepath.Join(wfPath, fn) | ||
case len(l) > 1: | ||
fmt.Fprintf(os.Stderr, "Too many entries in %s: %d", layerChainPath, len(l)) | ||
case len(l) == 0: | ||
roots = append(roots, filepath.Join(wfPath, fn)) | ||
} | ||
case os.IsNotExist(err): | ||
// keep on going | ||
default: | ||
return errors.Wrapf(err, "error trying to access %s", layerChainPath) | ||
} | ||
} | ||
|
||
// They'll be 2 roots, just take the first one | ||
l := roots[0] | ||
dockerLayerFolders = append(dockerLayerFolders, l) | ||
for { | ||
l = layerChains[l] | ||
if l == "" { | ||
break | ||
} | ||
|
||
dockerLayerFolders = append([]string{l}, dockerLayerFolders...) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.