Repository navigation
Backlog
Labels
t-buildersIssues owned by the Builders team.
Description
apify env link makes an env var of an Actor version reference a shared variable. A reference holds the name of the shared variable (sharedEnvVarName) in place of a value, and the platform reads the value when a run starts. apify env ls, set, and rm have to handle references too: without this change, they treat one as a plain variable with an empty value.
Scope
- Add
apify env link <stored name> [--as <name>], which makes the Actor version reference a shared variable.<stored name>is the name of the shared variable.--assets the name of the env var on the Actor version, and it defaults to the stored name. The command picks the Actor and the version like the otherapify envcommands (--dir,--actor, and--version). - Create the env var, or update it when the version already has one of that name, as
apify env setdoes. Say in the output when the command replaced the env var's own value (a value stored on the version itself) or pointed an existing reference to another shared variable. - Leave the checks to the API (apify/apify-core#32550): the shared variable has to exist in the store of the account that owns the Actor, and the caller has to be allowed to list that store. Print the API's error.
- Mark references in
apify env ls. Show the name of the shared variable in place of a value, in the table and in the--jsonoutput. Don't show a reference as plain or secret: a reference entry always hasisSecret: false, and the type belongs to the shared variable. - Remove a reference with
apify env rm <name>, like any other env var. Say in the prompt and in the result that the command removes the reference and that the shared variable stays. - Handle
apify env set <name>on a reference: the env var then holds a value of its own in place of the reference. For other existing variables, the command keeps the type of the entry. Don't do that for a reference, or the new value would be stored as plain. Proposed: the value becomes a secret unless--no-secretis passed. Say in the result that a reference was replaced. - Print the rebuild reminder (
printRebuildReminderinsrc/lib/env-vars/output.ts) afterapify env link, as after a change of an env var's own value. Runs read their env var list from the build, so a reference that is added, removed, or pointed to another variable needs one rebuild.apify env rmprints the reminder already. Afterlink, add that a later change of the shared variable's value needs no rebuild. Afterrmof a reference, add that runs need the shared variable until that rebuild. - Register the command in
src/commands/env/_index.tsand in the reference generator (scripts/generate-cli-docs.ts), and describe it in the env var guide (docs/vars.md).
This can ship as two pull requests: link and the marks in ls first, then rm and set on a reference.
Rollout
The API accepts a reference only when the shared variable exists, and no variable can exist in an account without the feature flag of the store. The command needs no feature flag of its own. Release it only after resolution is in production (apify/apify-core#32552, apify/apify-core#33717).
Done when
- Local tests (
test/local/commands/env/) coverlinkwith and without--as, over an env var with its own value, over another reference, and with an error from the API. - Local tests cover
lswith a reference,rmof a reference, andseton a reference with and without a type flag. linkandrmof a reference print the rebuild reminder.
Depends on
- The store commands and the client release they need (Manage the shared store with
apify env#1580) - Resolution of references at run start (apify/apify-core#32552), in production before this command is released
- Resolution of references at build start (apify/apify-core#33717), in production before this command is released
Metadata
Metadata
Assignees
Labels
t-buildersIssues owned by the Builders team.
Activity