diff --git a/.gitignore b/.gitignore index daf913b1..cf9a19ce 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ _testmain.go *.exe *.test *.prof +travis_wait*.log diff --git a/.goreleaser.yml b/.goreleaser.yml index 250e429a..f5fdb0c7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,10 +2,11 @@ project_name: prometheus-nats-exporter release: + draft: true github: owner: nats-io name: prometheus-nats-exporter - + name_template: 'Release {{.Tag}}' builds: diff --git a/.travis.yml b/.travis.yml index 32b41ead..646353ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: -- 1.8.5 -- 1.9.2 +- 1.9.4 + addons: apt: packages: diff --git a/README.md b/README.md index ea684723..125b687a 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ For further information, refer to the [walkthough](walkthrough/README.md) of mon [License-Url]: http://opensource.org/licenses/MIT [License-Image]: https://img.shields.io/badge/License-MIT-blue.svg -[Build-Status-Url]: http://travis-ci.com/nats-io/prometheus-nats-exporter -[Build-Status-Image]: https://travis-ci.com/nats-io/prometheus-nats-exporter.svg?token=bQqsBkZfycgqwrXTwekn&branch=master +[Build-Status-Url]: http://travis-ci.org/nats-io/prometheus-nats-exporter +[Build-Status-Image]: https://travis-ci.org/nats-io/prometheus-nats-exporter.svg?branch=master [Coverage-Url]: https://coveralls.io/r/nats-io/prometheus-nats-exporter?branch=master [Coverage-image]: https://coveralls.io/repos/github/nats-io/prometheus-nats-exporter/badge.svg?branch=master diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..035714b3 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,44 @@ +# The Prometheus NATS exporter release process + +The Prometheus NATS exporter release process creates releases when a new Github tag is generated and pushed. It uses [goreleaser](https://goreleaser.com/) to to do this. To add plaforms, architectures, and assets, modify [.goreleaser.yaml](.goreleaser.yml). + +## Steps to create a new release + +### 1) Create and push a tag to the repository + +**NEVER DUPLICATE AN EXISTING TAG!** + +From your local repository, you'll want to be on *master* branch. Create a local tag and push: + +```text +git tag -a vX.Y.Z +git push origin vX.Y.Z +``` + +e.g. + +```text +$ git tag -a v0.0.1-test +$ git push origin v0.0.1-test +Counting objects: 1, done. +Writing objects: 100% (1/1), 173 bytes | 173.00 KiB/s, done. +Total 1 (delta 0), reused 0 (delta 0) +To github.com:nats-io/prometheus-nats-exporter + * [new tag] v0.0.1-test -> v0.0.1-test +``` + +This will trigger Travis-CI to start a build from the creation of the new tags. Goreleaser will create a draft release using the NATS continuous integration user. This can take awhile. + +**NOTE:** If modifying the release process itself, you can test by pushing a tag from a branch. Use a tag like `v0.0.1-test` to do this. No need to test on master. + +### 2) Edit the Release on Github + +Check the the [releases](https://github.com/nats-io/prometheus-nats-exporter/releases) page, and you should see a draft release generated from your tag, along with compiled binaries. If the release and assets aren't present, check the Travis CI logs for errors. Edit the release notes and publish. You have a github release! + +### 3) Edit docker files + +Modify the docker files to pull down the latest release, and test them. After committing and merging, use the commit hash from the docker file updates in the docker library. This means the official docker files for a release will be at least one commit ahead, but that's OK; we have to test. + +### 4) Update other distribution channels + +Don't forget to update Homebrew, Chocolatey, etc if applicable. diff --git a/docker/linux/amd64/Dockerfile b/docker/linux/amd64/Dockerfile index 8e662923..23f15a90 100644 --- a/docker/linux/amd64/Dockerfile +++ b/docker/linux/amd64/Dockerfile @@ -1,5 +1,5 @@ # Golang binary building stage -FROM golang:1.9.2 +FROM golang:1.9.4 # download the source WORKDIR /go/src/github.com/nats-io/prometheus-nats-exporter diff --git a/docker/linux/arm32v7/Dockerfile b/docker/linux/arm32v7/Dockerfile index fe6a4f41..e4744002 100644 --- a/docker/linux/arm32v7/Dockerfile +++ b/docker/linux/arm32v7/Dockerfile @@ -1,5 +1,5 @@ # Golang binary building stage -FROM golang:1.9.2 +FROM golang:1.9.4 # download the source WORKDIR /go/src/github.com/nats-io/prometheus-nats-exporter diff --git a/docker/linux/arm64v8/Dockerfile b/docker/linux/arm64v8/Dockerfile index ac9a12f4..61f115bc 100644 --- a/docker/linux/arm64v8/Dockerfile +++ b/docker/linux/arm64v8/Dockerfile @@ -1,5 +1,5 @@ # Golang binary building stage -FROM golang:1.9.2 +FROM golang:1.9.4 # download the source WORKDIR /go/src/github.com/nats-io/prometheus-nats-exporter diff --git a/docker/windows/amd64/nanoserver/Dockerfile b/docker/windows/amd64/nanoserver/Dockerfile index ea2dbdf9..35f953ce 100644 --- a/docker/windows/amd64/nanoserver/Dockerfile +++ b/docker/windows/amd64/nanoserver/Dockerfile @@ -1,5 +1,5 @@ # Golang binary building stage -FROM golang:1.9.2 +FROM golang:1.9.4 # download the source WORKDIR /go/src/github.com/nats-io/prometheus-nats-exporter diff --git a/docker/windows/amd64/windowsservercore/Dockerfile b/docker/windows/amd64/windowsservercore/Dockerfile index cb1c0a77..0253ba0e 100644 --- a/docker/windows/amd64/windowsservercore/Dockerfile +++ b/docker/windows/amd64/windowsservercore/Dockerfile @@ -1,5 +1,5 @@ # Golang binary building stage -FROM golang:1.9.2 +FROM golang:1.9.4 # download the source WORKDIR /go/src/github.com/nats-io/prometheus-nats-exporter diff --git a/scripts/cov.sh b/scripts/cov.sh index d369d9f6..3cb6eaf2 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -1,17 +1,17 @@ #!/bin/bash -e # Run from directory above via ./scripts/cov.sh -rm -rf ./cov -mkdir cov -go test -v -covermode=atomic -coverprofile=./cov/collector.out ./collector -go test -v -covermode=atomic -coverprofile=./cov/exporter.out ./exporter -gocovmerge ./cov/*.out > acc.out -rm -rf ./cov +rm -rf /tmp/cov +mkdir -p /tmp/cov +go test -v -covermode=atomic -coverprofile=/tmp/cov/collector.out ./collector +go test -v -covermode=atomic -coverprofile=/tmp/cov/exporter.out ./exporter +gocovmerge /tmp/cov/*.out > /tmp/acc.out +rm -rf /tmp/cov # If we have an arg, assume travis run and push to coveralls. Otherwise launch browser results if [[ -n $1 ]]; then - $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci - rm -rf ./acc.out + $HOME/gopath/bin/goveralls -coverprofile=/tmp/acc.out -service travis-ci + rm -rf /tmp/acc.out else - go tool cover -html=acc.out + go tool cover -html=/tmp/acc.out fi diff --git a/scripts/cross_compile.sh b/scripts/cross_compile.sh deleted file mode 100755 index 87ae6864..00000000 --- a/scripts/cross_compile.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -go get github.com/mitchellh/gox -go get github.com/tcnksm/ghr - -export APPNAME="prometheus-nats-exporter" -export OSARCH="linux/386 linux/amd64 linux/arm64 darwin/amd64 windows/386 windows/amd64" -export DIRS="linux-386 linux-amd64 linux-arm6 linux-arm7 linux-arm64 darwin-amd64 windows-386 windows-amd64" -export OUTDIR="pkg" - -# If we have an arg, assume its a version tag and rename as appropriate. -if [[ -n $1 ]]; then - export APPNAME=$APPNAME-$1 -fi - -# Build all from OSARCH list -env CGO_ENABLED=0 gox -osarch="$OSARCH" -ldflags="-s -w" -output "$OUTDIR/$APPNAME-{{.OS}}-{{.Arch}}/prometheus-nats-exporter" - -# Be explicit about the ARM builds -# ARMv6 -env CGO_ENABLED=0 GOARM=6 gox -osarch="linux/arm" -ldflags="-s -w" -output "$OUTDIR/$APPNAME-linux-arm6/prometheus-nats-exporter" -# ARMv7 -env CGO_ENABLED=0 GOARM=7 gox -osarch="linux/arm" -ldflags="-s -w" -output "$OUTDIR/$APPNAME-linux-arm7/prometheus-nats-exporter" - -# Create the zip files -for dir in $DIRS; do \ - (cp README.md $OUTDIR/$APPNAME-$dir/README.md) ;\ - (cp LICENSE $OUTDIR/$APPNAME-$dir/LICENSE) ;\ - (cd $OUTDIR && zip -q $APPNAME-$dir.zip -r $APPNAME-$dir) ;\ - echo "make $OUTDIR/$APPNAME-$dir.zip" ;\ -done \ No newline at end of file