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

MBS-13358 (II), MBS-13546: Upgrade Perl version to 5.38 #3239

Merged
merged 20 commits into from Apr 16, 2024

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented Apr 16, 2024

MBS-13358 (II)

This patch upgrades Perl version to 5.38.2 for the MusicBrainz Server for production, CI tests, and test database.

See commit messages for the details of the implementation which is adapted from the official docker-perl.

It comes after metabrainz/musicbrainz-docker#273 (I) that was for the development setup only.

Additional changes

  • Further modernize the generated Dockerfiles (after Improvements to the Docker images #3211) using:
    • COPY options to set owner and permissions
    • RUN options to mount caches and bind one-off files
  • Fix a few inconsistencies between generated Dockerfiles (especially with those being newly generated since Improvements to the Docker images #3211)
  • Update DateTime::Locale version to 1.41 (with no change on our list of locales)
  • MBS-13546: Replace Email::Address with Email::Address::XS (and update email-related dependencies)
  • Update a pair of Perl dependencies for internationalization
  • Regenerate the two cpanfile snapshots accordingly
  • Move CI tests to image tag v-2024-04.perl5.38 (built and pushed)

Note

I tried to update all Perl module dependencies but some conflicts showed up, moreover I noticed that some updates may require additional code change/review, so I gave it up for now and only made a few updates instead. We may update some more Perl module dependencies by the schema change release, as upgrading the required version of Perl is the best opportunity to also upgrade the required versions of our Perl module dependencies.

Testing

  • Run the server locally with new dependencies
  • Buildi all images locally
  • Pass CI tests with the new image

Documenting

Markdown files are updated in this PR. (There is no other source of documentation to be updated.)

Further action

The last step (III) will be to upgrade Perl for mirrors as well, and I intend to prebuild those images from this repository.

This method will work even if installing a more recent Perl from source.
This method will work even if installing a more recent Perl from source.
Our (MetaBrainz) base image is based on Phusion base image which in turn
is based on Ubuntu Jammy that comes with Perl 5.34.0 (using apt).  To
upgrade Perl with the same base image, we have to install from source.
Previously rhe cpanm cache for root user was cleaned up only when
building the tests image. This patch cleans it up for other images too.
Split installing Perl and other MusicBrainz Server’s back-end runtime
prerequisites from installing MBS’ Perl module dependencies. It avoids
rebuilding Perl and prerequisites when cpanfile (or snapshot) changes.
Previously those were installed in one RUN for all images but tests.
Previously, it was set this way for all images but test-database/tests.
Previously, an additional image layer was created because of COPY,
and files weren’t always removed afterwards.

Reference: https://docs.docker.com/develop/develop-images/instructions/#add-or-copy
Previously, it was set this way for all Docker images but test-database.
When possible, use --chmod/--chown options to COPY instead of RUN
chmod/chown instructions. It creates one image layer less each time.

Note: chmod isn’t needed when the host is Linux and the file permissions
are set in the Git repository and preserved in the Git working copy.

Reference: https://docs.docker.com/reference/dockerfile/#copy---chown---chmod
It follows Unicode CLDR 44.1.0 which brings no change to locales.json
Use a faster and safer drop-in replacement.
This is even encouraged by the author of Email::Address.
It is already used in Email::MIME (1.943+) and Email::Sender (2.600+).

The changes in tests are expected when you compare both module dependencies.

References:
* https://metacpan.org/release/RJBS/Email-Address-1.900/view/lib/Email/Address.pm
* https://metacpan.org/release/PALI/Email-Address-XS-1.05/view/lib/Email/Address/XS.pm
./docker/generate_cpanfile_snapshot.sh
./docker/generate_cpanfile_snapshot.sh docker/musicbrainz-test-database/cpanfile

All of these updates are minor and expected to be impactless.
@yvanzo yvanzo changed the title MBS-13358 (II): Upgrade Perl version to 5.38 MBS-13358 (II), MBS-13546: Upgrade Perl version to 5.38 Apr 16, 2024
@yvanzo yvanzo marked this pull request as ready for review April 16, 2024 17:26
@yvanzo yvanzo added this to the Schema Change 2024 Q2 milestone Apr 16, 2024
Copy link
Member

@mwiencek mwiencek left a comment

Choose a reason for hiding this comment

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

Looks great, the commits were well documented and it's reassuring to see that all of the tests pass. Like #3211 this contains many useful improvements to the Dockerfiles. Thank you!

@yvanzo yvanzo removed the request for review from reosarevok April 16, 2024 19:25
@yvanzo yvanzo merged commit 40fa562 into metabrainz:master Apr 16, 2024
2 checks passed
@yvanzo yvanzo deleted the perl5dot38 branch April 16, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants