Commit Graph

34 Commits

Author SHA1 Message Date
Abhisek Banerjee b5b447b50b Add go ldflags using LDFLAGS at the time of compilation 2020-10-23 19:03:06 +00:00
Patrick Ohly 340e082f04 build.make: optional inclusion of Windows in multiarch images
Most repos inherit the default BUILD_PLATFORMS, which includes
Windows, but don't have the necessary Dockerfile.Windows yet. To
simplify the rollout of multiarch image builds, Windows binary
building continues to be tested (i.e. BUILD_PLATFORMS remains
unchanged), but push-multiarch skips Windows if the Dockerfile.Windows
is missing.
2020-06-03 11:05:05 +02:00
Patrick Ohly 5231f05d8b build.make: properly declare push-multiarch
It's not a real file and thus should better be marked as phony.
2020-06-03 11:04:29 +02:00
Patrick Ohly 4569f27a8c build.make: fix push-multiarch ambiguity
"make push-multiarch" matched both push-multiarch and push-%.  This
seems to be none-deterministic and in at least one
repo (external-provisioner), make picked the wildcard rule which then
failed because there is no "multiarch" command.

This ambiguity gets resolved by instantiating the wildcard rules only
for existing commands. The advantage also is that "make
push-no-such-command" will fail with an obvious "No rule to make
target 'push-no-such-command'" instead of attempting to build the
command.
2020-06-03 11:03:54 +02:00
Patrick Ohly bd416901d4 cloud build: initial set of shared files
The approach taken here extends the existing support for
cross-compiling binaries on the build host and specifying the Go
compiler: Go is installed if needed (as in Prow testing), binaries are
build on the host, then one image is created for each platform, and
finally those are combined into a single multi-architecture image.
2020-05-28 10:31:35 +02:00
Patrick Ohly 3863a0f674 build for multiple platforms only in CI, add s390x
Developers should not be forced to build for all platforms by
default. We also don't want to copy-and-paste the go invocation for
each new platform.

To address both, the target platform(s) are now configurable via
BUILD_PLATFORMS and additional platforms are only enabled in the Prow
CI.

For now this serves as a test that the source actually compiles for
multiple platforms. Building images for different target platforms is a
different problem.
2020-03-04 11:39:24 +01:00
Jan Wozniak fdb32183fe Change 'make test-vet' to call 'go vet' 2020-02-13 11:21:45 +01:00
Michelle Au a4e6299668 fix syntax for ppc64le build 2019-12-04 14:12:50 -08:00
Peeyush Gupta 83a4ef15df Adding build for ppc64le 2019-11-19 08:58:58 -05:00
Patrick Ohly 23df4aef51 prow.sh: use vendor directory if available
This avoids dependencies on the Go module cache or the upstream code
hosting.
2019-11-04 15:21:49 +01:00
Patrick Ohly c8a1c4af93 better handling of Go version
Some operations are sensitive to the version of Go that is used. In
the past, formatting of source differed depending on the
version. Right now it is the content of the vendor directory which
changes when switch back and forth between 1.12 and 1.13.

We don't want to impose a certain workflow on developers, like forcing
all invocations of Go to run inside a container. If developers want
that, they can set up their development environment accordingly.

But we should warn about this aspect to raise awareness. "make"
invocations which involve Go now compare against the projects Go
version (specified in travis.yml) once at the beginning. This is only
a warning because we don't know which future version will be
compatible with the project.

Vendor directory handling gets updated, too: verification is now a
separate script (became too complex for make) and there is a
corresponding "update-vendor.sh". In contrast to verification,
updating vendor is not integrated into make and thus itself invokes
the go version check.
2019-10-31 11:59:34 +01:00
Kubernetes Prow Robot 2c81919807
Merge pull request #34 from pohly/go-mod-tidy
update Go mod support
2019-10-08 08:11:15 -07:00
Deep Debroy 2d6b3ce85f Build Windows only for amd64
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2019-10-07 16:38:04 -07:00
Patrick Ohly 194289aa8e update Go mod support
It turned out that changes like
https://github.com/kubernetes-csi/csi-lib-utils/pull/33 should better
have been committed after `go mod tidy` because that adds some
indirect dependencies in that example.

The revised `test-vendor` checks for that and (just in case that this
ever becomes desired) allows projects to not have a vendor directory
when using `go mod`.

How to use `go mod` properly gets documented in the README.md, because
there are such pitfalls.
2019-10-04 14:27:41 +02:00
Michelle Au ea2f1b5277 build windows binaries with .exe suffix 2019-09-06 19:15:35 -07:00
Deep Debroy 9fba09b414 Add rule for building Windows binaries
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2019-08-28 06:24:26 -07:00
Patrick Ohly 066143d146 build.make: allow repos to use 'go mod' for vendoring
How a repo does vendoring is detected based on the presence of
Gopkg.toml.

The vendor check with `dep` was all done locally, but the
corresponding check for `go mod` requires network access. The check
therefore gets skipped when running in the Prow CI in situations where
we are sure that it isn't needed (for example, in a periodic job).
2019-05-11 17:07:14 +02:00
Pengzhi Sun ff9bce4a71 Replace 'return' to 'exit' to fix shellcheck error 2019-04-11 17:42:44 +08:00
Patrick Ohly 9b0d9cd743 build.make: skip shellcheck if Docker is not available
Not all environments have Docker. The simplifying assumption here is
that if the Docker command is available, it's also usable.
2019-04-09 10:48:37 +02:00
Kubernetes Prow Robot 2069a0af3b
Merge pull request #11 from pohly/verify-shellcheck
verify shellcheck
2019-04-02 08:59:18 -07:00
Patrick Ohly 6c7ba1be0f build.make: integrate shellcheck into "make test"
By default this only tests the scripts inside the "release-tools"
directory, which is useful when making experimental changes to them in
a component that uses csi-release-tools. But a component can also
enable checking for other directories.
2019-04-02 09:01:09 +02:00
Kubernetes Prow Robot 3b6af7b1cc
Merge pull request #12 from pohly/local-e2e-suite
build.make: avoid unit-testing E2E test suite
2019-03-29 11:46:11 -07:00
Patrick Ohly 104a1ac969 build.make: avoid unit-testing E2E test suite
In repos that have a test/e2e, that test suite should be run
separately because it depends on a running cluster.
2019-03-28 08:40:10 +01:00
Patrick Ohly e6db50df7e check vendor directory
This runs "dep check" to verify that the vendor directory is
up-to-date and meets expectations (= done with dep >= 0.5.0).
2019-03-27 17:47:51 +01:00
Patrick Ohly 94fc1e31d8 build.make: avoid unit-testing E2E test suite
In repos that have a test/e2e, that test suite should be run
separately because it depends on a running cluster.
2019-03-15 11:08:53 +01:00
Kubernetes Prow Robot 33d58fdc29
Merge pull request #5 from pohly/test-enhancements
test enhancements
2019-01-25 09:40:59 -08:00
Patrick Ohly b0336b553c build.make: more readable "make test" output
The introduction for each individual test looked like an actual
command:

  test-subtree
  ./release-tools/verify-subtree.sh release-tools
  Directory 'release-tools' contains non-upstream changes:
  ...

It's better to make it look like a shell comment and increase its
visibility with a longer prefix:

  ### test-subtree:
  ./release-tools/verify-subtree.sh release-tools
  ...
2019-01-25 11:53:36 +01:00
Patrick Ohly 09436b9f90 build.make: fix pushing of "canary" image from master branch
After merging into external-attacher, the next Travis CI run did not
push the "canary" image because the check for "canary" only covered
the case where "-canary" is used as
suffix (https://travis-ci.org/kubernetes-csi/external-attacher/builds/484095261).
2019-01-25 11:48:59 +01:00
Patrick Ohly 147892c954 build.make: support suppressing checks
Individual repos may have to filter out certain packages from
testing. For example, in csi-test the cmd/csi-sanity directory
contains a special test that depends on additional parameters that set
the CSI driver to test against.
2019-01-24 16:43:24 +01:00
Patrick Ohly 154e33d434 build.make: clarify usage of "make V=1"
This may or may not work, depending on which packages have tests and
whether they contain glog.
2019-01-24 16:42:23 +01:00
Patrick Ohly f28c6b60aa test: verify that 'release-tools' subtree is clean
We don't want to allow local modifications in the subtree. Everything
should go to the csi-release-tools repo first.
2019-01-23 14:52:09 +01:00
Patrick Ohly 9132a016e9 test: split up into individual targets, run all
"make test" used to abort after the first test failure. That was
partly intentional: if the simple tests already fail (for example,
because of a syntax error), then there is no point in continuing to
test.

However, it also makes it harder to find all errors in a CI system
when the errors are unrelated (first error shows up, gets fixed, next
error shows up, etc.).

Now "make test" still aborts early, but "make -k test" is used in the
CI and will run all individual tests because they are split up into
different targets.
2019-01-23 14:49:07 +01:00
Patrick Ohly a1136470c2 build.make: initial content
The repo was created with an HTML version of the build.make file from
https://github.com/pohly/csi-build-rules/. Here's the raw file.
2019-01-21 10:11:51 +01:00
Aaron Crickenberger b41cac350d Add files from github.com/pohly/csi-build-rules 2019-01-16 10:51:52 -08:00