简体   繁体   English

使用 Artifactory 通过 CYPRESS_DOWNLOAD_MIRROR 代理 Cypress

[英]Using Artifactory to proxy Cypress with CYPRESS_DOWNLOAD_MIRROR

Desired behavior期望的行为

I would like to use CYPRESS_DOWNLOAD_MIRROR pointing toward my artifactory configuration for Cypress and just be able to do npm install and download library AND binary of Cypress我想使用 CYPRESS_DOWNLOAD_MIRROR 指向我的赛普拉斯工件配置,并且能够执行 npm 安装和下载赛普拉斯的库和二进制文件

Current behavior当前行为

When setting Cypress in artifactory, and downloading it with CYPRESS_DOWNLOAD_MIRROR set toward this tool, the download script find binary files as XYZ and not cypress.zip and fail.在工件中设置赛普拉斯,并使用设置为该工具的 CYPRESS_DOWNLOAD_MIRROR 下载它时,下载脚本会发现二进制文件为 XYZ 而不是 cypress.zip 并失败。 Apparently I can't rename binaries in artifactory.显然我无法重命名工件中的二进制文件。 It seems to have made it available in a name XYZ instead of cypress.zip它似乎以 XYZ 的名称而不是 cypress.zip 的形式提供

My artifactory admin tell me to do this command before but I can't since it's a post action of Cypress curl –v « https://artifactory.mycompany.fr/artifactory/remote-download.cypress-generic/desktop/6.8.0?platform=win32&arch=x64 » > cypress.zip我的工件管理员之前告诉我执行此命令,但我不能,因为它是 Cypress curl –v « https://artifactory.mycompany.fr/artifactory/remote-download.cypress-generic/desk 的后操作。 0?platform=win32&arch=x64 » > cypress.zip

Workaround解决方法

For now, I'm using CYPRESS_INSTALL_BINARY to point to a manually uploaded binary in artifactory but it's a pain because I have to separate Linux binary (for CI) and Windows binary (for dev) and if my package is configured with "cypress": "^6.2.1" the npm library will go to 6.2.1 and my binary will stuck to 6.2.0 for example... For now, I'm using CYPRESS_INSTALL_BINARY to point to a manually uploaded binary in artifactory but it's a pain because I have to separate Linux binary (for CI) and Windows binary (for dev) and if my package is configured with "cypress": “^6.2.1” npm 库将 go 到 6.2.1,我的二进制文件将坚持到 6.2.0 例如...

Debug logs调试日志

Installing Cypress (version: 6.8.0)安装赛普拉斯(版本:6.8.0)

× Downloading Cypress → Cypress Version: 6.8.0 Unzipping Cypress Finishing Installation The Cypress App could not be downloaded. × 下载 Cypress → Cypress 版本:6.8.0 解压 Cypress 完成安装 无法下载 Cypress App。

Does your workplace require a proxy to be used to access the Internet?您的工作场所是否需要使用代理来访问 Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress.如果是这样,您必须在下载赛普拉斯之前配置 HTTP_PROXY 环境变量。 Read more: https://on.cypress.io/proxy-configuration阅读更多: https://on.cypress.io/proxy-configuration

Otherwise, please check network connectivity and try again:否则,请检查网络连接并重试:

URL: https://artifactory.mycompany.fr/artifactory/remote-download.cypress.io/desktop/6.8.0?platform=win32&arch=x64 Error: self signed certificate in certificate chain Download method URL: https://artifactory.mycompany.fr/artifactory/remote-download.cypress.io/desktop/6.8.0?platform=win32&arch=x64错误:证书链中的自签名证书下载方法

npm

Operating System操作系统

Linux Linux

Windows

Other其他

I'm behind a proxy

I don't really know if it's an artifactory or a Cypress matter but I need help ^^我真的不知道这是神器还是柏树问题,但我需要帮助^^

In addition to accepted answer, it is possible to replace pre-defined 'Query Params' with enabling 'Propagate Query Params'.除了接受的答案外,还可以将预定义的“查询参数”替换为启用“传播查询参数”。 If set, the query params passed with the request to Artifactory, will be passed on to the remote repo.如果设置,则与请求一起传递给 Artifactory 的查询参数将传递给远程仓库。

Please note, according to JFrog docs , this setting is only available for Generic type repositories.请注意,根据JFrog 文档,此设置仅适用于通用类型存储库。

I was able to make it work on Windows using the following:我能够使用以下方法使其在 Windows 上工作:

I created a generic remote repository, making sure it is pointing to https://download.cypress.io , and under the advanced tab, added the query params: platform=win32&arch=x64 (notice there is a dedicated field for it).我创建了一个通用远程存储库,确保它指向https://download.cypress.io ,并在高级选项卡下,添加了查询参数:platform=win32&arch=x64(注意有一个专用字段)。

The above is required in order to cache the correct binary based on the OS and arch (you might require a different remote repository with different query params).为了根据操作系统和架构缓存正确的二进制文件,上述内容是必需的(您可能需要具有不同查询参数的不同远程存储库)。 I found it on Cypress doc that these query params control the binary type which will be downloaded (so we need to make sure it fits the client os and arch).我在 Cypress 文档上发现这些查询参数控制将下载的二进制类型(因此我们需要确保它适合客户端操作系统和架构)。

In the.npmrc I simply provided the following: CYPRESS_DOWNLOAD_MIRROR=https://user:myverystrongpassword@myartifactory/artifactory/generic-cypress-windows在 .npmrc 中,我简单地提供了以下内容:CYPRESS_DOWNLOAD_MIRROR=https://user:myverystrongpassword@myartifactory/artifactory/generic-cypress-windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM