Skip to content

Commit da866ec

Browse files
authored
Update build and release setup (prometheus-community#71)
* Bump go vendoring. * Add VERSION/CHANGELOG to make releases. * Add promu config for building and releaseing. * Re-arrange repo slightly to follow Go cmd/ pattern. Signed-off-by: Ben Kochie <[email protected]>
1 parent 8f4561f commit da866ec

File tree

122 files changed

+11415
-2202
lines changed

Some content is hidden

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

122 files changed

+11415
-2202
lines changed

.circleci/config.yml

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
---
22
version: 2.1
33

4+
orbs:
5+
prometheus: prometheus/[email protected]
6+
47
executors:
58
golang:
69
docker:
7-
- image: circleci/golang:1.12
10+
- image: circleci/golang:1.13
811

912
jobs:
10-
build:
13+
test:
1114
executor: golang
1215
steps:
13-
- checkout
14-
- run: mkdir build
15-
- run:
16-
name: Build proxy
17-
command: go build -mod=vendor -o build/proxy ./proxy
18-
- run:
19-
name: Build client
20-
command: go build -mod=vendor -o build/client ./client
21-
- run:
22-
name: Download and untar node_exporter
23-
command: |
24-
wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
25-
tar xzf node_exporter-0.17.0.linux-amd64.tar.gz
16+
- prometheus/setup_environment
17+
- run: make build
18+
- run: wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
19+
- run: tar xzf node_exporter-0.18.1.linux-amd64.tar.gz
20+
- run: cp -v node_exporter-0.18.1.linux-amd64/node_exporter ./node_exporter
21+
- run: wget https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz
22+
- run: tar xzf prometheus-2.15.2.linux-amd64.tar.gz
23+
- run: cp -v prometheus-2.15.2.linux-amd64/prometheus ./prometheus
2624
- run:
27-
name: Download, untar, and configure Prometheus
25+
name: Configure Prometheus
2826
command: |
29-
wget https://github.com/prometheus/prometheus/releases/download/v2.9.1/prometheus-2.9.1.linux-amd64.tar.gz
30-
tar xzf prometheus-2.9.1.linux-amd64.tar.gz
31-
cd prometheus-2.9.1.linux-amd64
32-
rm prometheus.yml
3327
cat \<< EOF > prometheus.yml
3428
global:
3529
scrape_interval: 1s
@@ -42,49 +36,36 @@ jobs:
4236
- run:
4337
name: Run everything and test that Prometheus can scrape node_exporter via pushprox
4438
command: ./end-to-end-test.sh
45-
- persist_to_workspace:
46-
root: .
47-
paths:
48-
- build
49-
- store_artifacts:
50-
path: build
5139

52-
release:
53-
docker:
54-
- image: circleci/golang:1.11
40+
publish_release:
5541
executor: golang
42+
5643
steps:
57-
- checkout
58-
- run: sudo apt-get update
59-
- run: sudo apt-get -y install fakeroot
60-
- run: mkdir -v -p ${HOME}/bin
61-
- run: curl -L 'https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C ${HOME}/bin
62-
- attach_workspace:
63-
at: .
64-
- run: mkdir "pushprox-${CIRCLE_TAG}"
65-
- run: cp build/{client,proyy} "pushprox-${CIRCLE_TAG}/"
66-
- run: fakeroot tar -czvf pushprox-${CIRCLE_TAG}.amd64.tar.gz "pushprox-${CIRCLE_TAG}"
67-
- run: sha256sum pushprox-*.tar.gz | tee sha256sums.txt
68-
- run: >
69-
for file in pushprox-*.tar.gz sha256sums.txt ; do
70-
${HOME}/bin/github-release upload \
71-
--user "${CIRCLE_PROJECT_USERNAME}" \
72-
--repo "${CIRCLE_PROJECT_REPONAME}" \
73-
--tag "${CIRCLE_TAG}" \
74-
--name "${file}" \
75-
--file "${file}"
76-
done
44+
- prometheus/setup_build_environment
45+
- run: promu crossbuild tarballs
46+
- run: promu checksum .tarballs
47+
- run: promu release .tarballs
48+
- store_artifacts:
49+
path: .tarballs
50+
destination: releases
7751

7852
workflows:
7953
version: 2
8054
stuff:
8155
jobs:
82-
- build:
56+
- test:
57+
filters:
58+
tags:
59+
only: /.*/
60+
- prometheus/build:
61+
name: build
8362
filters:
8463
tags:
8564
only: /.*/
86-
- release:
65+
- publish_release:
66+
context: org-context
8767
requires:
68+
- test
8869
- build
8970
filters:
9071
tags:

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
build/
2-
node_exporter*
3-
prometheus*
4-
data/
1+
/.build/
2+
/.release/
3+
/.tarballs/
4+
/node_exporter*
5+
/prometheus*
6+
/data/
7+
/pushprox-client
8+
/pushprox-proxy

.promu.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
go:
2+
# Whenever the Go version is updated here, .travis.yml and
3+
# .circle/config.yml should also be updated.
4+
version: 1.13
5+
repository:
6+
path: github.com/robustperception/pushprox
7+
build:
8+
binaries:
9+
- name: pushprox-client
10+
path: ./cmd/client
11+
- name: pushprox-proxy
12+
path: ./cmd/proxy
13+
flags: -mod=vendor -a -tags netgo
14+
tarball:
15+
files:
16+
- LICENSE

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## master / unreleased
2+
3+
## 0.1.0 / 2019-07-29
4+
5+
* [CHANGE] Initial release

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include Makefile.common
2+
3+
DOCKER_IMAGE_NAME ?= pushprox

0 commit comments

Comments
 (0)