-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add container automation for autoinstrumentation.
For use with the OpenTelemetry k8s Operator
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ jobs: | |
outputs: | ||
agent-version: ${{ steps.bootstrap.outputs.agent-version }} | ||
major-version: ${{ steps.bootstrap.outputs.major-version }} | ||
env: | ||
DOCKER_IMAGE_NAME: "docker.elastic.co/observability/elastic-otel-dotnet" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Bootstrap Action Workspace | ||
|
@@ -57,6 +59,47 @@ jobs: | |
- name: Release to Nuget (only for release events) | ||
if: ${{ github.event_name == 'release' }} | ||
run: dotnet nuget push '${{ env.RELEASE_PACKAGES }}' -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols | ||
|
||
- name: Log in to the Elastic Container registry | ||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | ||
with: | ||
registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} | ||
username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} | ||
password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) | ||
id: docker-meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: ${{ env.DOCKER_IMAGE_NAME }} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
# "1.2.3" and "latest" Docker tags on push of git tag "v1.2.3" | ||
type=semver,pattern={{version}},value=${{ steps.bootstrap.outputs.agent-version }} | ||
# "edge" Docker tag on git push to default branch | ||
type=edge | ||
- name: Build and Push Profiler Docker Image | ||
id: docker-push | ||
continue-on-error: true # continue for now until we see it working in action | ||
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 | ||
with: | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.docker-meta.outputs.tags }} | ||
labels: ${{ steps.docker-meta.outputs.labels }} | ||
|
||
- name: Attest image | ||
uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3 | ||
continue-on-error: true # continue for now until we see it working in action | ||
with: | ||
subject-name: ${{ env.DOCKER_IMAGE_NAME }} | ||
subject-digest: ${{ steps.docker-push.outputs.digest }} | ||
push-to-registry: true | ||
|
||
- if: ${{ success() && github.event_name == 'release' }} | ||
uses: elastic/oblt-actions/slack/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Based on the opentelemetry dotnet operator image: | ||
# https://github.com/open-telemetry/opentelemetry-operator/blob/main/autoinstrumentation/dotnet/Dockerfile | ||
# To build locally you need to call: | ||
# - ./build.sh redistribute | ||
# This ensures the distribution is locally available under .artifacts/elastic-distribution | ||
|
||
FROM busybox as downloader | ||
|
||
WORKDIR /autoinstrumentation | ||
|
||
COPY ".artifacts/elastic-distribution/elastic-dotnet-instrumentation-linux-glibc-x64.zip" . | ||
COPY ".artifacts/elastic-distribution/elastic-dotnet-instrumentation-linux-musl-x64.zip" . | ||
|
||
RUN unzip elastic-dotnet-instrumentation-linux-glibc-x64.zip &&\ | ||
unzip elastic-dotnet-instrumentation-linux-musl-x64.zip "linux-musl-x64/*" -d . &&\ | ||
rm elastic-dotnet-instrumentation-linux-glibc-x64.zip elastic-dotnet-instrumentation-linux-musl-x64.zip &&\ | ||
chmod -R go+r . | ||
|
||
FROM busybox | ||
|
||
COPY --from=downloader /autoinstrumentation /autoinstrumentation |