Joh*_*ars 3 continuous-integration azure-devops azure-pipelines azure-aks
我有一个 VS 2019 解决方案,其中包含三个已签入 Git 存储库的 .Net Core 3.x Web Api 项目。
我通过针对我的 Azure AKS 集群的向导在 Azure DevOps 中创建了一个构建管道。
创建了以下管道 YAML 文件。
运行此管道时,当它尝试复制 Web API 项目文件(如下面的日志中所述)时,我收到以下异常。
Step 6/38 : COPY ["BoundedContexts/BC1/API/NextWare.AppBuilder.BC1.API.csproj", "BoundedContexts/BC1/API/"]
COPY failed: stat /var/lib/docker/tmp/docker-builder568816228/BoundedContexts/BC1/API/NextWare.AppBuilder.BC1.API.csproj: no such file or directory
Run Code Online (Sandbox Code Playgroud)
该文件位于存储库中,可通过 Azure DevOps 中的存储库查看器查看
这是 Azure DevOps 管道中失败的 docker 文件...
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["BoundedContexts/BC1/API/NextWare.AppBuilder.BC1.API.csproj", "BoundedContexts/BC1/API/"]
COPY ["Infrastructure/NextWare.Infrastructure.EventStore/NextWare.Infrastructure.EventStore.csproj", "Infrastructure/NextWare.Infrastructure.EventStore/"]
COPY ["Infrastructure/NextWare.Infrastructure/NextWare.Infrastructure.csproj", "Infrastructure/NextWare.Infrastructure/"]
COPY ["Infrastructure/NextWare.Infrastructure.EventBus/NextWare.Infrastructure.EventBus.csproj", "Infrastructure/NextWare.Infrastructure.EventBus/"]
COPY ["Infrastructure/NextWare.Infrastructure.EventBus.RabbitMQ/NextWare.Infrastructure.EventBus.RabbitMQ.csproj", "Infrastructure/NextWare.Infrastructure.EventBus.RabbitMQ/"]
COPY ["Infrastructure/NextWare.Infrastructure.Resilience/NextWare.Infrastructure.Resilience.csproj", "Infrastructure/NextWare.Infrastructure.Resilience/"]
COPY ["BoundedContexts/BC1/DomainExceptions/NextWare.AppBuilder.BC1.Domain.Exceptions.csproj", "BoundedContexts/BC1/DomainExceptions/"]
COPY ["BoundedContexts/SharedKernel/NextWare.AppBuilder.SharedKernel.Domain.csproj", "BoundedContexts/SharedKernel/"]
COPY ["Infrastructure/NextWare.Infrastructure.EventBus.ServiceBus/NextWare.Infrastructure.EventBus.ServiceBus.csproj", "Infrastructure/NextWare.Infrastructure.EventBus.ServiceBus/"]
COPY ["BoundedContexts/BC1/Application/NextWare.AppBuilder.BC1.Application.csproj", "BoundedContexts/BC1/Application/"]
COPY ["BoundedContexts/BC1/Infrastructure/NextWare.AppBuilder.BC1.Domain.Infrastructure.csproj", "BoundedContexts/BC1/Infrastructure/"]
COPY ["BoundedContexts/BC1/Domain/NextWare.AppBuilder.BC1.Domain.csproj", "BoundedContexts/BC1/Domain/"]
COPY ["BoundedContexts/SharedServices/Domain/NextWare.AppBuilder.SharedServices.Domain.csproj", "BoundedContexts/SharedServices/Domain/"]
COPY ["BoundedContexts/SharedServices/DomainExceptions/NextWare.AppBuilder.SharedServices.Domain.Exceptions.csproj", "BoundedContexts/SharedServices/DomainExceptions/"]
COPY ["Infrastructure/NextWare.Infrastructure.WebHost/NextWare.Infrastructure.WebHost.csproj", "Infrastructure/NextWare.Infrastructure.WebHost/"]
COPY ["Infrastructure/NextWare.Infrastructure.EventBus.Kafka/NextWare.Infrastructure.EventBus.Kafka.csproj", "Infrastructure/NextWare.Infrastructure.EventBus.Kafka/"]
RUN dotnet restore "BoundedContexts/BC1/API/NextWare.AppBuilder.BC1.API.csproj"
COPY . .
WORKDIR "/src/BoundedContexts/BC1/API"
RUN dotnet build "NextWare.AppBuilder.BC1.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NextWare.AppBuilder.BC1.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NextWare.AppBuilder.BC1.API.dll"]
Run Code Online (Sandbox Code Playgroud)
我能够在本地开发环境中的 Windows 版 Docker 中构建并运行此解决方案。
为什么我会收到此错误?
尝试将第 34 行Docker 任务的输入设置buildContext$(Build.Repository.LocalPath)为。如果您有多个存储库,请尝试$(Pipeline.Workspace)(参考:Azure Pipelines 预定义变量)
当我在构建上下文文件夹结构时遇到问题时,有时我只是在开始时将一些shell 脚本ls扔到某些文件夹或运行tree,以便我可以看到结构。
| 归档时间: |
|
| 查看次数: |
5215 次 |
| 最近记录: |