Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
puckpuck authored Sep 18, 2023
2 parents 2915dc8 + a650002 commit 7500c66
Show file tree
Hide file tree
Showing 165 changed files with 29,232 additions and 12,908 deletions.
12 changes: 7 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@


# Images
IMAGE_VERSION=1.4.0
IMAGE_VERSION=1.5.0
IMAGE_NAME=ghcr.io/open-telemetry/demo

# Demo Platform
ENV_PLATFORM=local

# OpenTelemetry Collector
OTEL_COLLECTOR_HOST=otelcol
OTEL_COLLECTOR_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT}
PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces
OTEL_COLLECTOR_PORT_GRPC=4317
OTEL_COLLECTOR_PORT_HTTP=4318
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:8080/otlp-http/v1/traces

# OpenTelemetry Resource Definitions
OTEL_RESOURCE_ATTRIBUTES="service.namespace=opentelemetry-demo"
Expand Down Expand Up @@ -56,11 +57,12 @@ FRONTEND_ADDR=frontend:${FRONTEND_PORT}
# Frontend Proxy (Envoy)
FRONTEND_HOST=frontend
ENVOY_PORT=8080
FRONTEND_PROXY_ADDR=frontend-proxy:${ENVOY_PORT}

# Load Generator
LOCUST_WEB_PORT=8089
LOCUST_USERS=10
LOCUST_HOST=http://${FRONTEND_ADDR}
LOCUST_HOST=http://${FRONTEND_PROXY_ADDR}
LOCUST_WEB_HOST=loadgenerator
LOCUST_AUTOSTART=true
LOCUST_HEADLESS=false
Expand Down
156 changes: 156 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

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

jobs:
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
DOCKERHUB_REPO: "otel/demo"
GHCR_REPO: "ghcr.io/open-telemetry/demo"

strategy:
fail-fast: false
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
- file: ./src/emailservice/Dockerfile
tag_suffix: emailservice
context: ./src/emailservice
# 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: ./
- file: ./src/frontend/Dockerfile
tag_suffix: frontend
context: ./
- file: ./src/frontendproxy/Dockerfile
tag_suffix: frontendproxy
context: ./
- file: ./src/loadgenerator/Dockerfile
tag_suffix: loadgenerator
context: ./
- file: ./src/paymentservice/Dockerfile
tag_suffix: paymentservice
context: ./
- file: ./src/productcatalogservice/Dockerfile
tag_suffix: productcatalogservice
context: ./
- file: ./src/quoteservice/Dockerfile
tag_suffix: quoteservice
context: ./
- file: ./src/shippingservice/Dockerfile
tag_suffix: shippingservice
context: ./
- file: ./src/recommendationservice/Dockerfile
tag_suffix: recommendationservice
context: ./
- file: ./src/kafka/Dockerfile
tag_suffix: kafka
context: ./
- file: ./src/accountingservice/Dockerfile
tag_suffix: accountingservice
context: ./
- file: ./src/frauddetectionservice/Dockerfile
tag_suffix: frauddetectionservice
context: ./
- file: ./src/frontend/Dockerfile.cypress
tag_suffix: frontend-tests
context: ./
- file: ./test/Dockerfile
tag_suffix: integrationTests
context: ./

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for file changes
id: check_changes
if: ${{ !inputs.push }}
run: |
DOCKERFILE_DIR=$(dirname ${{ matrix.file_tag.file }})
FILES_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- $DOCKERFILE_DIR)
if [ -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: Override skip for push
if: ${{ inputs.push }}
run: echo "skip=false" >> "$GITHUB_OUTPUT"
id: override_skip
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ inputs.push }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ inputs.push }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Matrix Build and push demo images
if: steps.check_changes.outputs.skip == 'false' || steps.override_skip.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.DOCKERHUB_REPO }}:${{ inputs.version }}-${{matrix.file_tag.tag_suffix }}
${{ env.GHCR_REPO }}:${{ inputs.version }}-${{ matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha
9 changes: 9 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
name: Checks

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build_images:
uses: ./.github/workflows/build-images.yml
with:
push: false
version: dev

markdownlint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: gradle/wrapper-validation-action@v1.0.6
- uses: gradle/wrapper-validation-action@v1.1.0
118 changes: 5 additions & 113 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,116 +8,8 @@ on:

jobs:
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
DOCKERHUB_REPO: "otel/demo"
GHCR_REPO: "ghcr.io/open-telemetry/demo"

strategy:
matrix:
file_tag:
- file: ./src/adservice/Dockerfile
tag_suffix: adservice
context: ./
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
context: ./
- file: ./src/checkoutservice/Dockerfile
tag_suffix: checkoutservice
context: ./
- file: ./src/currencyservice/Dockerfile
tag_suffix: currencyservice
context: ./src/currencyservice
- file: ./src/emailservice/Dockerfile
tag_suffix: emailservice
context: ./src/emailservice
- file: ./src/featureflagservice/Dockerfile
tag_suffix: featureflagservice
context: ./
- file: ./src/frontend/Dockerfile
tag_suffix: frontend
context: ./
- file: ./src/frontendproxy/Dockerfile
tag_suffix: frontendproxy
context: ./
- file: ./src/loadgenerator/Dockerfile
tag_suffix: loadgenerator
context: ./
- file: ./src/paymentservice/Dockerfile
tag_suffix: paymentservice
context: ./
- file: ./src/productcatalogservice/Dockerfile
tag_suffix: productcatalogservice
context: ./
- file: ./src/quoteservice/Dockerfile
tag_suffix: quoteservice
context: ./
- file: ./src/shippingservice/Dockerfile
tag_suffix: shippingservice
context: ./
- file: ./src/recommendationservice/Dockerfile
tag_suffix: recommendationservice
context: ./
- file: ./src/kafka/Dockerfile
tag_suffix: kafka
context: ./
- file: ./src/accountingservice/Dockerfile
tag_suffix: accountingservice
context: ./
- file: ./src/frauddetectionservice/Dockerfile
tag_suffix: frauddetectionservice
context: ./
- file: ./src/frontend/Dockerfile.cypress
tag_suffix: frontend-tests
context: ./
- file: ./test/Dockerfile
tag_suffix: integrationTests
context: ./

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name != 'pull_request'

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name != 'pull_request'

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 2
- name: Matrix Build and push demo images
uses: docker/[email protected]
with:
context: ${{ matrix.file_tag.context }}
file: ${{ matrix.file_tag.file }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{matrix.file_tag.tag_suffix }}
${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{ matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha
uses: ./.github/workflows/build-images.yml
with:
push: true
version: ${{ github.event.release.tag_name }}
secrets: inherit
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ src/frontend/cypress/screenshots
src/shippingservice/target/

# Ignore copied/generated protobuf files
/src/accountingservice/genproto/
/src/cartservice/src/protos/
/src/checkoutservice/genproto/
/src/featureflagservice/proto/
/src/featureflagservice/src/ffs_demo_pb.erl
/src/featureflagservice/src/ffs_service_*.erl
/src/featureflagservice/src/oteldemo_*.erl
/src/frauddetectionservice/src/main/proto
/src/frontend/pb/
/src/frontend/protos/
/src/paymentservice/demo.proto
/src/productcatalogservice/genproto/
/src/recommendationservice/demo_pb2*.py
/src/shippingservice/proto/
10 changes: 9 additions & 1 deletion .licenserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
"# Copyright The OpenTelemetry Authors",
"# SPDX-License-Identifier: Apache-2.0"
],
"**/*.{ex,exs,rb,yaml,yml,sh,yamllint}": [
"**/*.sh": [
"#!/bin/sh",
"# Copyright The OpenTelemetry Authors",
"# SPDX-License-Identifier: Apache-2.0"
],
"**/*.{ex,exs,rb,yaml,yml,yamllint}": [
"# Copyright The OpenTelemetry Authors",
"# SPDX-License-Identifier: Apache-2.0"
],
Expand All @@ -29,10 +34,13 @@
],
"ignore": [
"node_modules/",
"src/accountingservice/genproto/",
"src/cartservice/src/obj/",
"src/cartservice/tests/obj/",
"src/checkoutservice/genproto/",
"src/featureflagservice/assets/vendor/",
"src/featureflagservice/priv/",
"src/productcatalogservice/genproto/",
"internal/tools/"
]
}
Loading

0 comments on commit 7500c66

Please sign in to comment.