diff --git a/.github/workflows/publish-autoinstrumentation-dotnet.yaml b/.github/workflows/publish-autoinstrumentation-dotnet.yaml new file mode 100644 index 0000000000..0abcb9a366 --- /dev/null +++ b/.github/workflows/publish-autoinstrumentation-dotnet.yaml @@ -0,0 +1,65 @@ +name: "Publish DotNet Auto-Instrumentation" + +on: + push: + paths: + - 'autoinstrumentation/dotnet/**' + - '.github/workflows/publish-autoinstrumentation-dotnet.yaml' + branches: + - main + pull_request: + paths: + - 'autoinstrumentation/dotnet/**' + - '.github/workflows/publish-autoinstrumentation-dotnet.yaml' + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - name: Read version + run: echo "VERSION=$(cat autoinstrumentation/dotnet/version.txt)" >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4.0.1 + with: + images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet + tags: | + type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.0.0 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Login to GitHub Package Registry + uses: docker/login-action@v2.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3.0.0 + with: + context: autoinstrumentation/dotnet + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name == 'push' }} + build-args: version=${{ env.VERSION }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file diff --git a/autoinstrumentation/dotnet/Dockerfile b/autoinstrumentation/dotnet/Dockerfile new file mode 100644 index 0000000000..af31050341 --- /dev/null +++ b/autoinstrumentation/dotnet/Dockerfile @@ -0,0 +1,20 @@ +# To build one auto-instrumentation image for dotnet, please: +# - Download your dotnet auto-instrumentation artefacts to `/autoinstrumentation` directory. This is required as when instrumenting the pod, +# one init container will be created to copy the files to your app's container. +# - Grant the necessary access to the files in the `/autoinstrumentation` directory. +# - Following environment variables are injected to the application container to enable the auto-instrumentation. +# DOTNET_ADDITIONAL_DEPS=%InstallationLocation%/AdditionalDeps +# DOTNET_SHARED_STORE=%InstallationLocation%/store +# DOTNET_STARTUP_HOOKS=%InstallationLocation%/netcoreapp3.1/OpenTelemetry.AutoInstrumentation.StartupHook.dll + +FROM busybox + +ARG version + +WORKDIR /autoinstrumentation + +ADD https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/v$version/opentelemetry-dotnet-instrumentation-linux-glibc.zip . + +RUN unzip opentelemetry-dotnet-instrumentation-linux-glibc.zip + +RUN chmod -R go+r . \ No newline at end of file diff --git a/autoinstrumentation/dotnet/version.txt b/autoinstrumentation/dotnet/version.txt new file mode 100644 index 0000000000..d76821f8c2 --- /dev/null +++ b/autoinstrumentation/dotnet/version.txt @@ -0,0 +1 @@ +0.2.0-beta.1 \ No newline at end of file