Skip to content

Commit

Permalink
Adding --build B, --stage, --extract E flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fejta committed Feb 24, 2017
1 parent 585cdaf commit 0b8538d
Show file tree
Hide file tree
Showing 12 changed files with 1,142 additions and 588 deletions.
5 changes: 2 additions & 3 deletions jenkins/e2e-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ ADD ["e2e-runner.sh", \
"kops-e2e-runner.sh", \
"kubetest", \
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/get-kube.sh", \
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/upload-to-gcs.sh", \
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/third_party/forked/shell2junit/sh2ju.sh", \
"kubetest", \
"/workspace/"]
RUN ["chmod", "+x", "/workspace/get-kube.sh", "/workspace/sh2ju.sh"]
RUN ["chmod", "+x", "/workspace/get-kube.sh"]
WORKDIR "/workspace"

ENTRYPOINT "/workspace/e2e-runner.sh"
442 changes: 51 additions & 391 deletions jenkins/e2e-image/e2e-runner.sh

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion jobs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3215,5 +3215,4 @@
"--env-file=jobs/ci-kubernetes-e2e-gke-latest-upgrade-cluster.env"
]
}

}
3 changes: 3 additions & 0 deletions kubetest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ go_library(
srcs = [
"anywhere.go",
"bash.go",
"build.go",
"e2e.go",
"extract.go",
"federation.go",
"kops.go",
"main.go",
"none.go",
"stage.go",
"util.go",
],
tags = ["automanaged"],
Expand Down
77 changes: 77 additions & 0 deletions kubetest/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"fmt"
"os/exec"
)

const (
buildDefault = "quick"
)

type buildStrategy string

// Support both --build and --build=foo
func (b *buildStrategy) IsBoolFlag() bool {
return true
}

// Return b as a string
func (b *buildStrategy) String() string {
return string(*b)
}

// Set to --build=B or buildDefault if just --build
func (b *buildStrategy) Set(value string) error {
if value == "true" { // just --build, choose default
value = buildDefault
}
switch value {
case "bazel", "quick", "release":
*b = buildStrategy(value)
return nil
}
return fmt.Errorf("Bad build strategy: %v (use: bash, quick, release)", value)
}

// True when this kubetest invocation wants to build a release
func (b *buildStrategy) Enabled() bool {
return *b != ""
}

// Build kubernetes according to specified strategy.
// This may be a bazel, quick or full release build depending on --build=B.
func (b *buildStrategy) Build() error {
var target string
switch *b {
case "bazel":
target = "bazel-build"
case "quick":
target = "quick-release"
case "release":
target = "release"
default:
return fmt.Errorf("Unknown build strategy: %v", b)
}

// TODO(fejta): FIX ME
// The build-release script needs stdin to ask the user whether
// it's OK to download the docker image.
return finishRunning(exec.Command("make", target))
}
Loading

0 comments on commit 0b8538d

Please sign in to comment.