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

Improve version checks to avoid mistakes in the versioning #35296

Closed
wants to merge 1 commit into from

Conversation

cipolleschi
Copy link
Contributor

Summary:
This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

Changelog

[General][Changed] - Improve version checks

Differential Revision: D41161756

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Nov 9, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 9, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Differential Revision: D41161756

fbshipit-source-id: da7dbfbf8685f8d437a310a3c305250eb56dd89b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

Comment on lines 61 to 65
if (
exec(
'node ./scripts/set-rn-version.js --to-version 1000.0.0 --build-type dry-run',
).code
) {
Copy link
Contributor Author

@cipolleschi cipolleschi Nov 10, 2022

Choose a reason for hiding this comment

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

this change makes the CircleCI test_js and test_js_prev_lts fails miserably because they can't find ruby anymore.

It doesn't make any sense to me, unless there are different scripts involved.

Copy link
Contributor

Choose a reason for hiding this comment

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

did you end up figuring out what was going on here? did rebasing on top of main help? 🤔

Copy link
Contributor Author

@cipolleschi cipolleschi Nov 21, 2022

Choose a reason for hiding this comment

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

no, unfortunately. No idea why this invocation make it fail ruby... 😕

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

@analysis-bot
Copy link

analysis-bot commented Nov 10, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,102,440 +0
android hermes armeabi-v7a 6,470,493 +0
android hermes x86 7,519,895 +0
android hermes x86_64 7,378,573 +0
android jsc arm64-v8a 8,967,309 +0
android jsc armeabi-v7a 7,698,152 +0
android jsc x86 9,029,418 +0
android jsc x86_64 9,507,263 +0

Base commit: 5dd0f73
Branch: main

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 10, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Differential Revision: D41161756

fbshipit-source-id: 10f5d22f0f1a9049397414c95f95fb8b6f5332a8
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

@analysis-bot
Copy link

analysis-bot commented Nov 10, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: cb7f1b1
Branch: main

@pull-bot
Copy link

PR build artifact for 7833857 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 7833857 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 16, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Differential Revision: D41161756

fbshipit-source-id: 7f4caee6a2e4fa895d33bd2ef938352cf8703d27
@pull-bot
Copy link

PR build artifact for 91d0401 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 91d0401 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

Copy link
Contributor

@kelset kelset left a comment

Choose a reason for hiding this comment

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

thanks for working on this - it goes in the right direction, I feel we really need to have a clear place in the code & docs that says all the potential versions and where they can be encountered.

Some comments are just questions, I think that once we've addressed it all we'll be able to merge soon.

Sorry it took me so long to loop back on this :(

scripts/bump-oss-version.js Show resolved Hide resolved
scripts/prepare-package-for-release.js Outdated Show resolved Hide resolved
scripts/publish-npm.js Show resolved Hide resolved
scripts/set-rn-version.js Show resolved Hide resolved
scripts/set-rn-version.js Show resolved Hide resolved
scripts/test-e2e-local.js Outdated Show resolved Hide resolved
scripts/version-utils.js Show resolved Hide resolved
scripts/version-utils.js Show resolved Hide resolved
scripts/version-utils.js Show resolved Hide resolved
Comment on lines 141 to 153
function is1000_0_1(version) {
return (
version.major === '1000' && version.minor === '0' && version.patch === '1'
);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this case covering? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this: https://github.com/facebook/react-native/blob/main/.circleci/config.yml#L1646

I think we can change this, but I left it here to highlight this and let you and Nico spread some knowledge about why this value has been chosen! :D

Copy link
Contributor

@kelset kelset Nov 21, 2022

Choose a reason for hiding this comment

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

that was not created by either of us, looks like it's coming from here e4b5d3e (and I was very much no aware of that)

soooo yeah. I guess we need to keep it around for now? It looks like it's just doing a dry run, so maybe realign it with the versioning for the dry runs? Also, the more I look at that PR, the more it feels wrong that the package_and_publish_release_dryrun is using a fixed version and not the one set in the branch :/ it means that even when we are about to publish ex. 0.71.0, the dryrun will still run with 1000.0.1 and it will basically "dry run test" something different from the final result 😅

might be worth a refactoring of that part of circleci

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I tried to pick up the version from the package.json for this problem, but it can't work. The reason is that the set-rn-version script fails if we try to set the same version that is already in the package.json. That's why they used the v1000.0.1, because they were sure that it would have worked.

We can add a bit of extra logic to dry-run on a patch: this will work for dry-running on main and on stable branches. However, it won't be exact for RCs. However, for RCs, it is very hard to properly bump them: the prerelease part of the version is handled as a string (because sometimes it is a date - for the nightlies -, some other times it is the RC.x, and in the test local is something different again), so we can't actually bump the patch.

as an approximation, given that it is just a dry-run and given that we always run it with 1000.0.1, what if we accept that for RCs we dry run on a schema that is 0.X.Y-RC.K?
@kelset @cortinico

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 18, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 39c4c7ff72e0eba5708171ec11a8a857b3d5592e
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

@pull-bot
Copy link

PR build artifact for 23265e1 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 23265e1 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 21, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: fcae8101e57dbef79203881961b61d8663285fdf
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 21, 2022
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 3a889967ab6a66357d68e380409fb061f831b670
@pull-bot
Copy link

PR build artifact for a6880f8 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: aba945afc14facad9fdf7a8cc6d14542c3bf03ee
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D41161756

Copy link
Contributor

@kelset kelset left a comment

Choose a reason for hiding this comment

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

:shipit:

@pull-bot
Copy link

PR build artifact for 0b3e187 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 0b3e187 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

kelset pushed a commit that referenced this pull request Nov 22, 2022
Summary:
Pull Request resolved: #35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 4172195c5e031c1eaf7b33bb74f381c04e9adaf5
facebook-github-bot pushed a commit that referenced this pull request Jan 18, 2023
…test versioning (#35846)

Summary:
While working on 0.71 branch I encountered a problem in testing locally. Basically, I was getting hit by a silent error caused by recent work #35296 that didn't account for the shape of E2E local script for the release, `0.71.0-20230116-1649`.

This scripts fixes both aspects: the error now gets thrown "better" and the logic accounts for the E2E shape.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - add logic for version scripts to account for local E2E test versioning

Pull Request resolved: #35846

Test Plan: Tested via the other PR: #35847

Reviewed By: cortinico

Differential Revision: D42543200

Pulled By: cipolleschi

fbshipit-source-id: 727eb887fcbd183ec56d8a9b7e98241eaacb1d98
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…35296)

Summary:
Pull Request resolved: facebook#35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 4172195c5e031c1eaf7b33bb74f381c04e9adaf5
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…test versioning (facebook#35846)

Summary:
While working on 0.71 branch I encountered a problem in testing locally. Basically, I was getting hit by a silent error caused by recent work facebook#35296 that didn't account for the shape of E2E local script for the release, `0.71.0-20230116-1649`.

This scripts fixes both aspects: the error now gets thrown "better" and the logic accounts for the E2E shape.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - add logic for version scripts to account for local E2E test versioning

Pull Request resolved: facebook#35846

Test Plan: Tested via the other PR: facebook#35847

Reviewed By: cortinico

Differential Revision: D42543200

Pulled By: cipolleschi

fbshipit-source-id: 727eb887fcbd183ec56d8a9b7e98241eaacb1d98
@cipolleschi cipolleschi mentioned this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants