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

fix: use unique install cache folders for betas #20296

Merged
merged 28 commits into from
Mar 4, 2022
Merged

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Feb 21, 2022

User facing changelog

Note: this commit is not attached to a specific release, but it is user-facing, so I guess it can go in the next release's changelog?

  • Updated pre-release builds to use a specific cache folder per pre-release build. Users no longer need to clear cache to install pre-releases.

Additional details

  • Update the build process to store some more info about the build in the CLI's package.json
  • Update the download code to use this metadata instead of the versionSpecifier to construct the cdn download URL.
  • Update the cache code to use a different cache in the case that buildInfo.stable !== true
  • Update release process + scripts to set stable: true before publishing this
    • This makes our prod tarballs distinct from dev tarballs, which wasn't the case before

How has the user experience changed?

  • A unique warning has been added to cypress install that clearly explains we're installing a pre-release.
  • cypress info has been updated to show if we are installing a pre-release.
  • cypress version displays 'pre-release' for the package version if applicable.
  • See the diffs in cli/__snapshots__ for the CLI changes.

PR Tasks

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 21, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Feb 23, 2022



Test summary

19278 0 218 0Flakiness 0


Run details

Project cypress
Status Passed
Commit f67af55
Started Mar 4, 2022 7:04 PM
Ended Mar 4, 2022 7:15 PM
Duration 11:45 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

![commit-bot-comment](../assets/cypress-bot-pre-release-comment.png)
- Make sure the `linux-x64` binary and npm package are present at the commented locations. See [Before Publishing a New Version](#before-publishing-a-new-version).
- Publish the `linux-x64` distribution to the npm registry straight from the URL:
- Use the `create-stable-npm-package` script to create a stable NPM package from the pre-prod `cypress.tgz` URL:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to update move-binaries to handle this for us so there is one less manual step & potential release error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. I was trying to be as deliberate as possible with making this its own step, so whoever is releasing is aware of what they're doing, but I guess it could be a source for errors. I'll look at this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -29,6 +34,12 @@ function preparePackageForNpmRelease (json) {

_.extend(json, {
version,
buildInfo: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late to the game, but feels like publishing the beta version to npm would remove the need for a lot of this logic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think publishing to NPM would really help avoid this complexity, unless we want to shove this complexity off to download.cypress.io like we do for stable releases, something like this is necessary.

I would be down to publish to NPM regularly, like maybe a Nightly build as long as there have been new commits. We already release so frequently that anything less frequent than Nightly wouldn't be super useful.

@flotwig flotwig marked this pull request as ready for review February 28, 2022 16:07
@flotwig flotwig requested a review from a team as a code owner February 28, 2022 16:07
@flotwig flotwig changed the title fix: use unique build cache folders for betas fix: use unique install cache folders for betas Mar 1, 2022
davidmunechika
davidmunechika previously approved these changes Mar 1, 2022
@@ -278,45 +202,32 @@ const start = (options = {}) => {
logger.log()
}

const pkgVersion = util.pkgVersion()
const versionToInstall = getVersionOverride({ envVarVersion }) || pkgVersion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total nit, but for the sense of flow while reading, could we move this check above for readability?

const pkgVersion = util.pkgVersion()
const versionToInstall = getVersionOverride({ envVarVersion }) || pkgVersion

if (versionToInstall === '0') {

logger.log(
chalk.yellow(stripIndent`
${logSymbols.warning} Warning: Forcing a binary version different than the default.
if (versionToInstall !== pkgVersion) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this alway log for binary version installs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. The log message here isn't great, I was kinda just following what was here already, but I can improve it so that it indicates we're installing a pre-release and there's not a "different binary version"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log message updated, see snapshots. Also updated output for cypress info.


```shell
yarn move-binaries --sha <commit sha> --version <new target version>
yarn prepare-release-artifacts --sha <commit sha> --version <new target version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this run's on the releaser's local machine, should there be a requirements that this must run on a Mac or Linux machine to ensure line-endings are not corrupted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script will always download the linux-x64 .tgz, but you raise a good point, possibly the stable: true write will mess with the line endings. I'll test this out and see.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the process of testing this, I discovered that this script relies on behavior of tar that is not present on Windows, so it fails anyways. Since only internal contributors use this script and we're all on MacOS and Linux, I went ahead and added a guard like you suggested bd305d1

emilyrohrbough
emilyrohrbough previously approved these changes Mar 4, 2022
@flotwig
Copy link
Contributor Author

flotwig commented Mar 4, 2022

Manually confirmed script works as expected on darwin.

@flotwig flotwig merged commit 3c28617 into develop Mar 4, 2022
@flotwig flotwig deleted the fix-beta-build-caching branch March 4, 2022 22:22
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 14, 2022

Released in 9.5.2.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants