You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-08-06 14:22:37 +03:00
Update build (#276)
* Update build * Update to circleci 2.0 * Update Makefile to use Prometheus Makefile.common. Signed-off-by: Ben Kochie <superq@gmail.com> * Fix spelling typos. Signed-off-by: Ben Kochie <superq@gmail.com> * Add percona server to docker test. * Run the latest percona-server docker image. * Set a `mysql-test` docker network. Signed-off-by: Ben Kochie <superq@gmail.com> * Update Travis go versions. Signed-off-by: Ben Kochie <superq@gmail.com> * Update README * Recommend docker network, as link is deprecated. * Make DSN example more consistent. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
168
.circleci/config.yml
Normal file
168
.circleci/config.yml
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
---
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.10
|
||||||
|
working_directory: /go/src/github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: make promu
|
||||||
|
- run: make
|
||||||
|
- run: rm -v mysqld_exporter
|
||||||
|
|
||||||
|
codespell:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: sudo pip install codespell
|
||||||
|
- run: codespell --skip=".git,./vendor,ttar"
|
||||||
|
|
||||||
|
build:
|
||||||
|
machine: true
|
||||||
|
working_directory: /home/circleci/.go_workspace/src/github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
environment:
|
||||||
|
DOCKER_IMAGE_NAME: prom/mysqld-exporter
|
||||||
|
QUAY_IMAGE_NAME: quay.io/prometheus/mysqld-exporter
|
||||||
|
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.10-base
|
||||||
|
REPO_PATH: github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: make promu
|
||||||
|
- run: promu crossbuild -v
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- .build
|
||||||
|
- run: ln -s .build/linux-amd64/mysqld_exporter mysqld_exporter
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_TAG" ]; then
|
||||||
|
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
else
|
||||||
|
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME
|
||||||
|
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME
|
||||||
|
fi
|
||||||
|
- run: docker images
|
||||||
|
- run: docker network create mysql-test
|
||||||
|
- run: docker run --network mysql-test -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 -d percona/percona-server:latest
|
||||||
|
|
||||||
|
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_TAG" ]; then
|
||||||
|
make test-docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
else
|
||||||
|
make test-docker
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker_hub_master:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.10
|
||||||
|
working_directory: /go/src/github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
environment:
|
||||||
|
DOCKER_IMAGE_NAME: prom/mysqld-exporter
|
||||||
|
QUAY_IMAGE_NAME: quay.io/prometheus/mysqld-exporter
|
||||||
|
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.10-base
|
||||||
|
REPO_PATH: github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
- run: ln -s .build/linux-amd64/mysqld_exporter mysqld_exporter
|
||||||
|
- run: make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME
|
||||||
|
- run: make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME
|
||||||
|
- run: docker images
|
||||||
|
- run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
||||||
|
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
||||||
|
- run: docker push $DOCKER_IMAGE_NAME
|
||||||
|
- run: docker push $QUAY_IMAGE_NAME
|
||||||
|
|
||||||
|
docker_hub_release_tags:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.10
|
||||||
|
working_directory: /go/src/github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
environment:
|
||||||
|
DOCKER_IMAGE_NAME: prom/mysqld-exporter
|
||||||
|
QUAY_IMAGE_NAME: quay.io/prometheus/mysqld-exporter
|
||||||
|
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.10-base
|
||||||
|
REPO_PATH: github.com/prometheus/mysqld_exporter
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker
|
||||||
|
- run: mkdir -v -p ${HOME}/bin
|
||||||
|
- 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
|
||||||
|
- run: echo 'export PATH=${HOME}/bin:${PATH}' >> ${BASH_ENV}
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
- run: make promu
|
||||||
|
- run: promu crossbuild tarballs
|
||||||
|
- run: promu checksum .tarballs
|
||||||
|
- run: promu release .tarballs
|
||||||
|
- store_artifacts:
|
||||||
|
path: .tarballs
|
||||||
|
destination: releases
|
||||||
|
- run: ln -s .build/linux-amd64/mysqld_exporter mysqld_exporter
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_TAG" ]; then
|
||||||
|
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
else
|
||||||
|
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME
|
||||||
|
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME
|
||||||
|
fi
|
||||||
|
- run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
||||||
|
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
||||||
|
- run: |
|
||||||
|
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
|
||||||
|
docker tag "$DOCKER_IMAGE_NAME:$CIRCLE_TAG" "$DOCKER_IMAGE_NAME:latest"
|
||||||
|
docker tag "$QUAY_IMAGE_NAME:$CIRCLE_TAG" "$QUAY_IMAGE_NAME:latest"
|
||||||
|
fi
|
||||||
|
- run: docker push $DOCKER_IMAGE_NAME:$CIRCLE_TAG
|
||||||
|
- run: docker push $QUAY_IMAGE_NAME:$CIRCLE_TAG
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
mysqld_exporter:
|
||||||
|
jobs:
|
||||||
|
- test:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- build:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- codespell:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- docker_hub_master:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
- docker_hub_release_tags:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /^v.*/
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
@@ -3,9 +3,8 @@ sudo: required
|
|||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.8.x
|
|
||||||
- 1.9.x
|
- 1.9.x
|
||||||
- master
|
- 1.10.x
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- MYSQL_IMAGE=mysql/mysql-server:5.5
|
- MYSQL_IMAGE=mysql/mysql-server:5.5
|
||||||
|
58
Makefile
58
Makefile
@@ -11,55 +11,17 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
GO := go
|
all: vet
|
||||||
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
|
|
||||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
include Makefile.common
|
||||||
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
|
|
||||||
|
STATICCHECK_IGNORE = \
|
||||||
|
github.com/prometheus/mysqld_exporter/mysqld_exporter.go:SA1019
|
||||||
|
|
||||||
PREFIX ?= $(shell pwd)
|
|
||||||
BIN_DIR ?= $(shell pwd)
|
|
||||||
DOCKER_IMAGE_NAME ?= mysqld-exporter
|
DOCKER_IMAGE_NAME ?= mysqld-exporter
|
||||||
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
|
|
||||||
|
|
||||||
|
test-docker:
|
||||||
|
@echo ">> testing docker image"
|
||||||
|
./test_image.sh "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9104
|
||||||
|
|
||||||
all: format build test-short
|
.PHONY: test-docker
|
||||||
|
|
||||||
style:
|
|
||||||
@echo ">> checking code style"
|
|
||||||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
|
||||||
|
|
||||||
test-short:
|
|
||||||
@echo ">> running short tests"
|
|
||||||
@$(GO) test -short -race $(pkgs)
|
|
||||||
|
|
||||||
test:
|
|
||||||
@echo ">> running tests"
|
|
||||||
@$(GO) test -race $(pkgs)
|
|
||||||
|
|
||||||
format:
|
|
||||||
@echo ">> formatting code"
|
|
||||||
@$(GO) fmt $(pkgs)
|
|
||||||
|
|
||||||
vet:
|
|
||||||
@echo ">> vetting code"
|
|
||||||
@$(GO) vet $(pkgs)
|
|
||||||
|
|
||||||
build: promu
|
|
||||||
@echo ">> building binaries"
|
|
||||||
@$(PROMU) build --prefix $(PREFIX)
|
|
||||||
|
|
||||||
tarball: promu
|
|
||||||
@echo ">> building release tarball"
|
|
||||||
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
|
||||||
|
|
||||||
docker:
|
|
||||||
@echo ">> building docker image"
|
|
||||||
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
|
||||||
|
|
||||||
promu:
|
|
||||||
@GOOS=$(shell uname -s | tr A-Z a-z) \
|
|
||||||
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
|
|
||||||
$(GO) get -u github.com/prometheus/promu
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all style format build test vet tarball docker promu
|
|
||||||
|
100
Makefile.common
Normal file
100
Makefile.common
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
# Copyright 2018 The Prometheus Authors
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
# A common Makefile that includes rules to be reused in different prometheus projects.
|
||||||
|
# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository!
|
||||||
|
|
||||||
|
# Example usage :
|
||||||
|
# Create the main Makefile in the root project directory.
|
||||||
|
# include Makefile.common
|
||||||
|
# customTarget:
|
||||||
|
# @echo ">> Running customTarget"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Ensure GOBIN is not set during build so that promu is installed to the correct path
|
||||||
|
unexport GOBIN
|
||||||
|
|
||||||
|
GO ?= go
|
||||||
|
GOFMT ?= $(GO)fmt
|
||||||
|
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
|
||||||
|
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||||
|
STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck
|
||||||
|
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
|
||||||
|
pkgs = ./...
|
||||||
|
|
||||||
|
PREFIX ?= $(shell pwd)
|
||||||
|
BIN_DIR ?= $(shell pwd)
|
||||||
|
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
|
||||||
|
|
||||||
|
all: style staticcheck unused build test
|
||||||
|
|
||||||
|
style:
|
||||||
|
@echo ">> checking code style"
|
||||||
|
! $(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
||||||
|
|
||||||
|
check_license:
|
||||||
|
@echo ">> checking license header"
|
||||||
|
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
|
||||||
|
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
|
||||||
|
done); \
|
||||||
|
if [ -n "$${licRes}" ]; then \
|
||||||
|
echo "license header checking failed:"; echo "$${licRes}"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
test-short:
|
||||||
|
@echo ">> running short tests"
|
||||||
|
$(GO) test -short $(pkgs)
|
||||||
|
|
||||||
|
test:
|
||||||
|
@echo ">> running all tests"
|
||||||
|
$(GO) test -race $(pkgs)
|
||||||
|
|
||||||
|
format:
|
||||||
|
@echo ">> formatting code"
|
||||||
|
$(GO) fmt $(pkgs)
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@echo ">> vetting code"
|
||||||
|
$(GO) vet $(pkgs)
|
||||||
|
|
||||||
|
staticcheck: $(STATICCHECK)
|
||||||
|
@echo ">> running staticcheck"
|
||||||
|
$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
||||||
|
|
||||||
|
unused: $(GOVENDOR)
|
||||||
|
@echo ">> running check for unused packages"
|
||||||
|
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
||||||
|
|
||||||
|
build: promu
|
||||||
|
@echo ">> building binaries"
|
||||||
|
$(PROMU) build --prefix $(PREFIX)
|
||||||
|
|
||||||
|
tarball: promu
|
||||||
|
@echo ">> building release tarball"
|
||||||
|
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
||||||
|
|
||||||
|
docker:
|
||||||
|
docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
||||||
|
|
||||||
|
promu:
|
||||||
|
GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu
|
||||||
|
|
||||||
|
$(FIRST_GOPATH)/bin/staticcheck:
|
||||||
|
GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck
|
||||||
|
|
||||||
|
$(FIRST_GOPATH)/bin/govendor:
|
||||||
|
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
|
||||||
|
|
||||||
|
.PHONY: all style check_license format build test vet assets tarball docker promu staticcheck $(FIRST_GOPATH)/bin/staticcheck govendor $(FIRST_GOPATH)/bin/govendor
|
10
README.md
10
README.md
@@ -28,7 +28,7 @@ NOTE: It is recommended to set a max connection limit for the user to avoid over
|
|||||||
|
|
||||||
Running using an environment variable:
|
Running using an environment variable:
|
||||||
|
|
||||||
export DATA_SOURCE_NAME='login:password@(hostname:port)/'
|
export DATA_SOURCE_NAME='user:password@(hostname:3306)/'
|
||||||
./mysqld_exporter <flags>
|
./mysqld_exporter <flags>
|
||||||
|
|
||||||
Running using ~/.my.cnf:
|
Running using ~/.my.cnf:
|
||||||
@@ -106,10 +106,14 @@ You can deploy this exporter using the [prom/mysqld-exporter](https://registry.h
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
docker network create my-mysql-network
|
||||||
docker pull prom/mysqld-exporter
|
docker pull prom/mysqld-exporter
|
||||||
|
|
||||||
docker run -d -p 9104:9104 --link=my_mysql_container:bdd \
|
docker run -d \
|
||||||
-e DATA_SOURCE_NAME="user:password@(bdd:3306)/database" prom/mysqld-exporter
|
-p 9104:9104 \
|
||||||
|
--network my-mysql-network \
|
||||||
|
-e DATA_SOURCE_NAME="user:password@(my-mysql-network:3306)/" \
|
||||||
|
prom/mysqld-exporter
|
||||||
```
|
```
|
||||||
|
|
||||||
## heartbeat
|
## heartbeat
|
||||||
|
62
circle.yml
62
circle.yml
@@ -1,62 +0,0 @@
|
|||||||
machine:
|
|
||||||
environment:
|
|
||||||
DOCKER_IMAGE_NAME: prom/mysqld-exporter
|
|
||||||
QUAY_IMAGE_NAME: quay.io/prometheus/mysqld-exporter
|
|
||||||
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.8-base
|
|
||||||
REPO_PATH: github.com/prometheus/mysqld_exporter
|
|
||||||
pre:
|
|
||||||
- sudo curl -L -o /usr/bin/docker 'https://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.1-circleci'
|
|
||||||
- sudo chmod 0755 /usr/bin/docker
|
|
||||||
- sudo curl -L 'https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C $HOME/bin
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
pre:
|
|
||||||
- make promu
|
|
||||||
- docker info
|
|
||||||
override:
|
|
||||||
- promu crossbuild
|
|
||||||
- ln -s .build/linux-amd64/mysqld_exporter mysqld_exporter
|
|
||||||
- |
|
|
||||||
if [ -n "$CIRCLE_TAG" ]; then
|
|
||||||
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
|
||||||
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
|
||||||
else
|
|
||||||
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME
|
|
||||||
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME
|
|
||||||
fi
|
|
||||||
post:
|
|
||||||
- mkdir $CIRCLE_ARTIFACTS/binaries/ && cp -a .build/* $CIRCLE_ARTIFACTS/binaries/
|
|
||||||
- docker images
|
|
||||||
|
|
||||||
test:
|
|
||||||
override:
|
|
||||||
- docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
|
|
||||||
|
|
||||||
deployment:
|
|
||||||
hub_branch:
|
|
||||||
branch: master
|
|
||||||
owner: prometheus
|
|
||||||
commands:
|
|
||||||
- docker login -e $DOCKER_EMAIL -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
||||||
- docker login -e $QUAY_EMAIL -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
|
||||||
- docker push $DOCKER_IMAGE_NAME
|
|
||||||
- docker push $QUAY_IMAGE_NAME
|
|
||||||
hub_tag:
|
|
||||||
tag: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
|
|
||||||
owner: prometheus
|
|
||||||
commands:
|
|
||||||
- promu crossbuild tarballs
|
|
||||||
- promu checksum .tarballs
|
|
||||||
- promu release .tarballs
|
|
||||||
- mkdir $CIRCLE_ARTIFACTS/releases/ && cp -a .tarballs/* $CIRCLE_ARTIFACTS/releases/
|
|
||||||
- docker login -e $DOCKER_EMAIL -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
||||||
- docker login -e $QUAY_EMAIL -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
|
||||||
- |
|
|
||||||
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
|
|
||||||
docker tag "$DOCKER_IMAGE_NAME:$CIRCLE_TAG" "$DOCKER_IMAGE_NAME:latest"
|
|
||||||
docker tag "$QUAY_IMAGE_NAME:$CIRCLE_TAG" "$QUAY_IMAGE_NAME:latest"
|
|
||||||
fi
|
|
||||||
- docker push $DOCKER_IMAGE_NAME
|
|
||||||
- docker push $QUAY_IMAGE_NAME
|
|
@@ -47,6 +47,6 @@ func TestScrapeBinlogSize(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -160,6 +160,6 @@ END OF INNODB MONITOR OUTPUT
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,6 @@ func TestScrapeEngineTokudbStatus(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
// Scrape query
|
// Scrape query
|
||||||
globalStatusQuery = `SHOW GLOBAL STATUS`
|
globalStatusQuery = `SHOW GLOBAL STATUS`
|
||||||
// Subsytem.
|
// Subsystem.
|
||||||
globalStatus = "global_status"
|
globalStatus = "global_status"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -68,6 +68,6 @@ func TestScrapeGlobalStatus(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,7 @@ func TestScrapeGlobalVariables(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,6 @@ func TestScrapeHeartbeat(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,6 @@ func TestScrapeClientStat(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,6 @@ func TestScrapeInnodbMetrics(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,6 @@ func TestScrapeInfoSchemaInnodbTablespaces(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -73,6 +73,6 @@ func TestScrapeQueryResponseTime(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,6 @@ func TestScrapeTableStat(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,6 @@ func TestScrapeUserStat(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,6 +62,6 @@ func TestScrapePerfFileInstances(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,6 @@ func TestScrapePerfIndexIOWaits(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,6 @@ func TestScrapeSlaveStatus(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure all SQL queries were executed
|
// Ensure all SQL queries were executed
|
||||||
if err := mock.ExpectationsWereMet(); err != nil {
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
t.Errorf("there were unfulfilled expections: %s", err)
|
t.Errorf("there were unfulfilled exceptions: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
test_image.sh
Executable file
36
test_image.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -exo pipefail
|
||||||
|
|
||||||
|
docker_image=$1
|
||||||
|
port=$2
|
||||||
|
|
||||||
|
container_id=''
|
||||||
|
|
||||||
|
wait_start() {
|
||||||
|
for in in {1..10}; do
|
||||||
|
if /usr/bin/curl -s -m 5 -f "http://localhost:${port}/metrics" > /dev/null; then
|
||||||
|
docker_cleanup
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_start() {
|
||||||
|
container_id=$(docker run -d --network mysql-test -e DATA_SOURCE_NAME="root:secret@(mysql-test:3306)/" -p "${port}":"${port}" "${docker_image}")
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_cleanup() {
|
||||||
|
docker kill "${container_id}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$#" -ne 2 ]] ; then
|
||||||
|
echo "Usage: $0 quay.io/prometheus/mysqld-exporter:v0.10.0 9104" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker_start
|
||||||
|
wait_start
|
Reference in New Issue
Block a user