Skip to content

Commit 5c12fd5

Browse files
committed
Update for prometheus-community
Update the codebase for the new prometheus-comunity location. * Replace Travis with CircleCI. * Update to standard Prometheus Makefile.common * Update all Go references. * Drop vendor/ dir * Update vendoring to use Go modules. Signed-off-by: SuperQ <[email protected]>
1 parent c4c7d2b commit 5c12fd5

File tree

178 files changed

+484
-36239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+484
-36239
lines changed

.circleci/config.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
version: 2.1
3+
4+
orbs:
5+
prometheus: prometheus/[email protected]
6+
7+
executors:
8+
# This must match .promu.yml.
9+
golang:
10+
docker:
11+
- image: circleci/golang:1.16
12+
13+
jobs:
14+
test:
15+
executor: golang
16+
17+
steps:
18+
- prometheus/setup_environment
19+
# TODO: Fix golangci-lint and test issues to use plain `make` test.
20+
- run: make precheck style check_license unused build
21+
- prometheus/store_artifact:
22+
file: elasticsearch_exporter
23+
24+
workflows:
25+
version: 2
26+
elasticsearch_exporter:
27+
jobs:
28+
- test:
29+
filters:
30+
tags:
31+
only: /.*/
32+
- prometheus/build:
33+
name: build
34+
filters:
35+
tags:
36+
only: /.*/
37+
- prometheus/publish_master:
38+
context: org-context
39+
docker_hub_organization: prometheuscommunity
40+
quay_io_organization: prometheuscommunity
41+
requires:
42+
- test
43+
- build
44+
filters:
45+
branches:
46+
only: master
47+
- prometheus/publish_release:
48+
context: org-context
49+
docker_hub_organization: prometheuscommunity
50+
quay_io_organization: prometheuscommunity
51+
requires:
52+
- test
53+
- build
54+
filters:
55+
tags:
56+
only: /^v.*/
57+
branches:
58+
ignore: /.*/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ elasticsearch_exporter
33
*.tar.gz
44
*-stamp
55
.tarballs
6+
/vendor

.promu.yml

+10-31
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
go:
2-
cgo: false
2+
# This must match .circle/config.yml.
3+
version: 1.16
34
repository:
4-
path: github.com/justwatchcom/elasticsearch_exporter
5+
path: github.com/prometheus-community/elasticsearch_exporter
56
build:
7+
binaries:
8+
- name: elasticsearch_exporter
69
flags: -a -tags netgo
710
ldflags: |
811
-s
9-
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}}
10-
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}}
11-
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}}
12-
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
13-
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
12+
-X github.com/prometheus/common/version.Version={{.Version}}
13+
-X github.com/prometheus/common/version.Revision={{.Revision}}
14+
-X github.com/prometheus/common/version.Branch={{.Branch}}
15+
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
16+
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
1417
tarball:
1518
files:
1619
- LICENSE
@@ -19,27 +22,3 @@ tarball:
1922
- examples/grafana/dashboard.json
2023
- examples/kubernetes/deployment.yml
2124
- examples/prometheus/elasticsearch.rules
22-
crossbuild:
23-
platforms:
24-
- linux/amd64
25-
- linux/386
26-
- darwin/amd64
27-
- darwin/386
28-
- windows/amd64
29-
- windows/386
30-
- freebsd/amd64
31-
- freebsd/386
32-
- openbsd/amd64
33-
- openbsd/386
34-
- netbsd/amd64
35-
- netbsd/386
36-
- dragonfly/amd64
37-
- linux/arm
38-
- linux/arm64
39-
- freebsd/arm
40-
- openbsd/arm
41-
- netbsd/arm
42-
- linux/ppc64
43-
- linux/ppc64le
44-
- linux/mips64
45-
- linux/mips64le

.travis.yml

-16
This file was deleted.

Dockerfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
FROM quay.io/prometheus/golang-builder as builder
1+
ARG ARCH="amd64"
2+
ARG OS="linux"
3+
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
4+
LABEL maintainer="The Prometheus Authors <[email protected]>"
25

3-
ADD . /go/src/github.com/justwatchcom/elasticsearch_exporter
4-
WORKDIR /go/src/github.com/justwatchcom/elasticsearch_exporter
6+
ARG ARCH="amd64"
7+
ARG OS="linux"
8+
COPY .build/${OS}-${ARCH}/elasticsearch_exporter /bin/elasticsearch_exporter
59

6-
RUN make
7-
8-
FROM quay.io/prometheus/busybox:latest
9-
MAINTAINER The Prometheus Authors <[email protected]>
10-
11-
COPY --from=builder /go/src/github.com/justwatchcom/elasticsearch_exporter/elasticsearch_exporter /bin/elasticsearch_exporter
12-
13-
EXPOSE 9114
10+
EXPOSE 7979
11+
USER nobody
1412
ENTRYPOINT [ "/bin/elasticsearch_exporter" ]

Makefile

+7-77
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,10 @@
1-
# Copyright 2016 The Prometheus Authors
2-
# Licensed under the Apache License, Version 2.0 (the "License");
3-
# you may not use this file except in compliance with the License.
4-
# You may obtain a copy of the License at
5-
#
6-
# http://www.apache.org/licenses/LICENSE-2.0
7-
#
8-
# Unless required by applicable law or agreed to in writing, software
9-
# distributed under the License is distributed on an "AS IS" BASIS,
10-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11-
# See the License for the specific language governing permissions and
12-
# limitations under the License.
1+
# Ensure that 'all' is the default target otherwise it will be the first target from Makefile.common.
2+
all::
133

14-
GO := GO15VENDOREXPERIMENT=1 go
15-
PROMU := $(GOPATH)/bin/promu
16-
GOLINTER ?= $(GOPATH)/bin/gometalinter
17-
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
4+
# Needs to be defined before including Makefile.common to auto-generate targets
5+
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le
6+
DOCKER_REPO ?= prometheuscommunity
187

19-
PREFIX ?= $(shell pwd)
20-
BIN_DIR ?= $(shell pwd)
21-
DOCKER_IMAGE_NAME ?= elasticsearch-exporter
22-
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
23-
24-
25-
all: format build test
26-
27-
style:
28-
@echo ">> checking code style"
29-
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
30-
31-
test:
32-
@echo ">> running tests"
33-
@$(GO) test -short $(pkgs)
34-
35-
format:
36-
@echo ">> formatting code"
37-
@$(GO) fmt $(pkgs)
38-
39-
vet:
40-
@echo ">> vetting code"
41-
@$(GO) vet $(pkgs)
42-
43-
build: promu
44-
@echo ">> building binaries"
45-
@$(PROMU) build --prefix $(PREFIX)
8+
include Makefile.common
469

47-
crossbuild: promu
48-
@echo ">> cross-building binaries"
49-
@$(PROMU) crossbuild
50-
51-
tarball: promu
52-
@echo ">> building release tarball"
53-
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
54-
55-
tarballs: promu
56-
@echo ">> building release tarballs"
57-
@$(PROMU) crossbuild tarballs
58-
@echo ">> calculating release checksums"
59-
@$(PROMU) checksum $(BIN_DIR)/.tarballs
60-
61-
docker:
62-
@echo ">> building docker image"
63-
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
64-
65-
promu:
66-
@GOOS=$(shell uname -s | tr A-Z a-z) \
67-
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
68-
$(GO) get -u github.com/prometheus/promu
69-
70-
gometalinter: $(GOLINTER)
71-
@echo ">> linting code"
72-
@$(GOLINTER) --install > /dev/null
73-
@$(GOLINTER) --config=./.gometalinter.json ./...
74-
75-
$(GOPATH)/bin/gometalinter lint:
76-
@GOOS=$(shell uname -s | tr A-Z a-z) \
77-
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
78-
$(GO) get -u github.com/alecthomas/gometalinter
79-
80-
.PHONY: all style format build test vet tarball docker promu $(GOPATH)/bin/gometalinter lint
10+
DOCKER_IMAGE_NAME ?= elasticsearch-exporter

0 commit comments

Comments
 (0)