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

installed version match check and CYPRESS_BINARY_VERSION #866

Closed
MarcLoupias opened this issue Nov 2, 2017 · 13 comments · Fixed by cypress-io/cypress-documentation#221
Closed
Labels

Comments

@MarcLoupias
Copy link

MarcLoupias commented Nov 2, 2017

  • Operating System: Windows 7 Enterprise
  • Cypress Version: 1.0.3 (npm install)
  • Browser Version: irrelevant

Is this a Feature or Bug?

Bug (and documentation request)

Current behavior:

The cypress CLI installed version check at run output a weird message :

> cypress run

Installed version C:\blablabla\cypress.zip does not match the expected package version 1.0.3

Note: there is no guarantee these versions will work properly together.


  (Tests Starting)
...

I have checked the version by running cypress.exe. It open the electron app, the indicated version is 1.0.3.

My npm installed version is also 1.0.3.

Desired behavior:

It should not print that message.

How to reproduce:

I am behing a corporate proxy, until now i was using the direct download package. I have tried this morning the npm install with the CYPRESS_BINARY_VERSION trick.

I have downloaded the cypress.zip file from https://download.cypress.io from a computer connected to internet then i have put the cypress.zip file on my dev machine.

I have set the env var CYPRESS_BINARY_VERSION : C:\blablabla\cypress.zip, then ran npm install then ran the tests i had written with the direct download desktop app with the cypress run CLI command.

Additional Info (images, stack traces, etc)

The documentation should indicate where to download a cypress archive and how to download it in a specific version.
A devops could have to build a CI for projects running a different cypress version then @latest.

Related to this issue.

@bahmutov
Copy link
Contributor

bahmutov commented Nov 2, 2017

I would not consider this a bug. The NPM CLI installer does NOT know if the cypress.zip is the right version, matching the version inside the package.json So the warning is appropriate.

@brian-mann
Copy link
Member

brian-mann commented Nov 2, 2017 via email

@MarcLoupias
Copy link
Author

MarcLoupias commented Nov 2, 2017

Mmh there is maybe some confusion in my mind about your software chunks and your versionning system.

Let's put everything on the table.

As i understand it, your software [email protected] is a composition of 2 pieces :

  • the npm package
  • the cypress.zip file downloaded from https://download.cypress.io

If i install [email protected], i expect to get the npm package and the cypress.zip file at this exact tag.

If i install [email protected] i expect to get the 1.0.3 version of cypress.zip, not the same as the 1.0.0.

The tag identifies both pieces (that's where i am maybe wrong).

My problem is about consistency in the devDependencies in my projects between cypress versions.

I could have (and i will, it's absolutly sure) in my global CI system 3 projects with cypress as devDependencies in a version v, and 5 others projects with cypress as devDependencies in a version v+n.

The projects CYPRESS_BINARY_VERSION jobs config will be different for each project, related to their devDependencies version status.

@jennifer-shehane
Copy link
Member

I created an issue regarding your recommendation for the docs. Our docs are also open source and open for contributions. cypress-io/cypress-documentation#200

@andrewleith
Copy link

According to the comments above then, since cypress cannot tell what version is in the .zip file, it will ALWAYS give this warning. How is that a feature? The statement will be right some of the time and wrong some of the time.

@brian-mann
Copy link
Member

All the CLI code is here: https://github.com/cypress-io/cypress/tree/develop/cli

Specifically what does that check is here: https://github.com/cypress-io/cypress/blob/develop/cli/lib/tasks/verify.js#L226

PR's welcome!

@MarcLoupias
Copy link
Author

Ok i get the point.

The CLI is comparing the package.json version field against the node_modules/cypress/dist/info.json version field which is written after the cypress.zip is extracted.

The version field in info.json is filled with the CYPRESS_BINARY_VERSION env var.

So it checks if '/path/cypress.zip' !== '1.0.3'.

So if we use CYPRESS_BINARY_VERSION with a path the check will be always false even if the manually downloaded binary is in the right version.

What about adding a CYPRESS_BINARY_PATH instead to configure download ?

A side question, there is a version file containing v1.4.6 in node_modules/cypress/dist/Cypress/ directory. What is this version number related to ?

Would love to make a PR but :

  • i have put my evening reading some of your code (the cli part), i am definitely not skilled like any of cypress.io team member. My javascript experience is limited comparing to yours. Seems you write in functional style all the way, love it but i am a newbie on this. The code review could be a time sink for your team.
  • i am not sure about what have to be done. Checking if the CYPRESS_BINARY_VERSION content is a version number with a regex and display the warn only in that case ? Or a deeper impl of a CYPRESS_BINARY_PATH ? Or something i don't get ?
  • impossible to do that at work. Testing a new (super) promising tool is ok, spending days to contribute is another thing.
  • can try at home but my spare time is limited with a one year old kid and my wife works a lot.

Well, if you could tell me what you want i could give it a try.

Last thing, could you give us more details about your CDN structure ? For example how could i manually download the 1.0.2 binary zip for windows platform ? Can't get the right url. As i understand from your code you build 3 zip files at each release, one per platform, so you should have a directory for each cypress version containing 3 directory for each platform. Am i right ?

@brian-mann
Copy link
Member

An alternative here would be to parse the package.json version out of the dist at a later time (after unzip). We'll have to add the different binary paths, but we basically already do that.

To answer some of your questions:

The 1.4.6 is the version of Electron. This is automatically added by the packager during build + dist. It's not related to Cypress at all, but its important in that this is what sets the internal node and chromium version that Cypress runs on top of.

We can document our download server's API. It's already internally documented and we can add it to the installer guide. The download server automatically figures out which OS to send you (but it can be manually specified) and naturally you can also ask for a specific version too.

I'm not sure what we want to do yet - when we originally wrote the code we talked about this use case but shrugged it off as not that big of a deal to see the warning each time. Perhaps we could also enable you to turn those off and preserve those values in info.json.

@brian-mann
Copy link
Member

We'll document this tomorrow but here are a list of useful endpoints for the download server.

These are all accessed on host: https://download.cypress.io

Desktop App Routes

GET /desktop                   ## downloads latest desktop app
GET /desktop?platform=p        ## downloads latest desktop app for specific platform
GET /desktop.json              ## returns desktop manifest.json
GET /desktop/:version          ## downloads desktop app by version
GET /desktop/:version?platform=p    ## downloads desktop app by version for specific os

You don't need to provide platform as Cypress will automatically figure that out. It also supports an arch query param but that's not useful until we build 32 and 64 bit binaries.

@MarcLoupias
Copy link
Author

https://download.cypress.io/desktop.json is exactly what i was looking for :

{
    "name": "Cypress",
    "version": "1.0.3",
    "packages": {
        "mac": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/osx64/cypress.zip"
        },
        "win": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/win64/cypress.zip"
        },
        "linux64": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/linux64/cypress.zip"
        },
        "darwin": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/osx64/cypress.zip"
        },
        "win32": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/win64/cypress.zip"
        },
        "linux": {
            "url": "https://cdn.cypress.io/desktop/1.0.3/linux64/cypress.zip"
        }
    }
}

Now i have all the needed entry points to trigger a meeting with the department in charge of the software factory in my customer company.

I can tell them where to download each piece of software for each version and each platform and how to configure the jenkins jobs to get cypress working behind the corporate proxy.

Just to be sure, the cypress.zip in /desktop is the same as the one downloaded by the npm package ? In fact when a user is using the direct download it is the same a the npm ?

Last thing about this :

I'm not sure what we want to do yet - when we originally wrote the code we talked about this use case but shrugged it off as not that big of a deal to see the warning each time.

The problem about this case is : this creates doubt. Did i download the correct binary version ? I have maybe made an error somewhere ?

Pretty sure you will get questions about this many times.

Anyway, thanks you all for your time and effort, i am stonished by the involvment you put into the communication with your users. Especially for a small company with limited ressources.

@jennifer-shehane
Copy link
Member

I created a new issue in our docs to document the download server API here cypress-io/cypress-documentation#218. Our documentation is open source and contributions are welcome. 😄

@MarcLoupias
Copy link
Author

I will give it a try tonight or sunday :)

@brian-mann
Copy link
Member

brian-mann commented Nov 3, 2017

Everything ends up receiving the same .zip file as documented above - whether its NPM, direct download, etc.

MarcLoupias added a commit to MarcLoupias/cypress-documentation that referenced this issue Nov 4, 2017
closes cypress-io#200, closes cypress-io#218 and closes cypress-io/cypress#866

* npm install section clarification

- what is the npm package
- best practice highlighted

* direct download section precisions

- what is exactly downloaded as the user didn't knew it exactly

* new CDN Structure section

- CDN url pattern
- it give to the user enough informations to download Cypress in the wanted
version for the wanted platform (could download a linux Cypress version from
a windows workstation)
- example

* Advanced section

- warning added about CLI output when running cypress
MarcLoupias added a commit to MarcLoupias/cypress-documentation that referenced this issue Nov 4, 2017
closes cypress-io#200, closes cypress-io#218 and closes cypress-io/cypress#866

* npm install section clarification

- what is the npm package
- best practice highlighted

* direct download section precisions

- what is exactly downloaded as the user didn't knew it exactly

* new CDN Structure section

- CDN url pattern
- it give to the user enough informations to download Cypress in the wanted
version for the wanted platform (could download a linux Cypress version from
a windows workstation)
- example

* Advanced section

- warning added about CLI output when running cypress
jennifer-shehane pushed a commit to cypress-io/cypress-documentation that referenced this issue Nov 6, 2017
* Installing Cypress  guide improvment

closes #200, closes #218 and closes cypress-io/cypress#866

* npm install section clarification

- what is the npm package
- best practice highlighted

* direct download section precisions

- what is exactly downloaded as the user didn't knew it exactly

* new CDN Structure section

- CDN url pattern
- it give to the user enough informations to download Cypress in the wanted
version for the wanted platform (could download a linux Cypress version from
a windows workstation)
- example

* Advanced section

- warning added about CLI output when running cypress

* updates to new advanced instructions

- Some wording changes
- Moved CDN section into section called ‘Hosting’ within the Advanced
install instructions.
- Added the download table (we only want to expose our
download.cypress.io endpoint, not the cdn directly)
- update platforms to correct os names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants