如何在 Linux 容器中运行 .NET Core 解决方案的 SonarQube 分析?

2024-02-17

我想在 Linux 容器中运行 SonarQube 分析他们的新支持 https://www.nuget.org/packages/dotnet-sonarscanner用于 dotnet 全局工具。我想知道在这种情况下配置(服务器 URL、用户凭据)位于哪里?


这对我来说很有效:

FROM microsoft/dotnet:2.1.300-sdk

RUN apt-get update && apt-get install -y openjdk-8-jre

RUN dotnet tool install --global dotnet-sonarscanner --version 4.3.1
COPY SonarQube.Analysis.xml /root/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/SonarQube.Analysis.xml
ENV PATH="/root/.dotnet/tools:${PATH}"

RUN dotnet sonarscanner begin /k:project-key
RUN dotnet build
RUN dotnet sonarscanner end

显然,它需要在以下环境中构建:SonarQube.Analysis.xml文件存在。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Linux 容器中运行 .NET Core 解决方案的 SonarQube 分析? 的相关文章

随机推荐