Skip to content

Commit acda51a

Browse files
authored
Merge pull request #275 from elieser1101/build-e2e-requirements-for-kind-deployer
build e2e requirements for kind deployer
2 parents 4799c63 + ee01e12 commit acda51a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

kubetest2-kind/deployer/build.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@ limitations under the License.
1717
package deployer
1818

1919
import (
20+
"fmt"
2021
"os"
22+
"path/filepath"
23+
"runtime"
2124

2225
"k8s.io/klog/v2"
2326

2427
"sigs.k8s.io/kubetest2/pkg/build"
28+
"sigs.k8s.io/kubetest2/pkg/exec"
29+
"sigs.k8s.io/kubetest2/pkg/fs"
2530
"sigs.k8s.io/kubetest2/pkg/process"
2631
)
2732

33+
const (
34+
target = "all"
35+
)
36+
2837
func (d *deployer) Build() error {
2938
args := []string{
3039
"build", "node-image",
@@ -51,6 +60,30 @@ func (d *deployer) Build() error {
5160
if err := process.ExecJUnit("kind", args, os.Environ()); err != nil {
5261
return err
5362
}
63+
klog.V(0).Infof("Build(): build e2e requirements...\n")
64+
e2ePath := "test/e2e/e2e.test"
65+
kubectlPath := "cmd/kubectl"
66+
ginkgoPath := "vendor/github.com/onsi/ginkgo/v2/ginkgo"
67+
68+
// make sure we have e2e requirements
69+
cmd := exec.Command("make", target,
70+
fmt.Sprintf("WHAT=%s %s %s", kubectlPath, e2ePath, ginkgoPath))
71+
cmd.SetDir(d.KubeRoot)
72+
exec.InheritOutput(cmd)
73+
if err := cmd.Run(); err != nil {
74+
return err
75+
}
76+
77+
//move files
78+
const dockerizedOutput = "_output/dockerized"
79+
for _, binary := range build.CommonTestBinaries {
80+
source := filepath.Join(d.KubeRoot, "_output/bin", binary)
81+
dest := filepath.Join(d.KubeRoot, dockerizedOutput, "bin", runtime.GOOS, runtime.GOARCH, binary)
82+
if err := fs.CopyFile(source, dest); err != nil {
83+
klog.Warningf("failed to copy %s to %s: %v", source, dest, err)
84+
}
85+
}
86+
5487
build.StoreCommonBinaries(d.KubeRoot, d.commonOptions.RunDir())
5588
return nil
5689
}

0 commit comments

Comments
 (0)