File tree Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 17
17
source " $( dirname " $0 " ) /../common.sh"
18
18
source " $( dirname " $0 " ) /setup.sh"
19
19
20
+ build_sample_external_plugin
21
+
20
22
export KIND_CLUSTER=" kind"
21
23
create_cluster ${KIND_K8S_VERSION}
22
24
trap delete_cluster EXIT
Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ import (
28
28
func TestE2E (t * testing.T ) {
29
29
RegisterFailHandler (Fail )
30
30
fmt .Fprintf (GinkgoWriter , "Starting sample external plugin kubebuilder suite\n " )
31
- RunSpecs (t , "Kubebuilder grafana plugin e2e suite" )
31
+ RunSpecs (t , "Kubebuilder sample external plugin e2e suite" )
32
32
}
Original file line number Diff line number Diff line change 17
17
source " $( dirname " $0 " ) /../common.sh"
18
18
source " $( dirname " $0 " ) /setup.sh"
19
19
20
+ build_sample_external_plugin
21
+
20
22
export KIND_CLUSTER=" local-kubebuilder-e2e"
21
23
create_cluster ${KIND_K8S_VERSION}
22
24
if [ -z " ${SKIP_KIND_CLEANUP:- } " ]; then
Original file line number Diff line number Diff line change @@ -67,3 +67,33 @@ function test_cluster {
67
67
go test $( dirname " $0 " ) /v4 $flags -timeout 30m
68
68
go test $( dirname " $0 " ) /externalplugin $flags -timeout 30m
69
69
}
70
+
71
+ function build_sample_external_plugin {
72
+ # TODO: Dynamically set exteranl plugin destination based on OS platform
73
+ # EXTERNAL_PLUGIN_DESTINATION_PREFIX="${HOME}/Library/Application Support/kubebuilder/plugins"
74
+ # For Linux:
75
+ XDG_CONFIG_HOME=" ${HOME} /.config"
76
+ EXTERNAL_PLUGIN_DESTINATION_PREFIX=" $XDG_CONFIG_HOME /kubebuilder/plugins"
77
+
78
+ PLUGIN_NAME=" sampleexternalplugin"
79
+ PLUGIN_VERSION=" v1"
80
+ EXTERNAL_PLUGIN_DESTINATION=" ${EXTERNAL_PLUGIN_DESTINATION_PREFIX} /${PLUGIN_NAME} /${PLUGIN_VERSION} "
81
+ EXTERNAL_PLUGIN_PATH=" ${EXTERNAL_PLUGIN_DESTINATION} /${PLUGIN_NAME} "
82
+
83
+ if [ -d " $EXTERNAL_PLUGIN_DESTINATION " ]; then
84
+ echo " $EXTERNAL_PLUGIN_DESTINATION does exist."
85
+ if [ -e " $EXTERNAL_PLUGIN_PATH " ]; then
86
+ echo " clean up old binary..."
87
+ rm " $EXTERNAL_PLUGIN_PATH "
88
+ fi
89
+ else
90
+ mkdir -p " $EXTERNAL_PLUGIN_DESTINATION "
91
+ fi
92
+
93
+ REPO_ROOT_DIR=" $( git rev-parse --show-toplevel) "
94
+ SOURCE_DIR=" ${REPO_ROOT_DIR} /docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1"
95
+
96
+ cd $SOURCE_DIR && go build -o $PLUGIN_NAME && mv $PLUGIN_NAME " $EXTERNAL_PLUGIN_PATH "
97
+
98
+ cd $REPO_ROOT_DIR
99
+ }
You can’t perform that action at this time.
0 commit comments