Skip to content

Commit

Permalink
Add workflow to publish images to artifact registry
Browse files Browse the repository at this point in the history
  • Loading branch information
damemi committed Feb 10, 2025
1 parent ecdf430 commit b7385f2
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/publish-modules-artifactregistry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Publish Images to Artifact Registry

on:
push:
tags:
- "v*"

jobs:

publish-docker-images:
strategy:
matrix:
dockerfile: ['Dockerfile', 'Dockerfile.rhel']
service: ['autoscaler', 'scheduler', 'instrumentor', 'collector', 'odiglet', 'ui']
include:
- service: autoscaler
runner: ubuntu-latest
summary: "Autoscaler for Odigos"
description: "Autoscaler manages the installation of Odigos components."
- service: scheduler
runner: ubuntu-latest
summary: "Scheduler for Odigos"
description: "Scheduler manages the installation of OpenTelemetry Collectors with Odigos."
- service: instrumentor
runner: ubuntu-latest
summary: "Instrumentor for Odigos"
description: "Instrumentor manages auto-instrumentation for workloads with Odigos."
- service: collector
runner: large-runner
summary: "Odigos Collector"
description: "The Odigos build of the OpenTelemetry Collector."
- service: odiglet
runner: ubuntu-latest
summary: "Odiglet for Odigos"
description: "Odiglet is the core component of Odigos managing auto-instrumentation. This image requires a root user to load and manage eBPF programs."
- service: ui
runner: ubuntu-latest
summary: "UI for Odigos"
description: "UI provides the frontend webapp for managing an Odigos installation."
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract Tag
id: extract_tag
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

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

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

- id: gcp-auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v0
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
access_token_lifetime: 1200s

- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.gcp-auth.outputs.access_token }}

- name: Build and Push Docker Image for ${{ matrix.service }}
uses: docker/build-push-action@v6
with:
push: true
tags: us-central1-docker.pkg.dev/odigos-cloud/components/odigos-${{ matrix.service }}${{ matrix.dockerfile == 'Dockerfile.rhel' && '-ubi9' || '' }}:${{ steps.extract_tag.outputs.tag }}
build-args: |
SERVICE_NAME=${{ matrix.service }}
ODIGOS_VERSION=${{ steps.extract_tag.outputs.tag }}
RELEASE=${{ steps.extract_tag.outputs.tag }}
VERSION=${{ steps.extract_tag.outputs.tag }}
SUMMARY=${{ matrix.summary }}
DESCRIPTION=${{ matrix.description }}
platforms: linux/amd64,linux/arm64
file: >-
${{ matrix.service == 'odiglet' && format('odiglet/{0}', matrix.dockerfile) ||
matrix.service == 'collector' && format('collector/{0}', matrix.dockerfile) ||
matrix.service == 'ui' && format('frontend/{0}', matrix.dockerfile) ||
matrix.dockerfile }}
context: >-
${{
(matrix.service == 'collector' && 'collector') ||
'.'
}}

0 comments on commit b7385f2

Please sign in to comment.