在 Azure Pipelines 托管的 Linux 代理上运行 Cypress.io

编程入门 行业动态 更新时间:2024-10-28 15:26:59
本文介绍了在 Azure Pipelines 托管的 Linux 代理上运行 Cypress.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Azure Pipelines 的托管 Linux 池上运行 Cypress 测试.不幸的是,托管代理没有安装 Cypress 的所有依赖项.

I'm trying to run Cypress tests on the Hosted Linux Pool for Azure Pipelines. Unfortunately, the Hosted Agent doesn't have all the dependencies for Cypress installed.

运行记录的 apt-get 不起作用:

Running the documented apt-get doesn't work:

2018-05-18T21:03:14.7423331Z ##[section]Starting: Install cypress dependencies
2018-05-18T21:03:14.7474742Z ==============================================================================
2018-05-18T21:03:14.7488281Z Task         : Bash
2018-05-18T21:03:14.7501148Z Description  : This is an early preview. Run a Bash script on macOS, Linux, or Windows
2018-05-18T21:03:14.7513088Z Version      : 3.127.0
2018-05-18T21:03:14.7524823Z Author       : Microsoft Corporation
2018-05-18T21:03:14.7537179Z Help         : [More Information](https://go.microsoft/fwlink/?LinkID=613738)
2018-05-18T21:03:14.7549730Z ==============================================================================
2018-05-18T21:03:15.0174503Z Generating script.
2018-05-18T21:03:15.0535056Z Script contents:
2018-05-18T21:03:15.0547355Z apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
2018-05-18T21:03:15.0656822Z [command]/bin/bash --noprofile --norc /opt/vsts/work/_temp/cac4d3f9-42e7-49f3-94f6-7d0444827d83.sh
2018-05-18T21:03:15.6040707Z Reading package lists...
2018-05-18T21:03:15.6085335Z Building dependency tree...
2018-05-18T21:03:15.6153815Z Reading state information...
2018-05-18T21:03:15.6186788Z Package libgconf-2-4 is not available, but is referred to by another package.
2018-05-18T21:03:15.6198707Z This may mean that the package is missing, has been obsoleted, or
2018-05-18T21:03:15.6211380Z is only available from another source
2018-05-18T21:03:15.6216969Z 
2018-05-18T21:03:15.6229592Z E: Unable to locate package xvfb
2018-05-18T21:03:15.6242128Z E: Unable to locate package libnotify-dev
2018-05-18T21:03:15.6254440Z E: Package 'libgconf-2-4' has no installation candidate
2018-05-18T21:03:15.6268141Z E: Unable to locate package libxss1
2018-05-18T21:03:15.6370826Z ##[error]Bash exited with code '100'.
2018-05-18T21:03:15.7283047Z ##[section]Finishing: Install cypress dependencies

运行 apt-get update 需要很长时间(25 分钟,但仍未完成).

Running apt-get update takes forever (25 minutes and still not done).

欢迎提供有关如何让 Cypress 在托管代理上快速工作的任何线索.

Any clues on how to get Cypress working quickly on the Hosted Agent is welcome.

注意:我尝试在 Windows 上运行,幸运的是,它可以工作,所以我没有完全被阻止.但是为了使用 Windows 代理,我现在有 2 个代理阶段,由于人工制品下载和 npm 安装开销,这会增加开销.

Note: I tried running on Windows, that works, fortunately, so I'm not completely blocked. But to use the Windows Agent I now have 2 agent phases which adds overhead due to artefact downloads and npm install overhead.

推荐答案

在运行 Cypress 之前,在 VSTS 代理阶段使用预先挂起的 Shell (Bash) 任务解决了该问题:

Solved the issue using a pre-pended Shell (Bash) task in VSTS agent phase prior to running Cypress:

apt-get -qq -y update
apt-get -qq -y install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

这篇关于在 Azure Pipelines 托管的 Linux 代理上运行 Cypress.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-31 08:44:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/800698.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Pipelines   Azure   Linux   io   Cypress

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!