How to source an env file created by another task #2357
Replies: 2 comments
-
You need a bootstrap strategy. I would suggest a task (dep) which takes a checksum of the .codeartifact.env file, then generates it, and then takes a second checksum. If the checksum changed .... call task again with the same parameters ... that will reload the .env file and you will be good to go. Otherwise, if the checsum did not change, just continue. It will take some effort to figureout, but it should be possible. |
Beta Was this translation helpful? Give feedback.
-
So for my understanding why is the .env file reloaded in this case (if I understand correctly - when the same task is called with the same parameters). How does this differ from one task calling another - if the .env file not reloaded other than when a task is called recursively? In this case
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a task (
create-env
) which generates various.env
files, including acodeartifact
env file which contains a token that expires every 12 hours.Issue is
dotenv: ['.codeartifact.env']
seems to run before any task, so it uses the previous (maybe expired) token.I've tried explicitly sources the file via
set -a; source .env; set +a
but this only sets the ENV variables locally.In general I need to export vars in one command (
create-env
, run bybuild
) and import them for all subsequent tasks. Is this possible (or is there some other pattern)? I really want to do this so tasks from imported taskfiles also inherit the environmentBeta Was this translation helpful? Give feedback.
All reactions