Skip to content

Commit

Permalink
Migrate Docker CI tools workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
carles-grafana committed Dec 16, 2024
1 parent 90b2ac5 commit c1f3cb9
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,41 @@ concurrency:
group: "${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true

permissions:
contents: read
id-token: write

jobs:

get-image-tag:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: get-tag
run: echo "TAG=$(./tools/image-tag)" >> "$GITHUB_OUTPUT"

docker-ci-tools:
needs: get-image-tag
strategy:
matrix:
runner_arch: [ { runner: ubuntu-24.04, arch: amd64 }, { runner: github-hosted-ubuntu-arm64, arch: arm64 } ]
runs-on: ${{ matrix.runner_arch.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: grafana/shared-workflows/actions/[email protected]

- name: docker-build-and-push
run: |
TAG_ARCH="${{ needs.get-image-tag.outputs.TAG }}-${{ matrix.runner_arch.arch }}"
docker build -f tools/Dockerfile -t $IMAGE_NAME:TAG_ARCH .
#docker push $IMAGE_NAME:TAG_ARCH

lint:
name: Lint
runs-on: ubuntu-latest
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/docker-ci-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: docker-ci-tools
on:
push:
branches:
- 'main'
paths:
- 'tools/**'

env:
IMAGE_NAME: grafana/tempo-ci-tools

# Needed to login to DockerHub
permissions:
contents: read
id-token: write

jobs:

get-image-tag:
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4

- id: get-tag
run: |
echo "tag=$(./tools/image-tag)" >> "$GITHUB_OUTPUT"
docker-ci-tools:
needs: get-image-tag
strategy:
matrix:
runner_arch: [ { runner: ubuntu-24.04, arch: amd64 }, { runner: github-hosted-ubuntu-arm64, arch: arm64 } ]
runs-on: ${{ matrix.runner_arch.runner }}
env:
TAG: ${{ needs.get-image-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: grafana/shared-workflows/actions/[email protected]

- name: docker-build-and-push
run: |
TAG_ARCH="$TAG-${{ matrix.runner_arch.arch }}"
docker build -f tools/Dockerfile -t $IMAGE_NAME:$TAG_ARCH .
docker push $IMAGE_NAME:$TAG_ARCH
manifest:
needs: ['get-image-tag', 'docker-ci-tools']
runs-on: ubuntu-latest
env:
TAG: ${{ needs.get-image-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: grafana/shared-workflows/actions/[email protected]

- name: docker-manifest-create-and-push
run: |
docker manifest create \
$IMAGE_NAME:$TAG \
--amend $IMAGE_NAME:$TAG-amd64 \
--amend $IMAGE_NAME:$TAG-arm64
docker manifest push $IMAGE_NAME:$TAG
docker manifest create \
$IMAGE_NAME:latest \
--amend $IMAGE_NAME:$TAG-amd64 \
--amend $IMAGE_NAME:$TAG-arm64
docker manifest push $IMAGE_NAME:latest

0 comments on commit c1f3cb9

Please sign in to comment.