Skip to content

[dash0] frontend: convert k8s resource detector from ts to js #49

[dash0] frontend: convert k8s resource detector from ts to js

[dash0] frontend: convert k8s resource detector from ts to js #49

Workflow file for this run

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
name: Build and Push Images
on:
push:
paths:
- 'src/**'
- 'test/**'
workflow_call:
inputs:
push:
description: Should the images be pushed
default: false
required: false
type: boolean
version:
description: The version used when tagging the image
default: 'dev'
required: false
type: string
workflow_dispatch:
jobs:
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
AWS_ECR_REPO: "718306648796.dkr.ecr.us-west-2.amazonaws.com/opentelemetry-demo"
strategy:
fail-fast: false
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
setup-qemu: true
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
setup-qemu: false
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
setup-qemu: true
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
setup-qemu: true
- file: ./src/emailservice/Dockerfile
tag_suffix: emailservice
context: ./src/emailservice
setup-qemu: true
- file: ./src/ffspostgres/Dockerfile
tag_suffix: ffspostgres
context: ./
setup-qemu: true
# NOTE:
# https://github.com/open-telemetry/opentelemetry-demo/issues/956
# Until dedicated ARM runners are available for GHA we cannot upgrade
# OTP/Elixir versions. Please do not change the OTP/Elixir versions.
- file: ./src/featureflagservice/Dockerfile
tag_suffix: featureflagservice
context: ./
setup-qemu: true
- file: ./src/frontend/Dockerfile
tag_suffix: frontend
context: ./
setup-qemu: true
- file: ./src/frontendproxy/Dockerfile
tag_suffix: frontendproxy
context: ./
setup-qemu: true
- file: ./src/loadgenerator/Dockerfile
tag_suffix: loadgenerator
context: ./
setup-qemu: true
- file: ./src/paymentservice/Dockerfile
tag_suffix: paymentservice
context: ./
setup-qemu: true
- file: ./src/productcatalogservice/Dockerfile
tag_suffix: productcatalogservice
context: ./
setup-qemu: true
- file: ./src/quoteservice/Dockerfile
tag_suffix: quoteservice
context: ./
setup-qemu: true
- file: ./src/shippingservice/Dockerfile
tag_suffix: shippingservice
context: ./
setup-qemu: true
- file: ./src/recommendationservice/Dockerfile
tag_suffix: recommendationservice
context: ./
setup-qemu: true
- file: ./src/kafka/Dockerfile
tag_suffix: kafka
context: ./
setup-qemu: true
- file: ./src/accountingservice/Dockerfile
tag_suffix: accountingservice
context: ./
setup-qemu: true
- file: ./src/frauddetectionservice/Dockerfile
tag_suffix: frauddetectionservice
context: ./
setup-qemu: true
- file: ./src/frontend/Dockerfile.cypress
tag_suffix: frontend-tests
context: ./
setup-qemu: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes and set push options
id: check_changes
run: |
DOCKERFILE_DIR=$(dirname ${{ matrix.file_tag.file }})
FILES_CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- $DOCKERFILE_DIR)
FORCE_PUSH=${{ inputs.push }}
if [ "$FORCE_PUSH" = true ]; then
echo "Force push is enabled, proceeding with build."
echo "skip=false" >> "$GITHUB_OUTPUT"
elif [ -z "$FILES_CHANGED" ]; then
echo "No changes in ${{ matrix.file_tag.context }}, skipping build."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Changes detected in ${{ matrix.file_tag.context }}, proceeding with build."
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{secrets.DEPLOYMENT_WRITE_ECR_ACCESS_KEY}}
aws-secret-access-key: ${{secrets.DEPLOYMENT_WRITE_ECR_SECRET_ACCESS_KEY}}
aws-region: us-west-2
mask-aws-account-id: true
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: true
- name: Set up QEMU
if: ${{ matrix.file_tag.setup-qemu }}
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Matrix Build and push demo images
if: steps.check_changes.outputs.skip == 'false'
uses: docker/[email protected]
with:
context: ${{ matrix.file_tag.context }}
file: ${{ matrix.file_tag.file }}
platforms: linux/amd64,linux/arm64
push: ${{ inputs.push }}
tags: |
${{ env.AWS_ECR_REPO }}:${{ inputs.version }}-${{ matrix.file_tag.tag_suffix }}
${{ env.AWS_ECR_REPO }}:latest-${{ matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha