Skip to content

Commit

Permalink
implement github actions
Browse files Browse the repository at this point in the history
- multiarch build
- ci & release pipeline

Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Nov 16, 2020
1 parent 01f3815 commit d4aa528
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "CI: docker build"

on: [pull_request]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag webdevops/azure-metrics-exporter:$(date +%s)
51 changes: 51 additions & 0 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Release: docker"

on:
schedule:
- cron: '0 6 * * 1'
push:
branches:
- '**'
tags:
- '*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: webdevops/azure-metrics-exporter,quay.io/webdevops/azure-metrics-exporter
#tag-sha: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN make dependencies

# Compile
COPY ./ /go/src/github.com/webdevops/azure-metrics-exporter
RUN make test
RUN make lint
RUN make build
RUN ./azure-metrics-exporter --help
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ image: build
build-push-development:
docker build -t webdevops/$(NAME):development . && docker push webdevops/$(NAME):development

test:
go test ./...

.PHONY: lint
lint: $(GOLANGCI_LINT_BIN)
# megacheck fails to respect build flags, causing compilation failure during linting.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Azure Insights metrics exporter
===============================

[![license](https://img.shields.io/github/license/webdevops/azure-metrics-exporter.svg)](https://github.com/webdevops/azure-metrics-exporter/blob/master/LICENSE)
[![Docker](https://img.shields.io/docker/cloud/automated/webdevops/azure-metrics-exporter)](https://hub.docker.com/r/webdevops/azure-metrics-exporter/)
[![Docker Build Status](https://img.shields.io/docker/cloud/build/webdevops/azure-metrics-exporter)](https://hub.docker.com/r/webdevops/azure-metrics-exporter/)
[![DockerHub](https://img.shields.io/badge/DockerHub-webdevops%2Fazure--metrics--exporter-blue)](https://hub.docker.com/r/webdevops/azure-metrics-exporter/)
[![Quay.io](https://img.shields.io/badge/Quay.io-webdevops%2Fazure--metrics--exporter-blue)](https://quay.io/repository/webdevops/azure-metrics-exporter)

Prometheus exporter for Azure Insights metrics (on demand).
Supports metrics fetching from all resource with one scrape (automatic service discovery) and also supports dimensions.
Expand Down

0 comments on commit d4aa528

Please sign in to comment.