mirror of
https://github.com/bloomberg/goldpinger.git
synced 2026-05-06 00:36:42 +00:00
Provide Windows builds and refactor CI
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
This commit is contained in:
72
.github/workflows/main.yml
vendored
72
.github/workflows/main.yml
vendored
@@ -2,19 +2,24 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.21
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
# local build
|
||||
- name: Compile the binary
|
||||
@@ -28,26 +33,51 @@ jobs:
|
||||
make build
|
||||
docker run `make version` --help
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
# multi-arch build
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
bake-target: docker-metadata-action
|
||||
images: |
|
||||
${{ github.repository_owner }}/goldpinger
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ github.repository }}
|
||||
org.opencontainers.image.description=Goldpinger makes calls between its instances to monitor your networking. It runs as a DaemonSet on Kubernetes and produces Prometheus metrics that can be scraped, visualised and alerted on.
|
||||
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||
|
||||
- name: Build regular image
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/bake-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
target: simple
|
||||
- name: Build vendor image
|
||||
id: docker_build_vendor
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
flavor: |
|
||||
suffix: -vendor,onlatest=false
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
target: vendor
|
||||
targets: ci
|
||||
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
${{ steps.meta.outputs.bake-file }}
|
||||
|
||||
# https://github.com/docker/buildx/issues/2105
|
||||
- name: Create manifest
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
set -xe
|
||||
for image in $images; do
|
||||
docker buildx imagetools create -t "${image}" "${image}-linux" "${image}-windows-ltsc2019" "${image}-windows-ltsc2022"
|
||||
done
|
||||
env:
|
||||
images: "${{ join( steps.meta.outputs.tags, ' ') }}"
|
||||
|
||||
55
.github/workflows/publish.yml
vendored
55
.github/workflows/publish.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
# Publish `v*` tags as releases.
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- 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
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: bloomberg/goldpinger
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
target: simple
|
||||
- name: Build and push vendor
|
||||
id: docker_build_vendor
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
flavor: |
|
||||
suffix: -vendor,onlatest=false
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}-vendor
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
target: vendor
|
||||
Reference in New Issue
Block a user