Skip to content

Commit

Permalink
Merge pull request #1854 from kensipe/kind-version-log
Browse files Browse the repository at this point in the history
export logs kind version
  • Loading branch information
k8s-ci-robot authored Sep 16, 2020
2 parents 1b4b217 + 8893515 commit 4c9c99b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
17 changes: 17 additions & 0 deletions pkg/cluster/internal/providers/common/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"path/filepath"

"sigs.k8s.io/kind/pkg/cluster/nodes"
"sigs.k8s.io/kind/pkg/cmd/kind/version"
"sigs.k8s.io/kind/pkg/errors"
"sigs.k8s.io/kind/pkg/exec"
)
Expand All @@ -22,8 +23,24 @@ func CollectLogs(n nodes.Node, dir string) error {
return cmd.SetStdout(f).SetStderr(f).Run()
}
}
writeToPathFn := func(s string, path string) func() error {
return func() error {
f, err := FileOnHost(path)
if err != nil {
return err
}
defer f.Close()
_, err = f.WriteString(s)
return err
}
}

return errors.AggregateConcurrent([]func() error{
// record info about the node container
writeToPathFn(
version.DisplayVersion(),
filepath.Join(dir, "kind-version.txt"),
),
execToPathFn(
n.Command("cat", "/kind/version"),
"kubernetes-version.txt",
Expand Down
1 change: 0 additions & 1 deletion pkg/cluster/internal/providers/docker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ func (p *provider) CollectLogs(dir string, nodes []nodes.Node) error {
}
// construct a slice of methods to collect logs
fns := []func() error{
// TODO(bentheelder): record the kind version here as well
// record info about the host docker
execToPathFn(
exec.Command("docker", "info"),
Expand Down
1 change: 0 additions & 1 deletion pkg/cluster/internal/providers/podman/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ func (p *provider) CollectLogs(dir string, nodes []nodes.Node) error {
}
// construct a slice of methods to collect logs
fns := []func() error{
// TODO(bentheelder): record the kind version here as well
// record info about the host podman
execToPathFn(
exec.Command("podman", "info"),
Expand Down

0 comments on commit 4c9c99b

Please sign in to comment.