Search code examples
cypressartifactory

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

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 X.Y.Z and not cypress.zip and fail. Apparently I can't rename binaries in artifactory. It seems to have made it available in a name X.Y.Z instead of 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

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...

Debug logs

Installing Cypress (version: 6.8.0)

× Downloading Cypress → Cypress Version: 6.8.0 Unzipping Cypress Finishing Installation The Cypress App could not be downloaded.

Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: 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

npm

Operating System

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 ^^


Solution

  • I was able to make it work on Windows using the following:

    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).

    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).

    In the .npmrc I simply provided the following: CYPRESS_DOWNLOAD_MIRROR=https://user:myverystrongpassword@myartifactory/artifactory/generic-cypress-windows