Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CYPRESS_DOWNLOAD_MIRROR to be used with a static file server #5141

Closed
tomasbjerre opened this issue Sep 13, 2019 · 10 comments · Fixed by #23194
Closed

Enable CYPRESS_DOWNLOAD_MIRROR to be used with a static file server #5141

tomasbjerre opened this issue Sep 13, 2019 · 10 comments · Fixed by #23194
Labels
topic: installation Issue during installation or downloading Cypress

Comments

@tomasbjerre
Copy link
Contributor

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

@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Sep 13, 2019
@kuceb
Copy link
Contributor

kuceb commented Sep 13, 2019

@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

@tomasbjerre
Copy link
Contributor Author

tomasbjerre commented Sep 13, 2019

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.

@tomasbjerre
Copy link
Contributor Author

@NMinhNguyen
Copy link

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

@ztolley
Copy link

ztolley commented Apr 28, 2020

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

@tomasbjerre
Copy link
Contributor Author

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"
    }
  ]
}

@mattdsteele
Copy link

We also found a way to make this work with static file servers. We're using Artifactory to host these assets, but it should work more generally.

You'll want to download the .zip files and from Cypress, and upload them to your file server with the version number as the filename.

For example:

Then, set CYPRESS_DOWNLOAD_MIRROR based on your OS and architecture; for example:

set CYPRESS_DOWNLOAD_MIRROR https://example.com/artifactory/mirrored-binaries/cypress/win32-x64

@jemerald
Copy link

CYPRESS_DOWNLOAD_PATH_TEMPLATE was added since 9.3.0 which should enable this.

@cypress-bot cypress-bot bot added stage: icebox and removed stage: proposal 💡 No work has been done of this issue labels Apr 28, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: icebox labels Aug 8, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 16, 2022

The code for this is done in cypress-io/cypress#23194, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Aug 16, 2022
ZachJW34 pushed a commit that referenced this issue Aug 16, 2022
…16976 #22864) (#23194)

Co-authored-by: Blue F <blue@cypress.io>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 16, 2022

Released in 10.6.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.6.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: installation Issue during installation or downloading Cypress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants