Skip to content

Commit 4e3e79c

Browse files
authored
[chore] Build and publish application hosted in the repository for the DotNet instrumentation E2E test (#2082)
* Build and publish the DotNet E2E image Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Build the image for linux/arm64,linux/amd64,linux/s390x and linux/ppc64le Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Remove the application and generate it from the CLI Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix architectures Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix the tags Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix tag for E2E Golang application Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix tag Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix tag Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Make the workflow reusable Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix name Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Remove deps Signed-off-by: Israel Blancas <iblancasa@gmail.com> --------- Signed-off-by: Israel Blancas <iblancasa@gmail.com>
1 parent b9a701e commit 4e3e79c

File tree

3 files changed

+85
-44
lines changed

3 files changed

+85
-44
lines changed

.github/workflows/publish-autoinstrumentation-e2e-images.yaml

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,12 @@ concurrency:
1919

2020
jobs:
2121
golang:
22-
runs-on: ubuntu-20.04
23-
24-
steps:
25-
- uses: actions/checkout@v4
26-
27-
- name: Docker meta
28-
id: meta
29-
uses: docker/metadata-action@v5
30-
with:
31-
images: |
32-
ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-golang
33-
tags: |
34-
type=ref,event=branch
35-
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
38-
39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
41-
42-
- name: Cache Docker layers
43-
uses: actions/cache@v3
44-
with:
45-
path: /tmp/.buildx-cache
46-
key: ${{ runner.os }}-buildx-${{ github.sha }}
47-
restore-keys: |
48-
${{ runner.os }}-buildx-
49-
50-
- name: Login to GitHub Package Registry
51-
uses: docker/login-action@v3
52-
with:
53-
registry: ghcr.io
54-
username: ${{ github.repository_owner }}
55-
password: ${{ secrets.GITHUB_TOKEN }}
56-
57-
- name: Build and push
58-
uses: docker/build-push-action@v5
59-
with:
60-
tags: ${{ steps.meta.outputs.tags }}
61-
context: tests/instrumentation-e2e-apps/golang
62-
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
63-
push: ${{ github.event_name == 'push' }}
64-
cache-from: type=local,src=/tmp/.buildx-cache
65-
cache-to: type=local,dest=/tmp/.buildx-cache
22+
uses: ./.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml
23+
with:
24+
language: golang
25+
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
26+
dotnet:
27+
uses: ./.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml
28+
with:
29+
language: dotnet
30+
platforms: linux/arm64,linux/amd64
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Reusable - Publish autoinstrumentation E2E images
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
language:
7+
type: string
8+
required: true
9+
platforms:
10+
type: string
11+
required: true
12+
13+
jobs:
14+
publish-e2e-image:
15+
runs-on: ubuntu-20.04
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Docker meta
21+
id: meta
22+
uses: docker/metadata-action@v5
23+
with:
24+
images: |
25+
ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-${{ inputs.language }}
26+
tags: |
27+
type=ref,event=branch
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Cache Docker layers
36+
uses: actions/cache@v3
37+
with:
38+
path: /tmp/.buildx-cache
39+
key: ${{ runner.os }}-buildx-${{ github.sha }}
40+
restore-keys: |
41+
${{ runner.os }}-buildx-
42+
43+
- name: Login to GitHub Package Registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.repository_owner }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v5
52+
with:
53+
tags: ${{ steps.meta.outputs.tags }}
54+
context: tests/instrumentation-e2e-apps/${{ inputs.language }}
55+
platforms: ${{ inputs.platforms }}
56+
push: ${{ github.event_name == 'push' }}
57+
cache-from: type=local,src=/tmp/.buildx-cache
58+
cache-to: type=local,dest=/tmp/.buildx-cache
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0.400-bookworm-slim-amd64 AS build
2+
ARG TARGETARCH
3+
WORKDIR /source
4+
5+
RUN dotnet new webapp -o MyWebApp --no-https -f net7.0
6+
7+
WORKDIR /source/MyWebApp
8+
RUN dotnet publish -a $TARGETARCH -o /app
9+
10+
FROM mcr.microsoft.com/dotnet/aspnet:7.0.10-bullseye-slim
11+
12+
ENV DOTNET_ROLL_FORWARD=Major
13+
ENV DOTNET_ROLL_FORWARD_PRE_RELEASE=1
14+
15+
WORKDIR /app
16+
COPY --from=build /app/ .
17+
18+
ENTRYPOINT ["./MyWebApp"]

0 commit comments

Comments
 (0)