带有 VS 测试步骤的 Azure 管道未能完成

Azure pipeline with VS Test step failing to complete

我有一个 azure 管道,现在我添加了一个 Visual Studio 步骤后它失败了。在此之前,管道可以使用 Ubuntu-20.04 作为代理正常完成。现在我想 运行 selenium 测试作为管道的一部分 ->

然后我在部署代码之前将 VS 步骤添加到 运行 Selenium 测试 ->

我将代理设置为 vs2017-win2016 但每次 运行 我都会收到此错误 ->

    Starting: Spice buildAndPush
==============================================================================
Task         : Docker
Description  : Build or push Docker images, login or logout, start or stop containers, or run a Docker command
Version      : 2.192.0
Author       : Microsoft Corporation
Help         : https://aka.ms/azpipes-docker-tsg
==============================================================================
"C:\Program Files\Docker\docker.exe" pull mcr.microsoft.com/dotnet/aspnet:3.1
3.1: Pulling from dotnet/aspnet
no matching manifest for windows/amd64 10.0.14393 in the manifest list entries
"C:\Program Files\Docker\docker.exe" inspect mcr.microsoft.com/dotnet/aspnet:3.1
Error: No such object: mcr.microsoft.com/dotnet/aspnet:3.1
[]
"C:\Program Files\Docker\docker.exe" build -f D:\a\s\spicetheworld\Dockerfile --label com.azure.dev.image.system.teamfoundationcollectionuri=https://dev.azure.com/kevsbox/ --label com.azure.dev.image.system.teamproject=spicetheworld --label com.azure.dev.image.build.repository.name=spicetheworld --label com.azure.dev.image.build.sourceversion=fa0c5f9183c04296b6c1a33acbcc312cc2ffae50 --label com.azure.dev.image.build.repository.uri=https://kevsbox@dev.azure.com/kevsbox/spicetheworld/_git/spicetheworld --label com.azure.dev.image.build.sourcebranchname=development --label com.azure.dev.image.build.definitionname=SpiceThis --label com.azure.dev.image.build.buildnumber=20211022.8 --label com.azure.dev.image.build.builduri=vstfs:///Build/Build/201 --label image.base.ref.name=mcr.microsoft.com/dotnet/aspnet:3.1 -t ***/spicedevrepository:latest D:\a\s\spicetheworld
Sending build context to Docker daemon   12.9MB

Step 1/27 : FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
3.1: Pulling from dotnet/aspnet
no matching manifest for windows/amd64 10.0.14393 in the manifest list entries
##[error]The process 'C:\Program Files\Docker\docker.exe' failed with exit code 1
Finishing: Spice buildAndPush

所以我又将代理更改为 windows-2019 并再次 运行。这次没有错误标记 ->

但我的测试网站不再工作 ->

然后 运行 将 Ubuntu 管道修复。我正在使用 VS 2019、Selenium 4.0.0、NUnit 3.13.3、Specflow 3.9.22

这是最后一步中使用的Docker文件

FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["spicetheworld.csproj", "./"]
RUN dotnet restore "spicetheworld.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "spicetheworld.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "spicetheworld.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "spicetheworld.dll"]

所以有人知道我哪里出错了吗?

根据您的限制,您可以尝试在管道中将 Visual Studio 测试分离到它自己的工作中,这样您就可以 运行 windows-server-2019 上的测试代理,同时仍在单独的作业中使用 Ubuntu 代理构建应用程序。一项工作 运行 在 Ubuntu 上执行您的原始构建步骤(最初工作的是什么),然后是 运行 Visual Studio 任务(windows-服务器)的第二项工作-2019).