Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
c2680cc9
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c2680cc9
编写于
8月 31, 2020
作者:
P
Priya Wadhwa
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/kubernetes/minikube
into unit-test
上级
640f7254
b0cb9556
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
27 deletion
+34
-27
Makefile
Makefile
+1
-1
pkg/minikube/perf/binary.go
pkg/minikube/perf/binary.go
+33
-26
未找到文件。
Makefile
浏览文件 @
c2680cc9
...
...
@@ -60,7 +60,7 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download
KERNEL_VERSION
?=
4.19.107
# latest from https://github.com/golangci/golangci-lint/releases
GOLINT_VERSION
?=
v1.
29
.0
GOLINT_VERSION
?=
v1.
30
.0
# Limit number of default jobs, to avoid the CI builds running out of memory
GOLINT_JOBS
?=
4
# see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
...
...
pkg/minikube/perf/binary.go
浏览文件 @
c2680cc9
...
...
@@ -17,15 +17,17 @@ limitations under the License.
package
perf
import
(
"context"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"cloud.google.com/go/storage"
"github.com/pkg/errors"
"google.golang.org/api/option"
"k8s.io/minikube/pkg/minikube/constants"
)
...
...
@@ -37,6 +39,7 @@ type Binary struct {
const
(
prPrefix
=
"pr://"
bucket
=
"minikube-builds"
)
// NewBinary returns a new binary type
...
...
@@ -58,6 +61,33 @@ func (b *Binary) Name() string {
return
filepath
.
Base
(
b
.
path
)
}
func
(
b
*
Binary
)
download
()
error
{
ctx
:=
context
.
Background
()
client
,
err
:=
storage
.
NewClient
(
ctx
,
option
.
WithoutAuthentication
())
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"getting storage client"
)
}
defer
client
.
Close
()
rc
,
err
:=
client
.
Bucket
(
bucket
)
.
Object
(
fmt
.
Sprintf
(
"%d/minikube-linux-amd64"
,
b
.
pr
))
.
NewReader
(
ctx
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"getting minikube object from gcs bucket"
)
}
defer
rc
.
Close
()
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
b
.
path
),
0777
);
err
!=
nil
{
return
err
}
f
,
err
:=
os
.
OpenFile
(
b
.
path
,
os
.
O_CREATE
|
os
.
O_RDWR
,
0777
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
_
,
err
=
io
.
Copy
(
f
,
rc
)
return
err
}
// newBinaryFromPR downloads the minikube binary built for the pr by Jenkins from GCS
func
newBinaryFromPR
(
pr
string
)
(
*
Binary
,
error
)
{
pr
=
strings
.
TrimPrefix
(
pr
,
prPrefix
)
...
...
@@ -71,11 +101,9 @@ func newBinaryFromPR(pr string) (*Binary, error) {
path
:
localMinikubePath
(
i
),
pr
:
i
,
}
if
err
:=
downloadBinary
(
remoteMinikubeURL
(
i
),
b
.
path
);
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"downloading minikube"
)
if
err
:=
b
.
download
();
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"downloading binary"
)
}
return
b
,
nil
}
...
...
@@ -86,24 +114,3 @@ func remoteMinikubeURL(pr int) string {
func
localMinikubePath
(
pr
int
)
string
{
return
fmt
.
Sprintf
(
"%s/minikube-binaries/%d/minikube"
,
constants
.
DefaultMinipath
,
pr
)
}
func
downloadBinary
(
url
,
path
string
)
error
{
resp
,
err
:=
http
.
Get
(
url
)
if
err
!=
nil
{
return
err
}
defer
resp
.
Body
.
Close
()
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
path
),
0777
);
err
!=
nil
{
return
err
}
f
,
err
:=
os
.
OpenFile
(
path
,
os
.
O_CREATE
|
os
.
O_RDWR
,
0777
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
_
,
err
=
io
.
Copy
(
f
,
resp
.
Body
)
return
err
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录