Commit Graph

278 Commits

Author SHA1 Message Date
Davanum Srinivas
dfd8e4e467
Enable selinux tags in make targets
In 24d105995d, a fix was made in bazel
based builds to ensure that we add `selinux` tag when we build all
binaries especially the `kubelet`. We need to do the same for in our
hack scripts so things like `make release` will work properly as well.

Some scripts use `GOFLAGS=-tags=providerless` for example, So we should
support the tags to be specified in GOFLAGS as well. We parse out the
tags from there and ensure selinux is added to the list of tags we used
for building the binaries. Note that we add our own `-tags` with the
full set of tags and since we specify our parameter at the end, ours
full list takes precendence
2020-01-31 15:48:44 -05:00
Kubernetes Prow Robot
7a1eaa112e
Merge pull request #84696 from dims/BenTheElder-byebyehacke2e
Remove hack/e2e.go
2019-11-07 09:05:04 -08:00
Jordan Liggitt
e3ff39ffa0 Update build to go1.13.4 2019-11-06 17:39:05 -05:00
Benjamin Elder
83c56a0373
remove hack/e2e.go 2019-11-03 19:36:59 -05:00
Odin Ugedal
cce1f32ea5
Fix shellcheck failures SC2034 2019-10-23 22:47:46 +02:00
Jonathan Tomer
d34f49b913 Up minimum go version to 1.12.4
https://github.com/kubernetes/kubernetes/pull/77222 removed a workaround for a
Go standard library bug (https://github.com/golang/go/issues/31125) that was
not fixed until that version, so we need to require it.
2019-10-07 15:55:33 -07:00
Davanum Srinivas
138571b23f
Remove hyperkube from release artifacts
Change-Id: Ie09248d6fc688ffffbeb0271824817a5129346a0
2019-10-03 13:33:17 -04:00
Davanum Srinivas
adbd1800c8 Drop cloud-controller-manager artifacts from k/k release 2019-08-06 13:51:27 -04:00
Davanum Srinivas
543093e775
Add go-runner to the list of e2e test targets
Change-Id: I9c837d8f0a74014434308b46291ad1f81d67109a
2019-07-04 13:34:44 -04:00
John Schnake
b3f5a086ab Adds an optional golang runner to the conformance test image
Adds a go app which runs the e2e tests with ginkgo.

 - Supports all the existing env vars of the bash script
 - Improved flow control to avoid and better report issues
regarding the process PID
 - Adds flags for modifying where to find the test binary and
ginkgo binary so that you can run it locally
 - Adds 3 flags for specifying extra args before the double-dash,
extra args after the double-dash, and the seperator to use between
values in those env vars. This allows setting arbitrary, complex
values for use on the command such as flags which include spaces
or other characters.
2019-07-01 16:26:13 -05:00
hui luo
6c8aabc832 Check KUBE_SERVER_PLATFORMS existence
when compile kubectl on platform other than
linux/amd64, we need to check the KUBE_SERVER_PLATFORMS
array emptiness before assign it.

the example command is:
make WHAT=cmd/kubectl KUBE_BUILD_PLATFORMS="darwin/amd64 windows/amd64"
2019-05-18 09:17:22 -07:00
Christoph Blecker
b8481b62fc
Don't use declare -g in build 2019-05-17 12:22:42 -07:00
adisky
7e2aa46f64
fix unbound variable release.sh 2019-05-16 23:09:19 +05:30
adisky
38b7f2125f
fix unbound array variable 2019-05-15 13:47:48 +05:30
Christoph Blecker
eaafa5952f
Don't use mapfile as it isn't bash 3 compatible 2019-05-06 15:55:12 -07:00
Michael Taufen
dcee810a3f Restrict builds to officially supported platforms
Prior to this change, including windows/amd64 in KUBE_BUILD_PLATFORMS
would, for example, attempt to build the server binaries/tars/images for
Windows, which is not supported. This can break downstream build steps.
2019-04-25 14:05:44 -07:00
Christoph Blecker
4543e68ae5
Fix shellcheck in hack/lib/golang.sh 2019-04-18 18:53:13 -07:00
Davanum Srinivas
7e01702a88
Move "-s -w" flags to GOLDFLAGS as an overridable default.
If GOLDFLAGS is set, whether it is empty or not, we should honor it.
Only if the GOLDFLAGS is totally not set, then we use "-s -w"

See Parameter Expansion section in the urls below:

https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash/16753536
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

Change-Id: I826c34efc63c77f0e3e9677fff30a3eb2219a377
2019-04-17 21:55:13 -04:00
Jordan Liggitt
2ea3cbdcbc Update hack scripts to use go mod 2019-04-03 10:19:39 -04:00
Kubernetes Prow Robot
f6c51d6e99
Merge pull request #75751 from BenTheElder/bash-fun
fix kube::golang::is_instrumented_package
2019-03-26 23:19:01 -07:00
Benjamin Elder
0833a9cc38 fix kube::golang::is_instrumented_package 2019-03-26 17:17:16 -07:00
Ed Bartosh
3d5d38607d fix 'make generated_files' build on MacOS
Recent change to hack/lib/golang.sh broke the build on MacOS this way:

$ make clean && make generated_files
+++ [0325 13:38:22] Verifying Prerequisites....
+++ [0325 13:38:23] Removing _output directory
k8s.io/kubernetes/vendor/github.com/spf13/pflag
k8s.io/kubernetes/hack/make-rules/helpers/go2make
+++ [0325 13:38:40] Building go targets for darwin/amd64:
    ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
can't load package: package k8s.io/kubernetes: no Go files in k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes
!!! [0325 13:38:40] Call tree:
!!! [0325 13:38:40]  1: k8s.io/kubernetes/hack/lib/golang.sh:629 kube::golang::build_some_binaries(...)
!!! [0325 13:38:40]  2: k8s.io/kubernetes/hack/lib/golang.sh:764 kube::golang::build_binaries_for_platform(...)
!!! [0325 13:38:40]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make[1]: *** [_output/bin/deepcopy-gen] Error 1
make: *** [generated_files] Error 2

It was caused by 'binaries' array not being declared with 'local -a'.
It looks like MacOS' old bash version makes an array to contain first
empty element if declared this way.

The fix has been tested on MacOS High Sierra and Linux openSUSE 42.3 (x86_64)

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2019-03-25 17:08:13 +01:00
toyoda
a52af3a9d5 fix shellcheck failure golang.sh 2019-03-22 13:29:26 +09:00
Han Kang
a5ddc3943a bump required minimum go version to 1.12.1 (strings package compatibility) 2019-03-20 16:07:07 -07:00
Roy Lenferink
b18bc2ea79 Improved some more bash script variable definitions 2019-01-21 23:11:58 +01:00
Roy Lenferink
a5d0616bdc Improving syntax for bash scripts 2019-01-18 19:17:16 +01:00
Kubernetes Prow Robot
152226c557
Merge pull request #71198 from cofyc/go1.11-GOFLAGS-env
No need to pass GOFLAGS to $goflags variables with go 1.11
2019-01-09 23:35:09 -08:00
Jeff Grafton
e3fac7690b Make Bazel not follow the infinite symlink in _output/local/go
Otherwise, calling make followed by bazel might fail, requiring one to
run make clean first.

Additionally, add comments explaining why we must do this.
2018-11-29 10:47:36 -08:00
Yecheng Fu
ce22322ef1 No need to pass GOFLAGS to $goflags variables.
In go 1.11, go commands will use `GOFLAGS` as default flags, see
https://golang.org/doc/go1.11#go_command.

There is no need to pass GOFLAGS to $goflags, and if we do, go commands
will fail with "duplicate flags" error, e.g.

```
$ make test-integration WHAT=./test/integration/scheduler GOFLAGS="-v"
...
go test: v flag may be set only once
run "go help test" or "go help testflag" for more information
...
```
2018-11-27 09:53:02 +08:00
Katharine Berry
9ec5b7ffde Include vendor/k8s.io in coverage. 2018-10-17 17:15:27 -07:00
Davanum Srinivas
6830bad2a6
upstream heptio/kube-conformance
Pick up some code from https://github.com/heptio/kube-conformance
Fix up build scripts for the new conformance image
Fix Header template and Copyright to make verify job go green
update README and add execute permissions for script

Change-Id: Ib6509acd816cc2fb3a516bfb8e0ff9e32bff8f79
2018-10-12 15:33:15 -04:00
Christoph Blecker
962fdbcbca
Bump golang version to 1.11.1 2018-10-05 12:58:56 -07:00
Davanum Srinivas
a89242b7fd
Remove extra debugging log::status call
Introduced by mistake in:
d9cfd77149

Change-Id: I71ddf7131c47e74dddfa1f8ccc69cc980eeefb94
2018-09-27 17:36:44 -04:00
Davanum Srinivas
d9cfd77149
Ensure reproducible builds - support for SOURCE_DATE_EPOCH with dockerized builds
- Pass in SOURCE_DATE_EPOCH when we run the docker container
- Looks like cleaning up symbol table also helps
- Also trimming the path

Tips from
- https://blog.filippo.io/reproducing-go-binaries-byte-by-byte/
- https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/

Change-Id: Iedba85d9c1a36790fb8814795f7c27c1371cff1b
2018-09-26 07:28:09 -04:00
Katharine Berry
449e94b295 Use KUBE_BUILD_WITH_COVERAGE directly. 2018-09-07 08:48:16 -07:00
Kubernetes Submit Queue
68d22a878d
Merge pull request #67971 from Katharine/coverage-instrumentation
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Add ability to build with runtime coverage instrumentation

**What this PR does / why we need it**:

This PR adds the ability to instrument a subset of kubernetes binaries to report code coverage information. The specific use-case is to help determine coverage of our end-to-end Conformance tests, as well as provide data that can be used to help determine where to focus. This PR focuses on making it possible to build with instrumentation; collecting and using the generated coverage data will be done in later PRs. For more details as to the intent, see the [design doc](https://docs.google.com/document/d/1FKMBFxz7vtA-6ZgUkA47F8m6yR00fwqLcXMVJqsHt0g/edit?usp=sharing) (google doc; requires kubernetes-dev membership).

Specifically, this PR adds a new `KUBE_BUILD_WITH_COVERAGE` make variable, which when set will cause `kube-apiserver`, `kube-controller-manager`, `kube-scheduler`, `kube-proxy` and `kubelet` to be built with coverage instrumentation. These coverage-instrumented binaries will flush coverage information to disk every five seconds, defaulting to a temporary directory unless the `KUBE_COVERAGE_FILE` environment variable is set at launch, in which case it will write to that file instead.

The mechanism used to achieve coverage instrumentation is to build the targeted binaries as "unit tests" with coverage enabled, and then rigging the unit tests to just execute the binary's usual entry point. This is implemented only for the bash build system.

/sig testing

```release-note
NONE
```
2018-09-01 01:32:52 -07:00
Katharine Berry
9b790dab7d Address shell-related comments. 2018-08-31 17:07:25 -07:00
Katharine Berry
facce197b1 Update stale comment. 2018-08-31 16:04:48 -07:00
Benjamin Elder
037fabd842 add make targets for building server images 2018-08-31 14:31:21 -07:00
Katharine Berry
0fb4b920b5 Address review comments. 2018-08-31 10:49:36 -07:00
Katharine Berry
9d499cd005 Be sure we delete the dummy tests. 2018-08-30 18:32:22 -07:00
Katharine Berry
8fe6467013 Improve bash formatting. 2018-08-30 16:18:15 -07:00
Katharine Berry
da4bbd421c Add runtime coverage support. 2018-08-29 14:48:24 -07:00
Katharine Berry
aa2a7d001a Build relevant binaries with coverage. 2018-08-29 14:48:24 -07:00
Davanum Srinivas
a66e1f089e
Drop kube-aggregator container image from release
First version of this was only standalone, now the code is being
vendored by anyone who wants to use it. So the standalone binary and
container are no longer useful.

Change-Id: Ib9369de66b4ecb3451f73ba2a252526d6615b96f
2018-08-08 15:57:52 -04:00
Jeff Grafton
e4ded2b3ec Explictly enable cgo when building kubectl for darwin from darwin 2018-05-23 12:32:01 -07:00
Jeff Grafton
dca376a03e Add KUBE_CGO_OVERRIDES env var to force enabling CGO 2018-05-23 12:31:57 -07:00
Mark Janssen
ac731ed2e5 Update to go1.10.2 2018-05-04 00:39:21 +02:00
Kubernetes Submit Queue
b5f61ac129
Merge pull request #62657 from matthyx/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Update all script shebangs to use /usr/bin/env interpreter instead of /bin/interpreter

This is required to support systems where bash doesn't reside in /bin (such as NixOS, or the *BSD family) and allow users to specify a different interpreter version through $PATH manipulation.
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
```release-note
Use /usr/bin/env in all script shebangs to increase portability.
```
2018-05-02 19:44:32 -07:00
Kubernetes Submit Queue
42415e3186
Merge pull request #63046 from cblecker/go-go-minimum
Automatic merge from submit-queue (batch tested with PRs 63046, 62925, 63014). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Bump minimum required go version to 1.10.1

**What this PR does / why we need it**:
We have supported go1.10.x for a few weeks now (#60597). CI has all been updated. This enforces it as the new minimum go version required go k8s >=1.11

**Release note**:
No release note, as #60597 already had one.
```release-note
NONE
```
2018-04-24 00:42:09 -07:00