Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
89872777
Commit
89872777
authored
Nov 02, 2015
by
Joe Beda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make e2e/kubectl.go look more places for kubectl binary.
parent
32eafc3c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
kubectl.go
test/e2e/kubectl.go
+33
-3
No files found.
test/e2e/kubectl.go
View file @
89872777
...
@@ -211,10 +211,9 @@ var _ = Describe("Kubectl client", func() {
...
@@ -211,10 +211,9 @@ var _ = Describe("Kubectl client", func() {
// Build the static kubectl
// Build the static kubectl
By
(
"Finding a static kubectl for upload"
)
By
(
"Finding a static kubectl for upload"
)
testStaticKubectlPath
:=
path
.
Join
(
testContext
.
RepoRoot
,
"platforms/linux/386/kubectl"
)
testStaticKubectlPath
,
err
:=
findBinary
(
"kubectl"
,
"linux/386"
)
_
,
err
=
os
.
Stat
(
testStaticKubectlPath
)
if
err
!=
nil
{
if
err
!=
nil
{
Logf
(
"No kubectl
in %s. Attempting a local build..."
,
testStaticKubectlPath
)
Logf
(
"No kubectl
found: %v.
\n
Attempting a local build..."
,
err
)
// Fall back to trying to build a local static kubectl
// Fall back to trying to build a local static kubectl
kubectlContainerPath
:=
path
.
Join
(
testContext
.
RepoRoot
,
"/examples/kubectl-container/"
)
kubectlContainerPath
:=
path
.
Join
(
testContext
.
RepoRoot
,
"/examples/kubectl-container/"
)
if
_
,
err
:=
os
.
Stat
(
path
.
Join
(
testContext
.
RepoRoot
,
"hack/build-go.sh"
));
err
!=
nil
{
if
_
,
err
:=
os
.
Stat
(
path
.
Join
(
testContext
.
RepoRoot
,
"hack/build-go.sh"
));
err
!=
nil
{
...
@@ -1201,3 +1200,34 @@ func streamingUpload(file *os.File, fileName string, postBodyWriter *multipart.W
...
@@ -1201,3 +1200,34 @@ func streamingUpload(file *os.File, fileName string, postBodyWriter *multipart.W
Failf
(
"Unable to close the writer for file upload. Error: %s"
,
err
)
Failf
(
"Unable to close the writer for file upload. Error: %s"
,
err
)
}
}
}
}
var
binPrefixes
=
[]
string
{
"_output/dockerized/bin"
,
"_output/local/bin"
,
"platforms"
,
}
// findBinary searches through likely paths to find the specified binary. It
// takes the one that has been built most recently. Platform should be
// specified as '<os>/<arch>'. For example: 'linux/amd64'.
func
findBinary
(
binName
string
,
platform
string
)
(
string
,
error
)
{
var
binTime
time
.
Time
var
binPath
string
for
_
,
pre
:=
range
binPrefixes
{
tryPath
:=
path
.
Join
(
testContext
.
RepoRoot
,
pre
,
platform
,
binName
)
fi
,
err
:=
os
.
Stat
(
tryPath
)
if
err
!=
nil
{
continue
}
if
fi
.
ModTime
()
.
After
(
binTime
)
{
binPath
=
tryPath
binTime
=
fi
.
ModTime
()
}
}
if
len
(
binPath
)
>
0
{
return
binPath
,
nil
}
return
binPath
,
fmt
.
Errorf
(
"Could not find %v for %v"
,
binName
,
platform
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment