112dev / phunt

Set of tools to organize digital media such as photos and images.
1 stars 0 forks source link

phunt-cli build id not injected by rollup #8

Open jelovac opened 5 hours ago

jelovac commented 5 hours ago

Description

The BUILD_ID environment variable is not passed to the Rollup node process which builds and bundles phunt-cli. As a result when we run the version command the BUILD_ID will display unknown.

TODO

Test case

  1. Run BUILD_ID=123 pnpm build
  2. Check dist/phunt-cli.js at the very bottom in the code you will have the version block.
    app.version(`Version: 1.0.0-beta.0
    Build Id: unknown
    Build Date: Sun, 29 Sep 2024 17:27:16 GMT
    License: Apache-2.0`);

By design if the env variable is set rollup's plugin replace should set BUILD_ID.

Relevant files

jelovac commented 3 hours ago

Figured it out. We run the build task through turbo(repo). And turbo by default excludes all environment variables which are not explicitly stated or match common JS frameworks patterns.

See:

Currently BUILD_ID = github.run_id

If we set BUILD_ID as a globalenv it will always cause a cache miss, which will make caching useless.

If we set BUILD_ID as a globalpassthroughenv it will not cause a cache miss. However, it might make a confusion. Because the ID will be the id of some previous job which got cached. Not a good solution either..

Time to sleep on it.