mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
build: test/images in test tar and a static kubectl
* release tar now includes test/images/* * kubectl is now built as a static binary in the test
This commit is contained in:
parent
e5d64ea19b
commit
57fc4bfa56
@ -785,6 +785,9 @@ function kube::release::package_test_tarball() {
|
||||
"${release_stage}/platforms/${platform}"
|
||||
done
|
||||
|
||||
# Add the test image files
|
||||
mkdir -p "${release_stage}/test/images"
|
||||
cp -fR "${KUBE_ROOT}/test/images" "${release_stage}/test/"
|
||||
tar c ${KUBE_TEST_PORTABLE[@]} | tar x -C ${release_stage}
|
||||
|
||||
kube::release::clean_cruft
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@ -209,25 +210,30 @@ var _ = Describe("Kubectl client", func() {
|
||||
}
|
||||
|
||||
// Get the kube/config
|
||||
// TODO: Can it be RepoRoot with jenkins e2e?
|
||||
testWorkspace := os.Getenv("WORKSPACE")
|
||||
if testWorkspace == "" {
|
||||
// Not running in jenkins, assume "HOME"
|
||||
testWorkspace = os.Getenv("HOME")
|
||||
// Not running in jenkins, assume RepoRoot
|
||||
testWorkspace = testContext.RepoRoot // os.Getenv("HOME")
|
||||
}
|
||||
|
||||
testKubectlPath := testContext.KubectlPath
|
||||
// If no path is given then default to Jenkins e2e expected path
|
||||
if testKubectlPath == "" || testKubectlPath == "kubectl" {
|
||||
testKubectlPath = filepath.Join(testWorkspace, "kubernetes", "platforms", "linux", "amd64", "kubectl")
|
||||
// Build the static kubectl
|
||||
By("Building a static kubectl for upload")
|
||||
kubectlContainerPath := path.Join(testWorkspace, "/examples/kubectl-container/")
|
||||
staticKubectlBuild := exec.Command("make", "-C", kubectlContainerPath)
|
||||
if out, err := staticKubectlBuild.Output(); err != nil {
|
||||
Failf("Unable to create static kubectl. Error=%s, Output=%s", err, out)
|
||||
}
|
||||
// Get the kubeconfig path
|
||||
// Verify the static kubectl path
|
||||
testStaticKubectlPath := path.Join(kubectlContainerPath, "kubectl")
|
||||
_, err := os.Stat(testStaticKubectlPath)
|
||||
if err != nil {
|
||||
Failf("static kubectl path could not be accessed. Error=%s", err)
|
||||
}
|
||||
|
||||
// Verify the kubeconfig path
|
||||
kubeConfigFilePath := testContext.KubeConfig
|
||||
if kubeConfigFilePath == "" {
|
||||
// Fall back to the jenkins e2e location
|
||||
kubeConfigFilePath = filepath.Join(testWorkspace, ".kube", "config")
|
||||
}
|
||||
|
||||
_, err := os.Stat(kubeConfigFilePath)
|
||||
_, err = os.Stat(kubeConfigFilePath)
|
||||
if err != nil {
|
||||
Failf("kube config path could not be accessed. Error=%s", err)
|
||||
}
|
||||
@ -250,7 +256,6 @@ var _ = Describe("Kubectl client", func() {
|
||||
if err != nil {
|
||||
Failf("unable to create streaming upload. Error: %s", err)
|
||||
}
|
||||
|
||||
resp, err := c.Post().
|
||||
Prefix("proxy").
|
||||
Namespace(ns).
|
||||
@ -270,7 +275,7 @@ var _ = Describe("Kubectl client", func() {
|
||||
kubecConfigRemotePath := uploadConfigOutput.Output
|
||||
|
||||
// Upload
|
||||
pipeReader, postBodyWriter, err := newStreamingUpload(testContext.KubectlPath)
|
||||
pipeReader, postBodyWriter, err := newStreamingUpload(testStaticKubectlPath)
|
||||
if err != nil {
|
||||
Failf("unable to create streaming upload. Error: %s", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user