Repository navigation
Backlog
Labels
t-buildersIssues owned by the Builders team.
Description
apify env pull, diff, and push move env vars between a local .env file and an Actor version. .env holds names and values only, so it can't hold a reference: a version env var that points to a shared variable of the account in place of a value. Without this change, the three commands treat a reference as a plain variable with an empty value: pull writes an empty value over the local one, diff reports a difference, and push replaces the reference with the value from .env, stored as plain.
Scope
- Read the type of each referenced shared variable, and the value of a plain one, from the list of the store (the shared variables of the account). Do it only when the Actor's owner is the account that the CLI is logged in to: the list returns the store of that account, and a reference points to the store of the Actor's owner. For any other Actor, and for a reference whose variable isn't in the list, the commands know only the name of the env var and the name of the shared variable.
- Write the value of a plain shared variable and an empty value for a shared secret in
apify env pull. A reference with a known plain value is handled like a plain variable: the value is written, even over a different local value. Every other reference is handled like a secret: the key is written with an empty value, and a value that.envalready has stays. - Write no shared value for a caller who can't read it. The list of the store returns no values to an organization member who can edit Actors but lacks the permission to manage the store (proposed). For such a member,
pullwrites every reference like a reference to a secret. - Treat a reference like any other variable in
apify env diff. Compare it by value when the shared value is known, and by name only when it isn't, as for a secret. A reference never counts as a difference only because it's a reference. - Protect references in
apify env push. Never replace a reference with a value from.envunless the diff shows that replacement. The diff is the list of changes that the command prints before it asks. Proposed:pushdoesn't write over a reference at all. The diff lists each reference as kept, with the name of its shared variable, and marks the ones whose known value differs from.env. A user who wants the env var to hold a value of its own runsapify env set <name>. The reason: a local run needs a value for a referenced secret in.env, andpushwould otherwise replace the reference each time. With--prune, a reference whose name isn't in.envis deleted like any other variable, and the diff marks it as a reference. - Name the shared variable next to each reference in the output of the three commands, also with
--json. Print names only, never a value. - Describe the behavior in the env var guide (
docs/vars.md).
This can ship as two pull requests: pull and diff first, then push.
Done when
- Local tests (
test/local/commands/env/) cover the three commands on a version with a reference to a plain variable, to a secret, and to a variable that the list of the store doesn't return. - A test runs
apify env pull, adds a local value for a referenced secret to.env, and runsapify env push --yes. The reference is still in place. - A test covers an Actor of another account: the commands don't read the store.
Depends on
apify env linkand the reference marks inapify env ls(Reference a shared variable withapify env link#1648)apify env push(Addapify env push#1572)apify env pull(Addapify env pull#1573)apify env diff(Addapify env diffto check that.envand the platform are in sync #1574)
Metadata
Metadata
Assignees
Labels
t-buildersIssues owned by the Builders team.
Activity