@@ -17,14 +17,23 @@ limitations under the License.
17
17
package deployer
18
18
19
19
import (
20
+ "fmt"
20
21
"os"
22
+ "path/filepath"
23
+ "runtime"
21
24
22
25
"k8s.io/klog/v2"
23
26
24
27
"sigs.k8s.io/kubetest2/pkg/build"
28
+ "sigs.k8s.io/kubetest2/pkg/exec"
29
+ "sigs.k8s.io/kubetest2/pkg/fs"
25
30
"sigs.k8s.io/kubetest2/pkg/process"
26
31
)
27
32
33
+ const (
34
+ target = "all"
35
+ )
36
+
28
37
func (d * deployer ) Build () error {
29
38
args := []string {
30
39
"build" , "node-image" ,
@@ -51,6 +60,30 @@ func (d *deployer) Build() error {
51
60
if err := process .ExecJUnit ("kind" , args , os .Environ ()); err != nil {
52
61
return err
53
62
}
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
+
54
87
build .StoreCommonBinaries (d .KubeRoot , d .commonOptions .RunDir ())
55
88
return nil
56
89
}
0 commit comments