VS 测试步骤无法完成的 Azure 管道

标签 azure visual-studio selenium azure-devops specflow

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

enter image description here

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

enter image description here

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

enter image description here

    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\1\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://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a717f6c697875625a7e7f6c347b606f687f34797577" rel="noreferrer noopener nofollow">[email protected]</a>/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\1\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 并再次运行。这次没有标记错误 ->

enter image description here 但我的测试网站不再工作 -> enter image description here

然后通过运行 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-server-2019)。

关于VS 测试步骤无法完成的 Azure 管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69686562/

相关文章:

php - 如何使用 PHPUnit/Selenium 测试某个元素不存在?

json - 如何使用 JMESPath 列出对象的属性名称?

c# - 禁用超时时 SqlBulkCopy 到 Azure 超时

c# - Azure 移动服务 TableController 不返回内部对象

c# - Visual Studio 未显示 WSL2 启动配置文件

visual-studio - 如何在 Visual Studio 2013 中使用 Bower 作为包管理器? IE。我有一个 .NET 项目,想添加一些使用 Bower 的包

azure - Azure 网站升级时会发生什么情况?

c# - 我在 Chrome 中不断收到错误 : HTTP Error 403. 14 - 禁止使用 Web 应用程序 Visual Studio 2012

Python Selenium - 高亮元素不做任何事情

selenium - 在 Selenium Grid AWS Fargate 设置中安装/dev/shm 卷的替代方案