Skip to content

Commit dceed97

Browse files
authored
ARM64 builds (#448)
1 parent 4b0b910 commit dceed97

15 files changed

+390
-60
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,20 @@ jobs:
7474
strategy:
7575
fail-fast: false
7676
matrix:
77-
base-image: [ alpine ]
78-
runs-on: ubuntu-20.04
77+
include:
78+
- machine: ubuntu-20.04
79+
base-image: alpine-x64
80+
os-type: linux-musl
81+
# architecture: "x64"
82+
- machine: [self-hosted, Linux, ARM64]
83+
base-image: alpine-arm64
84+
os-type: linux-musl
85+
# architecture: "arm64"
86+
- machine: [self-hosted, Linux, ARM64]
87+
base-image: debian-arm64
88+
os-type: linux-glibc
89+
# architecture: "arm64"
90+
runs-on: ${{ matrix.machine }}
7991
timeout-minutes: 60
8092
steps:
8193
- uses: actions/[email protected]
@@ -90,22 +102,23 @@ jobs:
90102
- name: Build in Docker container
91103
run: |
92104
docker run --rm \
93-
-e OS_TYPE=linux-musl --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project \
105+
-e OS_TYPE=${{ matrix.os-type }} --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project \
94106
splunk-otel-dotnet/${{ matrix.base-image }} \
95107
/bin/sh -c 'git config --global --add safe.directory /project && ./build.sh Workflow'
96108
- name: Test the Shell scripts from README.md in Docker container
97109
run: |
98110
set -e
99111
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" .
100-
docker run --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
112+
docker run -e OTEL_DOTNET_AUTO_LOG_DIRECTORY=/home/user/opentelemetry/log/dotnet --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
101113
set -e
102114
dotnet publish -f net8.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke
103115
export OTEL_DOTNET_AUTO_HOME="${PWD}/OpenTelemetryDistribution"
104116
. ./instrument.sh
105117
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net8.0/publish/TestApplication.Smoke
106-
test "$(ls -A /var/log/opentelemetry/dotnet )"
118+
test "$(ls -A /home/user/opentelemetry/log )"
107119
'
108120
- uses: actions/[email protected]
121+
if: (${{ job.status }} != 'cancelled')
109122
with:
110123
name: bin-${{ matrix.base-image }}
111124
path: bin/splunk-*.zip
@@ -168,8 +181,10 @@ jobs:
168181
- uses: actions/[email protected]
169182
with:
170183
path: .
171-
- run: cp bin-alpine/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl-x64.zip
184+
- run: cp bin-alpine-x64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl-x64.zip
185+
- run: cp bin-alpine-arm64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl-arm64.zip
172186
- run: cp bin-ubuntu-20.04/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-glibc-x64.zip
187+
- run: cp bin-debian-arm64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-glibc-arm64.zip
173188
- run: cp bin-windows-2022/splunk-*.zip ./splunk-opentelemetry-dotnet-windows.zip
174189
- run: cp bin-macos-11/splunk-*.zip ./splunk-opentelemetry-dotnet-macos.zip
175190
- run: cp bin-windows-2022/InstallationScripts/splunk-otel-dotnet-install.sh ./splunk-otel-dotnet-install.sh

build/Build.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Nuke.Common.ProjectModel;
44
using Nuke.Common.Tools.DotNet;
55
using System.IO.Compression;
6-
6+
using System.Runtime.InteropServices;
77
using static Nuke.Common.Tools.DotNet.DotNetTasks;
88

99
partial class Build : NukeBuild
@@ -82,9 +82,23 @@ static string GetOTelAutoInstrumentationFileName()
8282
fileName = "opentelemetry-dotnet-instrumentation-windows.zip";
8383
break;
8484
case PlatformFamily.Linux:
85+
var architecture = RuntimeInformation.ProcessArchitecture;
86+
string architectureSuffix;
87+
switch (architecture)
88+
{
89+
case Architecture.Arm64:
90+
architectureSuffix = "arm64";
91+
break;
92+
case Architecture.X64:
93+
architectureSuffix = "x64";
94+
break;
95+
default:
96+
throw new NotSupportedException("Not supported Linux architecture " + architecture);
97+
}
98+
8599
fileName = Environment.GetEnvironmentVariable("IsAlpine") == "true"
86-
? "opentelemetry-dotnet-instrumentation-linux-musl-x64.zip"
87-
: "opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip";
100+
? $"opentelemetry-dotnet-instrumentation-linux-musl-{architectureSuffix}.zip"
101+
: $"opentelemetry-dotnet-instrumentation-linux-glibc-{architectureSuffix}.zip";
88102
break;
89103
case PlatformFamily.OSX:
90104
fileName = "opentelemetry-dotnet-instrumentation-macos.zip";

docker/alpine-arm64.dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0.204-alpine3.18
2+
3+
RUN apk update \
4+
&& apk upgrade \
5+
&& apk add --no-cache --update \
6+
clang=16.0.6-r1 \
7+
cmake=3.26.5-r0 \
8+
make=4.4.1-r1 \
9+
bash=5.2.15-r5 \
10+
alpine-sdk=1.0-r1 \
11+
protobuf=3.21.12-r2 \
12+
protobuf-dev=3.21.12-r2 \
13+
grpc=1.54.2-r0 \
14+
grpc-plugins=1.54.2-r0
15+
16+
ENV IsAlpine=true
17+
ENV PROTOBUF_PROTOC=/usr/bin/protoc
18+
ENV gRPC_PluginFullPath=/usr/bin/grpc_csharp_plugin
19+
20+
# Install older sdks using the install script
21+
RUN curl -sSL https://dot.net/v1/dotnet-install.sh --output dotnet-install.sh \
22+
&& echo "SHA256: $(sha256sum dotnet-install.sh)" \
23+
&& echo "170a3ec239a351f8d7c14bec424b286bd9468f4d928bdb7600f6424ea7f13927 dotnet-install.sh" | sha256sum -c \
24+
&& chmod +x ./dotnet-install.sh \
25+
&& ./dotnet-install.sh -v 6.0.421 --install-dir /usr/share/dotnet --no-path \
26+
&& ./dotnet-install.sh -v 7.0.408 --install-dir /usr/share/dotnet --no-path \
27+
&& rm dotnet-install.sh
28+
29+
# uid 1000 is the uid of the user in our environement
30+
# we should execute build process in the same context
31+
# to have priviliges to modify data
32+
RUN addgroup -S appgroup && adduser -S user -G appgroup -u 1000
33+
USER user
34+
35+
WORKDIR /project
File renamed without changes.

docker/debian-arm64.dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0.204-bookworm-slim
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
cmake \
6+
clang \
7+
make
8+
9+
# Install older sdks using the install script as there are no arm64 SDK packages.
10+
RUN curl -sSL https://dot.net/v1/dotnet-install.sh --output dotnet-install.sh \
11+
&& echo "SHA256: $(sha256sum dotnet-install.sh)" \
12+
&& echo "170a3ec239a351f8d7c14bec424b286bd9468f4d928bdb7600f6424ea7f13927 dotnet-install.sh" | sha256sum -c \
13+
&& chmod +x ./dotnet-install.sh \
14+
&& ./dotnet-install.sh -v 6.0.421 --install-dir /usr/share/dotnet --no-path \
15+
&& ./dotnet-install.sh -v 7.0.408 --install-dir /usr/share/dotnet --no-path \
16+
&& rm dotnet-install.sh
17+
18+
# uid 1000 is the uid of the user in our environement
19+
# we should execute build process in the same context
20+
# to have priviliges to modify data
21+
RUN useradd -m -d /home/user -u 1000 user
22+
USER user
23+
24+
WORKDIR /project

instrument.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ if [ -z "$OS_TYPE" ]; then
2020
esac
2121
fi
2222

23+
# guess OS architecture if not provided
24+
if [ -z "$ARCHITECTURE" ]; then
25+
case $(uname -m) in
26+
x86_64) ARCHITECTURE="x64" ;;
27+
aarch64) ARCHITECTURE="arm64" ;;
28+
esac
29+
fi
30+
31+
# validate architecture
32+
case "$ARCHITECTURE" in
33+
"x64"|"arm64")
34+
;;
35+
*)
36+
echo "Set the architecture type using the ARCHITECTURE environment variable. Supported values: x64, arm64." >&2
37+
return 2
38+
;;
39+
esac
40+
2341
# validate input
2442
case "$OS_TYPE" in
2543
"linux-glibc")
26-
DOTNET_RUNTIME_ID="linux-x64"
44+
DOTNET_RUNTIME_ID="linux-$ARCHITECTURE"
2745
;;
2846
"linux-musl")
29-
DOTNET_RUNTIME_ID="linux-musl-x64"
47+
DOTNET_RUNTIME_ID="linux-musl-$ARCHITECTURE"
3048
;;
3149
"macos")
3250
DOTNET_RUNTIME_ID="osx-x64"

src/Splunk.OpenTelemetry.AutoInstrumentation/Splunk.OpenTelemetry.AutoInstrumentation.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
15+
<!-- Referencing Microsoft.SourceLink.GitHub directly is the workaround for lack of release DotNet.ReproducibleBuilds with 8.0.0 deoendencies. Ref: https://github.com/dotnet/reproducible-builds/pull/35 -->
16+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" >
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
1520
<PackageReference Include="MinVer" Version="5.0.0">
1621
<PrivateAssets>all</PrivateAssets>
1722
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[
2+
/AdditionalDeps/shared/Microsoft.NETCore.App/6.0.0/OpenTelemetry.AutoInstrumentation.AdditionalDeps.deps.json,
3+
/AdditionalDeps/shared/Microsoft.NETCore.App/7.0.0/OpenTelemetry.AutoInstrumentation.AdditionalDeps.deps.json,
4+
/AdditionalDeps/shared/Microsoft.NETCore.App/8.0.0/OpenTelemetry.AutoInstrumentation.AdditionalDeps.deps.json,
5+
/LICENSE,
6+
/instrument.sh,
7+
/linux-musl-arm64/OpenTelemetry.AutoInstrumentation.Native.so,
8+
/net/Google.Protobuf.dll,
9+
/net/Grpc.Core.Api.dll,
10+
/net/Grpc.Net.Client.dll,
11+
/net/Grpc.Net.Common.dll,
12+
/net/Microsoft.Extensions.Diagnostics.Abstractions.dll,
13+
/net/MongoDB.Driver.Core.Extensions.DiagnosticSources.dll,
14+
/net/OpenTelemetry.Api.ProviderBuilderExtensions.dll,
15+
/net/OpenTelemetry.Api.dll,
16+
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.dll,
17+
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.pdb,
18+
/net/OpenTelemetry.AutoInstrumentation.Loader.dll,
19+
/net/OpenTelemetry.AutoInstrumentation.Loader.pdb,
20+
/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll,
21+
/net/OpenTelemetry.AutoInstrumentation.StartupHook.pdb,
22+
/net/OpenTelemetry.AutoInstrumentation.dll,
23+
/net/OpenTelemetry.AutoInstrumentation.pdb,
24+
/net/OpenTelemetry.Exporter.Console.dll,
25+
/net/OpenTelemetry.Exporter.OpenTelemetryProtocol.dll,
26+
/net/OpenTelemetry.Exporter.Prometheus.HttpListener.dll,
27+
/net/OpenTelemetry.Exporter.Zipkin.dll,
28+
/net/OpenTelemetry.Extensions.Propagators.dll,
29+
/net/OpenTelemetry.Instrumentation.AspNetCore.dll,
30+
/net/OpenTelemetry.Instrumentation.EntityFrameworkCore.dll,
31+
/net/OpenTelemetry.Instrumentation.GrpcNetClient.dll,
32+
/net/OpenTelemetry.Instrumentation.Http.dll,
33+
/net/OpenTelemetry.Instrumentation.Process.dll,
34+
/net/OpenTelemetry.Instrumentation.Quartz.dll,
35+
/net/OpenTelemetry.Instrumentation.Runtime.dll,
36+
/net/OpenTelemetry.Instrumentation.SqlClient.dll,
37+
/net/OpenTelemetry.Instrumentation.StackExchangeRedis.dll,
38+
/net/OpenTelemetry.Instrumentation.Wcf.dll,
39+
/net/OpenTelemetry.ResourceDetectors.Azure.dll,
40+
/net/OpenTelemetry.ResourceDetectors.Container.dll,
41+
/net/OpenTelemetry.ResourceDetectors.Host.dll,
42+
/net/OpenTelemetry.ResourceDetectors.Process.dll,
43+
/net/OpenTelemetry.ResourceDetectors.ProcessRuntime.dll,
44+
/net/OpenTelemetry.Shims.OpenTracing.dll,
45+
/net/OpenTelemetry.dll,
46+
/net/OpenTracing.dll,
47+
/net/Splunk.OpenTelemetry.AutoInstrumentation.dll,
48+
/net/System.Private.ServiceModel.dll,
49+
/net/System.Security.Permissions.dll,
50+
/net/System.ServiceModel.Primitives.dll,
51+
/net/System.ServiceModel.dll,
52+
/net/ruleEngine.json,
53+
/store/arm64/net6.0/microsoft.extensions.configuration.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll,
54+
/store/arm64/net6.0/microsoft.extensions.configuration.binder/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Binder.dll,
55+
/store/arm64/net6.0/microsoft.extensions.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.dll,
56+
/store/arm64/net6.0/microsoft.extensions.dependencyinjection.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll,
57+
/store/arm64/net6.0/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll,
58+
/store/arm64/net6.0/microsoft.extensions.logging.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll,
59+
/store/arm64/net6.0/microsoft.extensions.logging.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Configuration.dll,
60+
/store/arm64/net6.0/microsoft.extensions.logging/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.dll,
61+
/store/arm64/net6.0/microsoft.extensions.options.configurationextensions/8.0.0/lib/net8.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll,
62+
/store/arm64/net6.0/microsoft.extensions.options/8.0.0/lib/net8.0/Microsoft.Extensions.Options.dll,
63+
/store/arm64/net6.0/microsoft.extensions.primitives/8.0.0/lib/net8.0/Microsoft.Extensions.Primitives.dll,
64+
/store/arm64/net6.0/system.diagnostics.diagnosticsource/8.0.0/lib/net8.0/System.Diagnostics.DiagnosticSource.dll,
65+
/store/arm64/net7.0/microsoft.extensions.configuration.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll,
66+
/store/arm64/net7.0/microsoft.extensions.configuration.binder/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Binder.dll,
67+
/store/arm64/net7.0/microsoft.extensions.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.dll,
68+
/store/arm64/net7.0/microsoft.extensions.dependencyinjection.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll,
69+
/store/arm64/net7.0/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll,
70+
/store/arm64/net7.0/microsoft.extensions.logging.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll,
71+
/store/arm64/net7.0/microsoft.extensions.logging.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Configuration.dll,
72+
/store/arm64/net7.0/microsoft.extensions.logging/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.dll,
73+
/store/arm64/net7.0/microsoft.extensions.options.configurationextensions/8.0.0/lib/net8.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll,
74+
/store/arm64/net7.0/microsoft.extensions.options/8.0.0/lib/net8.0/Microsoft.Extensions.Options.dll,
75+
/store/arm64/net7.0/microsoft.extensions.primitives/8.0.0/lib/net8.0/Microsoft.Extensions.Primitives.dll,
76+
/store/arm64/net7.0/system.diagnostics.diagnosticsource/8.0.0/lib/net8.0/System.Diagnostics.DiagnosticSource.dll,
77+
/store/arm64/net8.0/microsoft.extensions.configuration.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll,
78+
/store/arm64/net8.0/microsoft.extensions.configuration.binder/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.Binder.dll,
79+
/store/arm64/net8.0/microsoft.extensions.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Configuration.dll,
80+
/store/arm64/net8.0/microsoft.extensions.dependencyinjection.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll,
81+
/store/arm64/net8.0/microsoft.extensions.dependencyinjection/8.0.0/lib/net8.0/Microsoft.Extensions.DependencyInjection.dll,
82+
/store/arm64/net8.0/microsoft.extensions.logging.abstractions/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll,
83+
/store/arm64/net8.0/microsoft.extensions.logging.configuration/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Configuration.dll,
84+
/store/arm64/net8.0/microsoft.extensions.logging/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.dll,
85+
/store/arm64/net8.0/microsoft.extensions.options.configurationextensions/8.0.0/lib/net8.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll,
86+
/store/arm64/net8.0/microsoft.extensions.options/8.0.0/lib/net8.0/Microsoft.Extensions.Options.dll,
87+
/store/arm64/net8.0/microsoft.extensions.primitives/8.0.0/lib/net8.0/Microsoft.Extensions.Primitives.dll
88+
]

0 commit comments

Comments
 (0)