diff options
author | Ben Kochie <superq@gmail.com> | 2018-09-25 16:02:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 16:02:42 +0200 |
commit | c7dfb82dac2d599d9eb3012b55a067a89f37f5c7 (patch) | |
tree | 80b758bc183c0192da24c8a04e0692a4b8b82aa1 | |
parent | 0fdc089187c3d5d9fe62e528653986ee6e71325b (diff) | |
download | prometheus_node_collector-c7dfb82dac2d599d9eb3012b55a067a89f37f5c7.tar.bz2 prometheus_node_collector-c7dfb82dac2d599d9eb3012b55a067a89f37f5c7.tar.xz prometheus_node_collector-c7dfb82dac2d599d9eb3012b55a067a89f37f5c7.zip |
Update build (#1081)
* Update build
* Only use CGO when building non-Linux.
* Update build to Go 1.11
* Use tab indenting consistently.
Signed-off-by: Ben Kochie <superq@gmail.com>
-rw-r--r-- | .circleci/config.yml | 11 | ||||
-rw-r--r-- | .promu-cgo.yml | 24 | ||||
-rw-r--r-- | .promu-no-cgo.yml (renamed from .promu.yml) | 6 | ||||
-rw-r--r-- | Makefile | 31 |
4 files changed, 54 insertions, 18 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 9abe4c2..b56e7f5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml | |||
@@ -4,7 +4,7 @@ version: 2 | |||
4 | jobs: | 4 | jobs: |
5 | test: | 5 | test: |
6 | docker: | 6 | docker: |
7 | - image: circleci/golang:1.10 | 7 | - image: circleci/golang:1.11 |
8 | working_directory: /go/src/github.com/prometheus/node_exporter | 8 | working_directory: /go/src/github.com/prometheus/node_exporter |
9 | 9 | ||
10 | steps: | 10 | steps: |
@@ -27,13 +27,14 @@ jobs: | |||
27 | working_directory: /home/circleci/.go_workspace/src/github.com/prometheus/node_exporter | 27 | working_directory: /home/circleci/.go_workspace/src/github.com/prometheus/node_exporter |
28 | 28 | ||
29 | environment: | 29 | environment: |
30 | DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.10-base | 30 | DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.11-base |
31 | REPO_PATH: github.com/prometheus/node_exporter | 31 | REPO_PATH: github.com/prometheus/node_exporter |
32 | 32 | ||
33 | steps: | 33 | steps: |
34 | - checkout | 34 | - checkout |
35 | - run: make promu | 35 | - run: make promu |
36 | - run: promu crossbuild -v --go 1.10 | 36 | - run: promu --config .promu-no-cgo.yml crossbuild -v --go 1.11 |
37 | - run: promu --config .promu-cgo.yml crossbuild -v --go 1.11 | ||
37 | - persist_to_workspace: | 38 | - persist_to_workspace: |
38 | root: . | 39 | root: . |
39 | paths: | 40 | paths: |
@@ -58,7 +59,7 @@ jobs: | |||
58 | 59 | ||
59 | docker_hub_master: | 60 | docker_hub_master: |
60 | docker: | 61 | docker: |
61 | - image: circleci/golang:1.10 | 62 | - image: circleci/golang:1.11 |
62 | working_directory: /go/src/github.com/prometheus/node_exporter | 63 | working_directory: /go/src/github.com/prometheus/node_exporter |
63 | 64 | ||
64 | steps: | 65 | steps: |
@@ -77,7 +78,7 @@ jobs: | |||
77 | 78 | ||
78 | docker_hub_release_tags: | 79 | docker_hub_release_tags: |
79 | docker: | 80 | docker: |
80 | - image: circleci/golang:1.10 | 81 | - image: circleci/golang:1.11 |
81 | working_directory: /go/src/github.com/prometheus/node_exporter | 82 | working_directory: /go/src/github.com/prometheus/node_exporter |
82 | 83 | ||
83 | steps: | 84 | steps: |
diff --git a/.promu-cgo.yml b/.promu-cgo.yml new file mode 100644 index 0000000..adb6d19 --- /dev/null +++ b/.promu-cgo.yml | |||
@@ -0,0 +1,24 @@ | |||
1 | go: | ||
2 | cgo: true | ||
3 | repository: | ||
4 | path: github.com/prometheus/node_exporter | ||
5 | build: | ||
6 | binaries: | ||
7 | - name: node_exporter | ||
8 | flags: -a -tags 'netgo static_build' | ||
9 | ldflags: | | ||
10 | -X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}} | ||
11 | -X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}} | ||
12 | -X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}} | ||
13 | -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}} | ||
14 | -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} | ||
15 | tarball: | ||
16 | files: | ||
17 | - LICENSE | ||
18 | - NOTICE | ||
19 | crossbuild: | ||
20 | platforms: | ||
21 | - darwin/amd64 | ||
22 | - darwin/386 | ||
23 | - netbsd/amd64 | ||
24 | - netbsd/386 | ||
diff --git a/.promu.yml b/.promu-no-cgo.yml index a607eaf..2375a86 100644 --- a/.promu.yml +++ b/.promu-no-cgo.yml | |||
@@ -1,5 +1,3 @@ | |||
1 | go: | ||
2 | cgo: true | ||
3 | repository: | 1 | repository: |
4 | path: github.com/prometheus/node_exporter | 2 | path: github.com/prometheus/node_exporter |
5 | build: | 3 | build: |
@@ -20,10 +18,6 @@ crossbuild: | |||
20 | platforms: | 18 | platforms: |
21 | - linux/amd64 | 19 | - linux/amd64 |
22 | - linux/386 | 20 | - linux/386 |
23 | - darwin/amd64 | ||
24 | - darwin/386 | ||
25 | - netbsd/amd64 | ||
26 | - netbsd/386 | ||
27 | - linux/arm | 21 | - linux/arm |
28 | - linux/arm64 | 22 | - linux/arm64 |
29 | - linux/mips | 23 | - linux/mips |
@@ -26,24 +26,41 @@ DOCKERFILE ?= Dockerfile | |||
26 | STATICCHECK_IGNORE = | 26 | STATICCHECK_IGNORE = |
27 | 27 | ||
28 | ifeq ($(OS),Windows_NT) | 28 | ifeq ($(OS),Windows_NT) |
29 | OS_detected := Windows | 29 | OS_detected := Windows |
30 | else | 30 | else |
31 | OS_detected := $(shell uname -s) | 31 | OS_detected := $(shell uname -s) |
32 | endif | 32 | endif |
33 | 33 | ||
34 | ifeq ($(GOHOSTARCH),amd64) | 34 | ifeq ($(GOHOSTARCH),amd64) |
35 | ifeq ($(OS_detected),$(filter $(OS_detected),Linux FreeBSD Darwin Windows)) | 35 | ifeq ($(OS_detected),$(filter $(OS_detected),Linux FreeBSD Darwin Windows)) |
36 | # Only supported on amd64 | 36 | # Only supported on amd64 |
37 | test-flags := -race | 37 | test-flags := -race |
38 | endif | 38 | endif |
39 | endif | 39 | endif |
40 | 40 | ||
41 | ifeq ($(OS_detected), Linux) | 41 | ifeq ($(OS_detected), Linux) |
42 | test-e2e := test-e2e | 42 | test-e2e := test-e2e |
43 | else | 43 | else |
44 | test-e2e := skip-test-e2e | 44 | test-e2e := skip-test-e2e |
45 | endif | 45 | endif |
46 | 46 | ||
47 | # Use CGO for non-Linux builds. | ||
48 | ifeq ($(GOOS), linux) | ||
49 | PROMU_CONF ?= .promu-no-cgo.yml | ||
50 | else | ||
51 | ifndef GOOS | ||
52 | ifeq ($(OS_detected), Linux) | ||
53 | PROMU_CONF ?= .promu-no-cgo.yml | ||
54 | else | ||
55 | PROMU_CONF ?= .promu-cgo.yml | ||
56 | endif | ||
57 | else | ||
58 | PROMU_CONF ?= .promu-cgo.yml | ||
59 | endif | ||
60 | endif | ||
61 | |||
62 | PROMU := $(FIRST_GOPATH)/bin/promu --config $(PROMU_CONF) | ||
63 | |||
47 | e2e-out = collector/fixtures/e2e-output.txt | 64 | e2e-out = collector/fixtures/e2e-output.txt |
48 | ifeq ($(MACH), ppc64le) | 65 | ifeq ($(MACH), ppc64le) |
49 | e2e-out = collector/fixtures/e2e-64k-page-output.txt | 66 | e2e-out = collector/fixtures/e2e-64k-page-output.txt |