Build ARM container images (#242)

It also updates the Circle CI configuration to use the
Prometheus orb.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2019-07-02 14:09:42 +02:00 committed by GitHub
parent 611dd8c60a
commit eb51631f33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 77 deletions

View file

@ -1,6 +1,9 @@
---
version: 2.1
orbs:
prometheus: prometheus/prometheus@0.1.0
executors:
# Whenever the Go version is updated here, .travis.yml and .promu.yml
# should also be updated.
@ -13,80 +16,11 @@ jobs:
executor: golang
steps:
- checkout
- run: make promu
- prometheus/setup_environment
- run: make
- run: git diff --exit-code
- store_artifacts:
path: statsd_exporter
destination: /build/statsd_exporter
- run: rm -v statsd_exporter
build:
machine: true
steps:
- checkout
- run: make promu
- run: promu crossbuild -v
- persist_to_workspace:
root: .
paths:
- .build
- store_artifacts:
path: .build
destination: /build
docker_hub_master:
executor: golang
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: .
- run: ln -s .build/linux-amd64/statsd_exporter statsd_exporter
- run: make docker
- run: make docker DOCKER_REPO=quay.io/prometheus
- run: docker images
- run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
- run: make docker-publish
- run: make docker-publish DOCKER_REPO=quay.io/prometheus
docker_hub_release_tags:
executor: golang
steps:
- checkout
- setup_remote_docker
- 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/statsd_exporter statsd_exporter
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG DOCKER_REPO=quay.io/prometheus
- run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
- run: make docker-publish DOCKER_IMAGE_TAG="$CIRCLE_TAG"
- run: make docker-publish DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus
- run: make docker-manifest DOCKER_IMAGE_TAG="$CIRCLE_TAG"
- run: make docker-manifest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus
- run: |
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG"
make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus
make docker-publish DOCKER_IMAGE_TAG="latest"
make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=quay.io/prometheus
make docker-manifest DOCKER_IMAGE_TAG="latest"
make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=quay.io/prometheus
fi
- prometheus/store_artifact:
file: statsd_exporter
workflows:
version: 2
@ -96,11 +30,12 @@ workflows:
filters:
tags:
only: /.*/
- build:
- prometheus/build:
name: build
filters:
tags:
only: /.*/
- docker_hub_master:
- prometheus/publish_master:
context: org-context
requires:
- test
@ -108,7 +43,7 @@ workflows:
filters:
branches:
only: master
- docker_hub_release_tags:
- prometheus/publish_release:
context: org-context
requires:
- test

View file

@ -2,3 +2,5 @@
.tarballs/
!.build/linux-amd64
!.build/linux-armv7
!.build/linux-arm64

View file

@ -1,7 +1,11 @@
FROM quay.io/prometheus/busybox:latest
ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
COPY statsd_exporter /bin/statsd_exporter
ARG ARCH="amd64"
ARG OS="linux"
COPY .build/${OS}-${ARCH}/statsd_exporter /bin/statsd_exporter
USER nobody
EXPOSE 9102 9125 9125/udp

View file

@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Needs to be defined before including Makefile.common to auto-generate targets
DOCKER_ARCHS ?= amd64 armv7 arm64
include Makefile.common
STATICCHECK_IGNORE =