Skip to content
Snippets Groups Projects
Commit 824dc556 authored by Ericon Freeman's avatar Ericon Freeman Committed by Oliver
Browse files

delete extra code

parent 163559ba
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,9 +2,9 @@
version: 2
jobs:
 
run-tests:
tests:
docker:
- image: circleci/golang:1.10-stretch
- image: golang:1.10
- image: redis:4.0.10
- image: redis:4.0.10
command: --port 6380
Loading
Loading
@@ -29,33 +29,49 @@ jobs:
- run: bash <(curl -s https://codecov.io/bash)
 
 
build-and-release:
build:
docker:
- image: circleci/golang:1.10-stretch
- image: golang:1.10
 
working_directory: /go/src/github.com/oliver006/redis_exporter
environment:
GO_LDFLAGS: '-extldflags "-static" -X main.VERSION=$CIRCLE_TAG -X main.COMMIT_SHA1=$CIRCLE_SHA1 -X main.BUILD_DATE=$(date +%F-%T)'
 
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Install utilities
command: |
apt-get update
apt-get install -y zip
- run:
- run: go get github.com/mitchellh/gox
- run: go get github.com/tcnksm/ghr
name: Install Docker client
command: |
set -x
VER="18.03.1-ce"
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run: ./build.sh
 
 
workflows:
version: 2
test-and-release-on-tags:
test-build-and-release:
jobs:
- run-tests
- build-and-release:
- tests:
filters:
tags:
only: /.*/
- build:
requires:
- run-tests
- tests
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
tags:
only:
- /v.*/
FROM gliderlabs/alpine
MAINTAINER Oliver <oliver@21zoo.com>
#
# build container
#
FROM golang:1.10
WORKDIR /go/src/github.com/oliver006/redis_exporter/
 
COPY dist/redis_exporter /bin/redis_exporter
ADD main.go /go/src/github.com/oliver006/redis_exporter/
ADD exporter /go/src/github.com/oliver006/redis_exporter/exporter
ADD vendor /go/src/github.com/oliver006/redis_exporter/vendor
ARG SHA1
ENV SHA1=$SHA1
ARG TAG
ENV TAG=$TAG
ARG DATE
ENV DATE=$DATE
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags " -X main.VERSION=$TAG -X main.COMMIT_SHA1=$SHA1 -X main.BUILD_DATE=$DATE " -a -installsuffix cgo -o redis_exporter .
#
# release container
#
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /bin/
COPY --from=0 /go/src/github.com/oliver006/redis_exporter/ .
 
EXPOSE 9121
ENTRYPOINT [ "/bin/redis_exporter" ]
Loading
Loading
@@ -137,3 +137,4 @@ Grafana dashboard with host & alias selector is available on [github.com](contri
### What else?
 
Open an issue or PR if you have more suggestions or ideas about what to add.
#!/usr/bin/env bash
 
export CGO_ENABLED=0
gox --osarch="linux/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter"
echo "Build Docker images"
 
docker version
 
echo "docker login"
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker info
echo "docker login done"
 
docker build --rm=false -t "21zoo/redis_exporter:$CIRCLE_TAG" .
docker build --rm=false -t "21zoo/redis_exporter:latest" .
export BUILD_ARGS="--rm=false --build-arg TAG=${CIRCLE_TAG} --build-arg SHA1=${CIRCLE_SHA1} --build-arg DATE=$(date +%F-%T)"
echo "BUILD_ARGS: $BUILD_ARGS"
docker build -t "21zoo/redis_exporter:$CIRCLE_TAG" $BUILD_ARGS .
docker push "21zoo/redis_exporter:$CIRCLE_TAG"
 
docker push "21zoo/redis_exporter:latest"
docker push "21zoo/redis_exporter:$CIRCLE_TAG"
docker build -t "21zoo/redis_exporter:latest" $BUILD_ARGS .
docker push "21zoo/redis_exporter:latest"
 
docker build --rm=false -t "oliver006/redis_exporter:$CIRCLE_TAG" .
docker build --rm=false -t "oliver006/redis_exporter:latest" .
docker push "oliver006/redis_exporter:latest"
docker push "oliver006/redis_exporter:$CIRCLE_TAG"
docker build -t "oliver006/redis_exporter:$CIRCLE_TAG" $BUILD_ARGS .
docker push "oliver006/redis_exporter:$CIRCLE_TAG"
 
docker build -t "oliver006/redis_exporter:latest" $BUILD_ARGS .
docker push "oliver006/redis_exporter:latest"
 
 
echo "Building binaries"
echo "Building binaries for Github"
echo ""
echo $GO_LDFLAGS
export CGO_ENABLED=0
export GO_LDFLAGS="-extldflags \"-static\" -X main.VERSION=$CIRCLE_TAG -X main.COMMIT_SHA1=$CIRCLE_SHA1 -X main.BUILD_DATE=$(date +%F-%T)"
echo "GO_LDFLAGS: $GO_LDFLAGS"
go get github.com/mitchellh/gox
go get github.com/tcnksm/ghr
 
gox -rebuild --osarch="darwin/amd64" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.darwin-amd64.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="darwin/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.darwin-386.tar.gz redis_exporter && rm redis_exporter && cd ..
Loading
Loading
Loading
Loading
@@ -200,11 +200,6 @@ func (e *Exporter) initGauges() {
Name: "slowlog_length",
Help: "Total slowlog",
}, []string{"addr", "alias"})
e.metrics["total_system_memory"] = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: e.namespace,
Name: "total_system_memory",
Help: "Total System Memory in this host",
}, []string{"addr", "alias"})
}
 
// splitKeyArgs splits a command-line supplied argument into a slice of dbKeyPairs.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment