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

build: INFENG-739: remove hardcoded version from Vite config #9532

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

davidfluck-hpe
Copy link

build: INFENG-739: remove hardcoded version from Vite config

Ticket

INFENG-739

Description

  • Replace the process.env.VERSION variable explicitly defined in vite.config.mts with either the actual VERSION environment variable, if it's set, or the most recent git tag, followed by an optional commit counter and partial unique SHA hash. This shells out to git, and also accounts for the rare but possible case that the config is being used from outside of a git repository. In that situation, the version string is useless anyway, so we return "unknown" from the shell.

  • During the release, we will set VERSION ourselves based on the tag, so we don't have to go over the top trying to parse it out here. The local version doesn't matter too much, either, as it's only referenced during development, and, as far as I can tell, is really only used to display the current version to the developer. During the release, we can set VERSION from CircleCI directly, as it already provides the tag if the run was triggered by one.

Test Plan

  1. Make sure you have Determined running locally (draw the rest of the owl); devcluster works fine.
  2. In the repository somewhere, run git tag v1.0.0. This temporarily resolves a pip issue I need to fix that causes a determined>=0.13.11, namely: the version make tries to build doesn't have a proper tag, so it reads as <0.13.11 to pip, and thus fails. Having a tag available will satisfy the requirement. My apologies. It also makes it possible to see a more interesting version string in the UI.
  3. In the repository root, run make clean ; make all to build Determined locally.
  4. cd into ./webui/react and run npm start. Run nvm use in this directory first if you need to switch Node versions.
  5. In the lower left corner of the screen of the web UI that launches in a new tab, you should see v1.0.0. If you happened to tag a commit further back than HEAD, you would see something like v1.1.0-2-gca758a773, which is the tag itself, v1.0.0, the number of commits since that tag, 2, the special prefix indicating a commit hash, g, and the unique hash prefix of HEAD, ca758a773.
  6. Run git tag -d v1.0.0, kill the running vite instance, and re-run npm start. You should see just a hash prefix in place of the version this time: 49b0af80a (just don't rebuild Determined or you'll hit the same pip error described before).
  7. Finally, stop vite again. Run export VERSION=1.1.2, or your preferred version string, and re-run npm start.
  8. The UI should display the version string you've chosen, as it reads from the VERSION environment variable.
  9. Clean up: run unset VERSION wherever you set VERSION, and delete any tags you might have missed.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

* Replace the process.env.VERSION variable explicitly defined in
  vite.config.mts with either the actual VERSION environment variable,
  if it's set, or the most recent git tag, followed by an optional
  commit counter and partial unique SHA hash. This shells out to git,
  and accounts for the rare but possible case that the config is being
  from outside of a git repository. In that situation, the version
  string is useless anyway, so we return "unknown" from the shell.

* During the release, we will set VERSION ourselves based on the tag, so
  we don't have to go over the top trying to parse it out here. The
  local version doesn't matter too much, either, as it's only referenced
  during development, and, as far as I can tell, is really only used to
  display the current version to the user. During the release, we can
  set VERSION from CircleCI directly, as it already provides the tag if
  the run was triggered by one.
Copy link

netlify bot commented Jun 17, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit ca758a7
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66706207c6c1ff00097bcbd1
😎 Deploy Preview https://deploy-preview-9532--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@davidfluck-hpe davidfluck-hpe changed the base branch from main to INFENG-382-release-redesign June 17, 2024 16:19
Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

left a comment, otherwise LGTM

webui/react/vite.config.mts Show resolved Hide resolved
@davidfluck-hpe davidfluck-hpe merged commit c143907 into INFENG-382-release-redesign Jul 2, 2024
32 of 85 checks passed
@davidfluck-hpe davidfluck-hpe deleted the INFENG-739-vite-config branch July 2, 2024 21:31
davidfluck-hpe added a commit that referenced this pull request Jul 23, 2024
INFENG-739: remove version string from Vite config

* Replace the process.env.VERSION variable explicitly defined in
  vite.config.mts with either the actual VERSION environment variable,
  if it's set, or the most recent git tag, followed by an optional
  commit counter and partial unique SHA hash. This shells out to git,
  and accounts for the rare but possible case that the config is being
  from outside of a git repository. In that situation, the version
  string is useless anyway, so we return "unknown" from the shell.

* During the release, we will set VERSION ourselves based on the tag, so
  we don't have to go over the top trying to parse it out here. The
  local version doesn't matter too much, either, as it's only referenced
  during development, and, as far as I can tell, is really only used to
  display the current version to the user. During the release, we can
  set VERSION from CircleCI directly, as it already provides the tag if
  the run was triggered by one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants