Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET9 support - use Ubuntu 16.04 for native code compilation #3791

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build on Centos Native Container
name: Build on Ubuntu 16.04 Native Container

on:
workflow_call:
Expand All @@ -8,7 +8,7 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1

jobs:
build-centos-native-container:
build-ubuntu1604-native-container:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
Expand All @@ -23,14 +23,14 @@ jobs:
- name: Build native library in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/centos.dockerfile" ./docker
docker build -t mybuildimage -f "./docker/ubuntu1604.dockerfile" ./docker
docker run -e OS_TYPE=linux-glibc --rm --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project mybuildimage \
/bin/sh -c 'git config --global --add safe.directory /project && ./build.sh BuildNativeWorkflow'
/bin/sh -c 'export PATH="$PATH:/usr/share/dotnet" && git config --global --add safe.directory /project && ./build.sh BuildNativeWorkflow'

- name: Publish native library Linux build
if: (${{ job.status }} != 'cancelled')
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # tag: v4.4.3
with:
name: bin-centos-native
name: bin-ubuntu1604-native
path: bin/tracer-home
continue-on-error: true
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ jobs:
- name: Run BuildWorkflow
run: ./build.cmd BuildWorkflow --no-restore ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}

- name: Download native CentOS Artifacts from build job
- name: Download native Ubuntu 16.04 Artifacts from build job
if: ${{ matrix.machine == 'ubuntu-20.04' }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-centos-native
path: bin/ci-artifacts/bin-centos-native
name: bin-ubuntu1604-native
path: bin/ci-artifacts/bin-ubuntu1604-native

- name: Replace Ubuntu native code by Centos artifacts
- name: Replace Ubuntu native code by Ubuntu 16.04 artifacts
if: ${{ matrix.machine == 'ubuntu-20.04' }}
run: |
rm ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
cp ./bin/ci-artifacts/bin-centos-native/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
cp ./bin/ci-artifacts/bin-ubuntu1604-native/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so

- name: Install MacOS CoreUtils
if: ${{ runner.os == 'macOS' }}
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/build_and_push_image.yml

This file was deleted.

10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
build-container:
uses: ./.github/workflows/build-container.yml

build-centos-native:
uses: ./.github/workflows/build-centos-native-container.yml
build-ubuntu1604-native:
uses: ./.github/workflows/build-ubuntu1604-native-container.yml

build:
needs: build-centos-native
needs: build-ubuntu1604-native
uses: ./.github/workflows/build.yml

build-nuget-packages:
Expand Down Expand Up @@ -211,10 +211,6 @@ jobs:
base-image: alpine
build-source: alpine-x64
os-type: linux-musl
- machine: ubuntu-20.04
base-image: centos
build-source: ubuntu-20.04
os-type: linux-glibc
- machine: ubuntu-20.04
base-image: debian
build-source: ubuntu-20.04
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ jobs:
- machine: ubuntu-20.04
base-image: alpine
net-version: net8.0
- machine: ubuntu-20.04
base-image: centos
net-version: net7.0
- machine: otel-linux-arm64
base-image: alpine
net-version: net8.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
build-container:
uses: ./.github/workflows/build-container.yml

build-centos-native:
uses: ./.github/workflows/build-centos-native-container.yml
build-ubuntu1604-native:
uses: ./.github/workflows/build-ubuntu1604-native-container.yml

build:
needs: build-centos-native
needs: build-ubuntu1604-native
uses: ./.github/workflows/build.yml

build-nuget-packages:
Expand Down
10 changes: 0 additions & 10 deletions build/Extensions/DotNetSettingsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,7 @@ public static DotNetMSBuildSettings SetFilter(this DotNetMSBuildSettings setting
public static DotNetBuildSettings[] CombineWithBuildInfos(this DotNetBuildSettings settings, IReadOnlyCollection<PackageBuildInfo> buildInfos, TargetFramework targetFramework)
{
// NOTE: SetProperty creates internally a new instance!
#if NET7_0
// workaround for building on Centos. It should be removed when we drop support for .NET6/.NET7. ETA November 2024
return settings.CombineWith(buildInfos.Where(buildInfo => (targetFramework == TargetFramework.NOT_SPECIFIED || buildInfo.SupportedFrameworks.Length == 0 || buildInfo.SupportedFrameworks.Contains(targetFramework)) && !buildInfo.SupportedFrameworks.Contains(TargetFramework.NET8_0)), (p, buildInfo) =>
#else
return settings.CombineWith(buildInfos.Where(buildInfo => targetFramework == TargetFramework.NOT_SPECIFIED || buildInfo.SupportedFrameworks.Length == 0 || buildInfo.SupportedFrameworks.Contains(targetFramework)), (p, buildInfo) =>
#endif
{
p = p.SetProperty("LibraryVersion", buildInfo.LibraryVersion);

Expand All @@ -100,12 +95,7 @@ public static DotNetBuildSettings[] CombineWithBuildInfos(this DotNetBuildSettin
public static DotNetRestoreSettings[] CombineWithBuildInfos(this DotNetRestoreSettings settings, IReadOnlyCollection<PackageBuildInfo> buildInfos)
{
// NOTE: SetProperty creates internally a new instance!
#if NET7_0
// workaround for building on Centos. It should be removed when we drop support for .NET6/.NET7. ETA November 2024
return settings.CombineWith(buildInfos.Where(buildInfo => !buildInfo.SupportedFrameworks.Contains(TargetFramework.NET8_0)), (p, buildInfo) =>
#else
return settings.CombineWith(buildInfos, (p, buildInfo) =>
#endif
{
p = p.SetProperty("LibraryVersion", buildInfo.LibraryVersion);

Expand Down
3 changes: 1 addition & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework Condition=" '$(IsCentos)' == '' ">net8.0</TargetFramework>
<TargetFramework Condition=" '$(IsCentos)' != '' ">net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..\</NukeRootDirectory>
Expand Down
27 changes: 0 additions & 27 deletions docker/centos-build.dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/centos.dockerfile

This file was deleted.

41 changes: 41 additions & 0 deletions docker/ubuntu1604.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:16.04@sha256:1f1a2d56de1d604801a9671f301190704c25d604a416f59e03c04f5c6ffee0d6

RUN apt-get update && \
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
git \
build-essential software-properties-common \
gnupg \
libicu-dev

# Install newer clang
RUN apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" && \
apt-get update && \
apt-get install -y --allow-unauthenticated clang-5.0 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 1000 && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 1000 && \
update-alternatives --config clang && \
update-alternatives --config clang++

# Install newer g++
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
apt-get install -y g++-9 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9

# Install newer cmake, based on https://apt.kitware.com/
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ xenial main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update && \
apt-get install -y --allow-unauthenticated cmake

RUN curl -sSL https://dot.net/v1/dotnet-install.sh --output dotnet-install.sh \
&& echo "SHA256: $(sha256sum dotnet-install.sh)" \
&& echo "c169af55281cd1e58cdbe3ec95c2480cfb210ee460b3ff1421745c8f3236b263 dotnet-install.sh" | sha256sum -c \
&& chmod +x ./dotnet-install.sh \
&& ./dotnet-install.sh -v 8.0.403 --install-dir /usr/share/dotnet --no-path \
&& rm dotnet-install.sh

WORKDIR /project
5 changes: 0 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,12 @@ Supported processor architectures are:
- AMD64 (x86-64)
- ARM64 ([Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md))

> [!NOTE]
> ARM64 build does not support CentOS based images.

CI tests run against the following operating systems:

- [Alpine x64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/alpine.dockerfile)
- [Alpine ARM64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/alpine.dockerfile)
- [Debian x64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/debian.dockerfile)
- [Debian ARM64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/debian-arm64.dockerfile)
- [CentOS 7 x64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/centos-build.dockerfile)
(.NET 8 is not supported)
- [CentOS Stream 9 x64](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docker/centos-stream9.dockerfile)
- [macOS Ventura 13 x64](https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md)
- [Microsoft Windows Server 2022 x64](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md)
Expand Down
1 change: 0 additions & 1 deletion docs/internal/version-bump.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This section describes dependencies that require a periodical version bump.
| .NET SDK | `(CI templates)` | Manual | Search for `actions/setup-dotnet` or `dotnetSdkVersion:` |
| GitHub CI OS | `./github/workflows/*.yml` | Manual | Search for `runs-on:` |
| APK | `alpine.dockerfile` | Manual | Search for `apk add` |
| YUM | `centos*.dockerfile` | Manual | Search for `yum -y install` |

## Tracked by checksum

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<RootNamespace>Examples.AspNetCoreMvc</RootNamespace>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<PropertyGroup>
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true'">$(DefineConstants);DEFAULT_TEST_PACKAGE_VERSIONS</DefineConstants>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>

<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions test/test-applications/integrations/Integrations.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project>
<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>

<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- SA1518 needed for files generated by Grpc.Tools -->
<NoWarn>SA1518;$(NoWarn)</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<DefineConstants Condition="'$(LibraryVersion)' == '' or '$(LibraryVersion)'>='7.7.0'">$(DefineConstants);GRAPHQL_7_7_OR_GREATER</DefineConstants>
</PropertyGroup>

Expand Down
Loading
Loading