mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +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}"
|
"${release_stage}/platforms/${platform}"
|
||||||
done
|
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}
|
tar c ${KUBE_TEST_PORTABLE[@]} | tar x -C ${release_stage}
|
||||||
|
|
||||||
kube::release::clean_cruft
|
kube::release::clean_cruft
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -209,25 +210,30 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the kube/config
|
// Get the kube/config
|
||||||
|
// TODO: Can it be RepoRoot with jenkins e2e?
|
||||||
testWorkspace := os.Getenv("WORKSPACE")
|
testWorkspace := os.Getenv("WORKSPACE")
|
||||||
if testWorkspace == "" {
|
if testWorkspace == "" {
|
||||||
// Not running in jenkins, assume "HOME"
|
// Not running in jenkins, assume RepoRoot
|
||||||
testWorkspace = os.Getenv("HOME")
|
testWorkspace = testContext.RepoRoot // os.Getenv("HOME")
|
||||||
}
|
}
|
||||||
|
|
||||||
testKubectlPath := testContext.KubectlPath
|
// Build the static kubectl
|
||||||
// If no path is given then default to Jenkins e2e expected path
|
By("Building a static kubectl for upload")
|
||||||
if testKubectlPath == "" || testKubectlPath == "kubectl" {
|
kubectlContainerPath := path.Join(testWorkspace, "/examples/kubectl-container/")
|
||||||
testKubectlPath = filepath.Join(testWorkspace, "kubernetes", "platforms", "linux", "amd64", "kubectl")
|
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
|
kubeConfigFilePath := testContext.KubeConfig
|
||||||
if kubeConfigFilePath == "" {
|
_, err = os.Stat(kubeConfigFilePath)
|
||||||
// Fall back to the jenkins e2e location
|
|
||||||
kubeConfigFilePath = filepath.Join(testWorkspace, ".kube", "config")
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := os.Stat(kubeConfigFilePath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("kube config path could not be accessed. Error=%s", err)
|
Failf("kube config path could not be accessed. Error=%s", err)
|
||||||
}
|
}
|
||||||
@ -250,7 +256,6 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("unable to create streaming upload. Error: %s", err)
|
Failf("unable to create streaming upload. Error: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.Post().
|
resp, err := c.Post().
|
||||||
Prefix("proxy").
|
Prefix("proxy").
|
||||||
Namespace(ns).
|
Namespace(ns).
|
||||||
@ -270,7 +275,7 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
kubecConfigRemotePath := uploadConfigOutput.Output
|
kubecConfigRemotePath := uploadConfigOutput.Output
|
||||||
|
|
||||||
// Upload
|
// Upload
|
||||||
pipeReader, postBodyWriter, err := newStreamingUpload(testContext.KubectlPath)
|
pipeReader, postBodyWriter, err := newStreamingUpload(testStaticKubectlPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("unable to create streaming upload. Error: %s", err)
|
Failf("unable to create streaming upload. Error: %s", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user