numerique-gouv / people

Teams management application
MIT License
13 stars 1 forks source link

Fix version data generation and display #511

Closed Morendil closed 6 days ago

Morendil commented 2 weeks ago

Purpose

Display version information in the app's footer to help acceptance testing and debugging.

Fixes #510

Proposal

Improve release script to generate the version.json file that helps the frontend show a version number via the config endpoint, also embed the commit hash directly in frontend to serve as a sanity check in case the frontend fails to build.

qbey commented 1 week ago

@Morendil isn't there a way to fetch the version from the package.json file? (cc @PanchoutNathan maybe?)

Morendil commented 1 week ago

@qbey There are a variety of ways, but it's hard to find one that's entirely satisfactory.

The version gets into the package.json file in the first place via the method being altered here: execution of the release script… at which point the version number is entered manually and injected into a number of different files. From there it makes its way to the Django settings, then to the config endpoint, and finally to the footer via an API call. It's a bit circuitous…

I'd like to take advantage of this PR to also inject the commit, because then we can easily tell exactly what we are running in all environments from staging to production (whereas the version number stays the same in staging when we push there), and I'd like to be sure the frontend and backend are independently reporting a record of the version they are at, given our recent issues with updating the frontend image.

Morendil commented 6 days ago

Closing in favor of an alternative approach, i.e. actually implementing what's documented in release.py : generating the version information during Docker image build.