felixmosh / turborepo-gh-artifacts

A TurboRepo local cache server which uploads artifact cache to GH artifacts.
MIT License
122 stars 7 forks source link

refactor(turboServer): use of `PORT` env variable #20

Closed johnhooks closed 1 year ago

johnhooks commented 1 year ago

I'm concerned that using an env variable so generic as PORT could lead to a hard to track down error if someone uses another action that also uses PORT.

https://github.com/felixmosh/turborepo-gh-artifacts/blob/985e228d924df5bc0cbba735de374e0e5f8e2138/src/turboServer.ts#L11

felixmosh commented 1 year ago

What is you suggestion? To use something kike TURBO_PORT?

it will be considered as breaking change

johnhooks commented 1 year ago

Name spacing under TURBO_ seems like it might be a bad idea. Also, this is just an idea of a concern. I didn't run into an issue with it. I just noticed it while reading the code base and had a thought I wanted to share.

CACHE_SERVER_PORT? Kinda long, but very specific.

felixmosh commented 1 year ago

I think that we should tackle the issue before solving it. Let's see if someone have an issue with it

brunojppb commented 1 year ago

If I'm not mistaken, every action step on a workflow runs on an isolated process, so environment variables are not shared, as documented here:

The steps of a job share the same environment on the runner machine, but run in their own individual processes. To pass data between steps in a job, you can use inputs and outputs

My understanding is that unless you pass the env map for each action step explicitly, they won't share any environment variables implicitly.

felixmosh commented 1 year ago

@brunojppb you are right, when env vars are used, you should specify the value of it each step that uses them.

johnhooks commented 1 year ago

Sounds good to me!