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

Add php version requirements file for future-proofing upgrades #14127

Merged
merged 6 commits into from
Jan 17, 2024

Conversation

jerm
Copy link
Collaborator

@jerm jerm commented Jan 12, 2024

There is a race condition in the upgrade.php file where it can't
currently know the hard requirements for the version it's upgrading to
until it does a git pull. By that time, it will have pulled new source
code that possibly relies on an incompatible version of php, leaving you
with a broken installation.

Example: You're running v6.2.x on PHP 7.4, which is fine. v7 requires
PHP 8.1 or 8.2, but we couldn't know that when we released v6. or v5 for
that matter. We could change the requirements in the most-recent v6
version of upgrade.php, but that doesn't help anyone who doesn't upgrade
first to the most recent v6.

With this change we'll keep a requirements file,
.upgrade_requirements.json, up to date in the root of the default
branch as the requirements to upgrade to HEAD change.

The upgrade.php file will query this file from Github at runtime, to
see if it's safe to pull down the rest of the repo, and warn you if not.

tl;dr, instead of hard-coding the php version requirements into
upgrade.php, we'll fetch the current ones from the live repo at runtime

This file is being added in a separate PR from the upgrade.php changes
so that testing of the script can be done against the live repo. Cart
and horse, and all that.

Jeremy Price added 5 commits January 11, 2024 16:27
for fetching before upgrades, to check major prereqs -- mainly php -- before
pulling down new, possibly breaking, code.
the latter mostly for testing and san checking.. but it doesn't really
matter because it's just json.. if we don't use it we don't use it
@jerm jerm requested a review from snipe as a code owner January 12, 2024 01:06
@jerm jerm requested a review from uberbrady January 12, 2024 01:06
Copy link

what-the-diff bot commented Jan 12, 2024

PR Summary

  • Added '.upgrade_requirements.json' File
    The developer team has included a new special file known as '.upgrade_requirements.json'. This file, similar to a checklist, keeps track of what is required from the server where our product runs.

  • Insertion of Documentation Lines
    The team has added numerous documentation lines (DOC1, DOC2, DOC3, DOC4). This ensures that our programmers understand the code's inner workings and enhances productivity when future updates or changes are introduced.

  • Upgraded PHP Minimum Version Requirement
    To make our product more robust and to utilize the latest language capabilities, the team upgraded the minimum supported PHP version to "8.1.0". It's like ensuring our product runs on the latest engine for the best performance.

  • Update of PHP Maximum Version Restriction
    The developers have set a maximum boundary for PHP version (8.2), ensuring that the product works best within this range. It provides stability by preventing unintended consequences of using untested or unsupported language versions.

  • PHP Non-support Version Determined
    The product will not work with PHP version "8.3.0". This is like specifying what fuel our product won't run on. This information is important to avoid potential setup issues.

  • Updated Current Snipe-IT Version
    The current version of Snipe-IT, our core product, has been updated to version "6.3". This could include various improvements, feature additions, or bug fixes enacted since the previous release.

jerm pushed a commit that referenced this pull request Jan 12, 2024
quoted from #14127
    There is a race condition in the upgrade.php file where it can't
    currently know the hard requirements for the version it's upgrading to
    until it does a git pull. By that time, it will have pulled new source
    code that possibly relies on an incompatible version of php, leaving you
    with a broken installation.

    Example: You're running v6.2.x on PHP 7.4, which is fine. v7 requires
    PHP 8.1 or 8.2, but we couldn't know that when we released v6. or v5 for
    that matter. We could change the requirements in the most-recent v6
    version of upgrade.php, but that doesn't help anyone who doesn't upgrade
    first to the most recent v6.

With this change, we implement fetching and incorporating the
requirements data from the remote file.

It's just fetching/decoding a couple of json values that replace the
hard-coded version requirements.

We move the branch checking higher than the php version checking so that
we can use the defined/overridden $branch to decide what branch to pull
the requirements from.
@snipe snipe merged commit 99000fa into snipeit_v7_laravel10 Jan 17, 2024
6 of 7 checks passed
@snipe snipe deleted the jerm/upgrade-deps-file branch January 17, 2024 13:16
@snipe
Copy link
Owner

snipe commented Jan 17, 2024

Do we also maybe want this on master?

jerm pushed a commit that referenced this pull request Jan 25, 2024
Add php version requirements file for future-proofing upgrades
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants