Skip to content

Commit

Permalink
Merge pull request #9175 from BenTheElder/node-build
Browse files Browse the repository at this point in the history
kind: don't populate non-existent assets when building node image
  • Loading branch information
k8s-ci-robot authored Aug 28, 2018
2 parents ffd7a6a + aac7849 commit 461bda4
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions kind/pkg/build/node_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,18 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"time"

"github.com/golang/glog"
"github.com/pkg/errors"

"k8s.io/test-infra/kind/pkg/build/kube"
"k8s.io/test-infra/kind/pkg/build/sources"
"k8s.io/test-infra/kind/pkg/exec"
)

// NodeImageBuildContext is used to build the kind node image, and contains
// build configuration
type NodeImageBuildContext struct {
SourceDir string
ImageTag string
Arch string
BaseImage string
Expand Down Expand Up @@ -78,30 +75,11 @@ func (c *NodeImageBuildContext) Build() (err error) {
glog.Infof("Finished building Kubernetes")

// create tempdir to build the image in
tmpDir, err := TempDir("", "kind-node-image")
buildDir, err := TempDir("", "kind-node-image")
if err != nil {
return err
}
defer os.RemoveAll(tmpDir)

// populate with image sources
// if SourceDir is unset, use the baked in sources
buildDir := tmpDir
if c.SourceDir == "" {
// populate with image sources
err = sources.RestoreAssets(buildDir, "images/node")
if err != nil {
return err
}
buildDir = filepath.Join(buildDir, "images", "node")

} else {
err = copyDir(c.SourceDir, buildDir)
if err != nil {
glog.Errorf("failed to copy sources to build dir %v", err)
return err
}
}
defer os.RemoveAll(buildDir)

glog.Infof("Building node image in: %s", buildDir)

Expand Down

0 comments on commit 461bda4

Please sign in to comment.