Skip to content

Commit 0b8538d

Browse files
committed
Adding --build B, --stage, --extract E flags
1 parent 585cdaf commit 0b8538d

File tree

12 files changed

+1142
-588
lines changed

12 files changed

+1142
-588
lines changed

jenkins/e2e-image/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ ADD ["e2e-runner.sh", \
6161
"kops-e2e-runner.sh", \
6262
"kubetest", \
6363
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/get-kube.sh", \
64-
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/upload-to-gcs.sh", \
65-
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/third_party/forked/shell2junit/sh2ju.sh", \
64+
"kubetest", \
6665
"/workspace/"]
67-
RUN ["chmod", "+x", "/workspace/get-kube.sh", "/workspace/sh2ju.sh"]
66+
RUN ["chmod", "+x", "/workspace/get-kube.sh"]
6867
WORKDIR "/workspace"
6968

7069
ENTRYPOINT "/workspace/e2e-runner.sh"

jenkins/e2e-image/e2e-runner.sh

+51-391
Large diffs are not rendered by default.

jobs/config.json

-1
Original file line numberDiff line numberDiff line change
@@ -3215,5 +3215,4 @@
32153215
"--env-file=jobs/ci-kubernetes-e2e-gke-latest-upgrade-cluster.env"
32163216
]
32173217
}
3218-
32193218
}

kubetest/BUILD

+3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ go_library(
1919
srcs = [
2020
"anywhere.go",
2121
"bash.go",
22+
"build.go",
2223
"e2e.go",
24+
"extract.go",
2325
"federation.go",
2426
"kops.go",
2527
"main.go",
2628
"none.go",
29+
"stage.go",
2730
"util.go",
2831
],
2932
tags = ["automanaged"],

kubetest/build.go

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
Copyright 2017 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"fmt"
21+
"os/exec"
22+
)
23+
24+
const (
25+
buildDefault = "quick"
26+
)
27+
28+
type buildStrategy string
29+
30+
// Support both --build and --build=foo
31+
func (b *buildStrategy) IsBoolFlag() bool {
32+
return true
33+
}
34+
35+
// Return b as a string
36+
func (b *buildStrategy) String() string {
37+
return string(*b)
38+
}
39+
40+
// Set to --build=B or buildDefault if just --build
41+
func (b *buildStrategy) Set(value string) error {
42+
if value == "true" { // just --build, choose default
43+
value = buildDefault
44+
}
45+
switch value {
46+
case "bazel", "quick", "release":
47+
*b = buildStrategy(value)
48+
return nil
49+
}
50+
return fmt.Errorf("Bad build strategy: %v (use: bash, quick, release)", value)
51+
}
52+
53+
// True when this kubetest invocation wants to build a release
54+
func (b *buildStrategy) Enabled() bool {
55+
return *b != ""
56+
}
57+
58+
// Build kubernetes according to specified strategy.
59+
// This may be a bazel, quick or full release build depending on --build=B.
60+
func (b *buildStrategy) Build() error {
61+
var target string
62+
switch *b {
63+
case "bazel":
64+
target = "bazel-build"
65+
case "quick":
66+
target = "quick-release"
67+
case "release":
68+
target = "release"
69+
default:
70+
return fmt.Errorf("Unknown build strategy: %v", b)
71+
}
72+
73+
// TODO(fejta): FIX ME
74+
// The build-release script needs stdin to ask the user whether
75+
// it's OK to download the docker image.
76+
return finishRunning(exec.Command("make", target))
77+
}

0 commit comments

Comments
 (0)