aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Kochie <superq@gmail.com>2018-09-25 16:02:42 +0200
committerGitHub <noreply@github.com>2018-09-25 16:02:42 +0200
commitc7dfb82dac2d599d9eb3012b55a067a89f37f5c7 (patch)
tree80b758bc183c0192da24c8a04e0692a4b8b82aa1
parent0fdc089187c3d5d9fe62e528653986ee6e71325b (diff)
downloadprometheus_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.yml11
-rw-r--r--.promu-cgo.yml24
-rw-r--r--.promu-no-cgo.yml (renamed from .promu.yml)6
-rw-r--r--Makefile31
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
4jobs: 4jobs:
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 @@
1go:
2 cgo: true
3repository:
4 path: github.com/prometheus/node_exporter
5build:
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"}}
15tarball:
16 files:
17 - LICENSE
18 - NOTICE
19crossbuild:
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 @@
1go:
2 cgo: true
3repository: 1repository:
4 path: github.com/prometheus/node_exporter 2 path: github.com/prometheus/node_exporter
5build: 3build:
@@ -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
diff --git a/Makefile b/Makefile
index 6cd5e0f..835a407 100644
--- a/Makefile
+++ b/Makefile
@@ -26,24 +26,41 @@ DOCKERFILE ?= Dockerfile
26STATICCHECK_IGNORE = 26STATICCHECK_IGNORE =
27 27
28ifeq ($(OS),Windows_NT) 28ifeq ($(OS),Windows_NT)
29 OS_detected := Windows 29 OS_detected := Windows
30else 30else
31 OS_detected := $(shell uname -s) 31 OS_detected := $(shell uname -s)
32endif 32endif
33 33
34ifeq ($(GOHOSTARCH),amd64) 34ifeq ($(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
39endif 39endif
40 40
41ifeq ($(OS_detected), Linux) 41ifeq ($(OS_detected), Linux)
42 test-e2e := test-e2e 42 test-e2e := test-e2e
43else 43else
44 test-e2e := skip-test-e2e 44 test-e2e := skip-test-e2e
45endif 45endif
46 46
47# Use CGO for non-Linux builds.
48ifeq ($(GOOS), linux)
49 PROMU_CONF ?= .promu-no-cgo.yml
50else
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
60endif
61
62PROMU := $(FIRST_GOPATH)/bin/promu --config $(PROMU_CONF)
63
47e2e-out = collector/fixtures/e2e-output.txt 64e2e-out = collector/fixtures/e2e-output.txt
48ifeq ($(MACH), ppc64le) 65ifeq ($(MACH), ppc64le)
49 e2e-out = collector/fixtures/e2e-64k-page-output.txt 66 e2e-out = collector/fixtures/e2e-64k-page-output.txt