Commit Graph

70 Commits

Author SHA1 Message Date
Miek Gieben
6e1c02c4ac Make presubmit actually fail the build (#2013)
The exit code wasn't properly acted upon in the makefile.
Make filename-hyphen actually return an non-zero exit code.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-29 23:41:52 -07:00
Miek Gieben
395be9adfc Makefile: remove goimports (#2008)
This downloads gometalinter (which is now breaking in the CI tests).
Also the goimports target is run with ||true, so nothing will break
if this flags anything (done because of gofmt changes in between
release).

Probably I will setup something to use github's linter API:
https://github.com/markstory/lint-review

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-27 15:01:27 +01:00
Miek Gieben
ad8021230c Makefile fixes: (#1892)
Correctly set the path for the presubmits, fix some typos and make
the goimport target do the linting to the lint target can be removed.

Also don't make it a fatal error because gofmt changes between releases.
2018-06-21 04:34:02 -07:00
Miek Gieben
d6288c25ba Bump dns version to 1.0.8 (#1873)
Bump the version, allows #691 to get merged.
2018-06-13 10:38:24 +01:00
Miek Gieben
4f0b36e57e Extend presubmit to covert test and request (#1846)
Fix the casing *and* fix use of context as we were still referencing
the non-std lib context - no wondering how this could have worked...
2018-06-01 15:12:49 +01:00
Yong Tang
67c9075331 Enforcing gofmt -s on linter check (#1820)
This fix enforces gofmt -s on linter check in Makefile,
and fixes `plugin/kubernetes/handler_test.go` and
`plugin/tls/tls_test.go` with `gofmt -s`
2018-05-21 09:52:42 -04:00
Yong Tang
a40345d65f Fix make check dependency error (#1818)
While invoking `make check` from a fresh new environment
the following failure occured:
```
[ec2-user@..... coredns]$ docker run -i -t --rm -v $PWD:/go/src/github.com/coredns/coredns -w /go/src/github.com/coredns/coredns golang:1.10
root@e2d6a6c17132:/go/src/github.com/coredns/coredns# make check
** presubmit/context
** presubmit/test-lowercase
( gometalinter --deadline=2m --disable-all --enable=goimports --vendor --exclude=^pb/ ./... || true )
/bin/sh: 1: gometalinter: not found
go generate coredns.go
```

This fix fixes the issue in Makefile so that deps could be installed first.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-05-19 23:03:32 +01:00
Miek Gieben
1e471a353e Dep ensure (#1803)
* vendor: don't vendor the context stuff

We don't need to vendor this anymore as we moved to the std lib for
these.

* new stuff showing up with dep ensure

* remove go-shlex
2018-05-16 13:17:06 -07:00
Miek Gieben
940b7f2e8c Up miekg/dns to 1.0.6 (#1792)
This was just tagged and has the worker patch that improves performance.
2018-05-10 21:13:36 +01:00
Miek Gieben
41f1a1434a Pr 1770 (#1771)
* make pb

* Makefile for pb

Move the Makefile into the pb directory to remove some clutter from the
main Makefile.
2018-05-05 12:01:17 -04:00
Miek Gieben
3ce4fc8fe4 Do ' go vet' after we have fetch the repos (#1744)
Do ' go vet' after we have fetched the repos
2018-04-26 13:03:31 +01:00
Miek Gieben
c9b5cedbe9 Presubmit (#1719)
* build: add presubmits

We didn't have a way to encode presubmit; with this hack we can just
run a bunch of script on the build; this allows us to automatically
capture things like using the wrong context and maybe other fluff.

This allows us to cut down on code reviews and just have the build fail.

* hook it up

* put presubmit in checks; so we do it for tests as well

* Add explicit exit 1 if things fails
2018-04-23 08:45:49 -07:00
Miek Gieben
cd7928f180 make: default to default go path (#1681)
if GOPATH is not set use $HOME/go which is the current default in Go.

Fixes #1642
2018-04-15 09:14:18 -07:00
Miek Gieben
f5435b3884 make: use dns 1.0.5 (#1649)
Tagged an new release; has some fixes.
2018-04-01 14:29:59 +01:00
Yong Tang
604c0045e7 Update go dep (#1560)
This fix updates go dep with `dep ensure --update` as well as the following:
- Removed github.com/ugorji/go restriction in Gopkg.toml (fixes  #1557)
- Added github.com/flynn/go-shlex in Makefile (neede by Caddy, maybe removed later)

This fix fixes #1557

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-23 20:10:34 +00:00
Yong Tang
9194b4c29d Update golang.org/x/net and golang.org/x/text (#1553)
This fix updates golang.org/x/net to release-branch.go1.10
and golang.org/x/text to v0.3.0, for the purpose of
align with go version 1.10.

This fix also updates README.md to promote using go 1.10.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-22 07:25:40 +00:00
Miek Gieben
22409290d9 Caddy 0.10.11 Fix (#1544)
Caddy 0.10.11 is released. Fix CoreDNS to compile against that version.
This also helps people compiling CoreDNS and go getting non-vendored
deps.
2018-02-21 07:15:57 +00:00
Miek Gieben
05e41c5969 go 1.10: update travis and gofmt (#1541)
* go 1.10: update travis and gofmt

fmt now complains about on file tls_test.go, fix that. Also remove
gofmt, as goimports also checks, so this was done twice.

Put go 1.9 and 1.10 in travis for the time being.

* goimports optional
2018-02-18 09:43:56 +01:00
Yong Tang
4e63d0be35 Enable goimports check, and fixes several imports format (#1525)
This fix enables goimports check and fixes several imports format
so that the import sections are prettier, e.g.:
```
 import (
-       "github.com/miekg/dns"
        "regexp"
        "strconv"
        "strings"
+
+       "github.com/miekg/dns"
 )
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-14 10:00:04 -05:00
Miek Gieben
5b844b5017 plugin/forward: add it (#1447)
* plugin/forward: add it

This moves coredns/forward into CoreDNS. Fixes as a few bugs, adds a
policy option and more tests to the plugin.

Update the documentation, test IPv6 address and add persistent tests.

* Always use random policy when spraying

* include scrub fix here as well

* use correct var name

* Code review

* go vet

* Move logging to metrcs

* Small readme updates

* Fix readme
2018-02-05 22:00:47 +00:00
Chris O'Haver
80050766fb Tolerate go get failures for coredns/forward (#1435)
* testpr3

* hack

* chop

* tolerate coredns/coredns get fail

* remove TEST from readme
2018-01-26 16:10:45 -05:00
Miek Gieben
2d00080ef5 plugin/forward: add out of tree forward plugin (#1425)
* plugin/forward: add out of tree forward plugin

This is a simpler proxy than *proxy*, include by default so it is easier
to switch (i.e. no recompile). It lacks features compared to proxy (did I
say it was simpler), but does cache udp and tcp connection, so it is
faster than proxy.

* Muck with the makefile

* Versioning forward now
2018-01-25 18:55:35 +00:00
Miek Gieben
fcfb998b86 release: default to using go-dns 1.0.4 (#1424) 2018-01-25 16:33:08 +01:00
Tobias Schmidt
b707438534 Add coredns_build_info metric (#1418)
In order to track the rollout status of CoreDNS versions, add the common
build_info metric.
2018-01-23 20:10:55 +00:00
Yong Tang
949b453472 Update Makefile for git get -u with version (#1372)
The changes in this fix have:
1. checkout master branch of dependencies (non-branch will trigger an error with go get -u)
2. go get -u
3. checkout specific versioon (not necessary a branch).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-10 20:52:02 +00:00
Yong Tang
2ead19f316 Fix version of go get (#1370)
This fix fixes version fetched from `go get` so
that versions are guarded.

github.com/mholt/caddy              v0.10.10
github.com/miekg/dns                v1.0.3
github.com/prometheus/client_golang v0.8.0
golang.org/x/net                    release-branch.go1.9 (branch)
golang.org/x/text                   e19ae1496984b1c655b8044a65c0300a3c878dd3

This fix fixes 1368.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-10 09:30:28 -08:00
Miek Gieben
8ec89aa4e9 Stop vendoring prometheus (#1333)
* Stop vendoring prometheus

* Fix make
2017-12-27 14:15:03 +00:00
Miek Gieben
64c3eb1518 Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.

This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.

Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.

Sample run and resulting artifacts:

~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped

% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 09:45:13 -04:00
Miek Gieben
4a4556f0d6 release: speed up build (#1181)
Don't use the 'check and godep' target when building for a release, this
is now repeated 6 times for no reason as this is already checked on
travis.

Some other cleanups in the documentation as well.
2017-10-30 08:55:41 -07:00
Chris O'Haver
e8184d3a5a plugin/kubernetes: Modify integration tests for coredns/ci (#1152)
* integration ci

* rename test

* unfunctionalize DoIntegrationTests

* alphabetize expected answers

* Enable out-of-cluster test

* Enable out-of-cluster test

* move integration tests back to ci repo
2017-10-25 15:40:48 -04:00
Yong Tang
102cfbd7fe Use gometalinter and enforcing go fmt/lint/vet (#1108)
* Use gometalinter and enforcing go fmt/lint/vet

Before this PR go fmt is enabled, go lint is suggest only.
From time to time we have to manually check for go lint and go vet
for any issues.

This fix uses gometalinter and enforcing go fmt/lint/vet.
Several reasons:
- gometalinter could handle multiple linters concurrently
- gometalinter supports suppression with `// nolint[: <linter>]`

Previously one reason we didn't enable go lint was due to the
```
warning: context.Context should be the first parameter of a function (golint)
```
this is now possible with gometalinter and `// nolint: golint` (See changes).

This fix also discovered several go vet issues and fixes it.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix several issues reported by gometalinter (go vet)

This commit fixes several issues reported by gometalinter (go vet).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Increase deadline

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-09-24 11:59:04 +01:00
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Yong Tang
9068f4f565 Use go test -i to install all prerequisite packages (#954)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 22:14:44 +01:00
Yong Tang
8749b870c4 Use date instead of time as time might be reserved word in sh. (#952)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 12:18:56 -07:00
Yong Tang
ee14993f7d Add time in coverage test (#951)
For profiling the time spent in Travis CI.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 20:02:43 +01:00
Miek Gieben
60c83fefac travis: remove -bench and -race from coverage (#949)
Not needed and already done in the other test (bench is not looked at
at all)
2017-08-19 17:53:31 +01:00
Miek Gieben
219a899772 travis: parallize builds (#947)
* travis: parallize builds

* trying out stuff

* order matters
2017-08-19 17:02:16 +01:00
Yong Tang
0c02708d63 Consolidation of Makefile and Makefile.release (#912)
* Consolidation of Makefile and Makefile.release

Several changes:
1. All go specific target like `go generate`, etc. has
been moved to Makefile. Now Makefile.release does not
repeat go build, etc. related rules.
2. In Makefile.release, the binary build is done through
`docker run` and with a fixed specific go version (currently 1.8.3).
This will help making sure build process could be reproduced
on any dev platform, with no dependency to the golang version
installed on the platform.
3. Platform related flags (e.g., "GOOS=darwin") are passed through
Makefile (not Makefile.release).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update to only use `make` without running inside `docker run`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-13 17:41:50 +01:00
Yong Tang
1ddafcbdff Makefile cleanup (#903)
Remove unused distclean and misc.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-11 19:47:28 -07:00
Yong Tang
a09f208c51 Add git commit to the version output. (#900)
Now the output would be:
```
 ./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db
```
In case the local file has been modified, then the output would be (with --dirty):
```
 ./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db-dirty
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-11 17:47:37 +01:00
Yong Tang
64353d8f3b Use pre_build hook in docker hub to build the coredns binary (#799)
and skip the download process.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-07-27 14:34:56 -07:00
Miek Gieben
f5fbfce876 Stop vendoring go dns and context (#794)
* Stop vendoring go dns and x/net/context

* dep ensure run

* Fix Makefile

* Fix typo

* Delete context vendor dir
2017-07-26 02:24:01 -07:00
Miek Gieben
30217a4cb2 Drop caddy from vendor (#700)
* Removed caddy

* new stuff

* Now need to go get caddy

* Duh
2017-06-03 08:27:41 +01:00
Chris O'Haver
a4eea61190 fix make lint (#694) 2017-06-02 07:25:00 +01:00
John Belamaric
afec8963c6 Don't check vendor code for gofmt, it takes forever (#661) 2017-05-05 15:33:18 -04:00
Yong Tang
e08fb277fa Add vendor setup with go dep
This fix adds vendor setup with `go dep`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-04-28 09:14:10 -07:00
John Belamaric
4985d698e2 Fix the deps build (#583)
The deps target needs to be dependent on the generated middleware code,
or you end up having to do make twice.
2017-03-13 15:55:44 +00:00
Yong Tang
1e4ba588dc Enforce go lint check and fix several lint issues (#570)
This fix updates the Makefile to add the `go lint` check
for the build. This fix also fixes several go lint issues.

NOTE: This fix does not enforce `go lint` (suggestion only).
This fix also ignores the `go lint` error:
```
middleware/middleware.go:72:1: context.Context should be the first parameter of a function
```
as it requires too many changes in API.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-03-05 14:17:05 -08:00
Miek Gieben
a3f7788686 Put docker release in Makefile.release (#562)
Make the docker release part of the normal CoreDNS release
2017-03-01 15:46:26 +00:00
Yong Tang
43c2fcc1ef Add dependency of go fmt in Makefile (#553)
This fix adds the dependency of `go fmt` in `Makefile`
so that any new check in will have to properly fmt the source code
with `gofmt -s -w`.
2017-02-22 13:28:04 -05:00