Cypress: Enable CYPRESS_DOWNLOAD_MIRROR to be used with a static file server

Created on 13 Sep 2019  路  6Comments  路  Source: cypress-io/cypress

Current behavior:

When CYPRESS_DOWNLOAD_MIRROR is specified Cypress will download the binaries from something like https://whatever/desktop?platform=OS&arch=ARCH.

This means we cannot serve these binaries from a static file server. Because of the query parameters.

Desired behavior:

Change the API so that the file gets downloaded from something like https://whatever/desktop/platform/:platform/arch/:arc/cypress.zip.

Such an API can easily be implemented with a simple static file server. Something that is usually easy to setup in corporate environments.

Steps to reproduce: (app code and test code)

  1. Set CYPRESS_DOWNLOAD_MIRROR to point at a static file server.
  2. Try to create files on this server that will implement the API so that Cypress will use linux binary when on Linux and Windows binary when on Windows.

Versions

3.4.1

proposal 馃挕 installation

Most helpful comment

I also "think" it is likely possible, but not easy. And I think it should be easy as I think it is part of solving a very common problem.

This would solve the problem reported in #5036 where users are working on mixed platforms. Some will need the Windows binary and some the Linux binary. With this we could just set the version in package.json and have this mirror in .npmrc and then the current implementation will pick the binary fit for the current platform.

Edit: It is not easy for me to convince the operations team that they should host a binary file, with a cryptic filename, and make it available from everywhere. And tell them they should do so because I just started using a new trendy tool I found on the Internet.

All 6 comments

@tomasbjerre it wouldn't be pretty, but I think you can still name your static files/folders with the query param strings. Let me know if that works for you. However I do agree changing this would make it much easier

I also "think" it is likely possible, but not easy. And I think it should be easy as I think it is part of solving a very common problem.

This would solve the problem reported in #5036 where users are working on mixed platforms. Some will need the Windows binary and some the Linux binary. With this we could just set the version in package.json and have this mirror in .npmrc and then the current implementation will pick the binary fit for the current platform.

Edit: It is not easy for me to convince the operations team that they should host a binary file, with a cryptic filename, and make it available from everywhere. And tell them they should do so because I just started using a new trendy tool I found on the Internet.

@Bkucera just curious if the source code for the download server is available so one could easily host it in a corporate environment?

Same. I need to run Cypress on a private network that has a private proxied npm registry with no access to the outside world. The docs mention running a local mirror but no mention of how to do that

I created a tool to deal with this problem:
https://github.com/tomasbjerre/dictator-cypress-example

You would need to clone this repository and publish your own cypress-dictator to your private npm repository:
https://github.com/tomasbjerre/dictator-cypress

It uses dictator builder to, before npm install, copy platform specific zip-files to root of repository and make sure it is pointed at by .npmrc.

{
  "message": "Copy linux cypress to cypress.zip",
  "triggers": [
    {
      "runningOnPlatform": ["linux"]
    }
  ],
  "actions": [
    {
      "copyFrom": "linux-x64.zip",
      "target": "cypress.zip"
    }
  ]
}
Was this page helpful?
0 / 5 - 0 ratings