You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 216cc15
Browse filesBrowse the repository at this point in the historyBrowse files
feat: add --apply-env-vars-to-build flag to push (#734) (#1345)
Part of #734 (the `applyEnvVarsToBuild` toggle half).
## What
- New `--apply-env-vars-to-build` boolean flag on `apify push` — sets
`applyEnvVarsToBuild: true` on the Actor version, so env vars from
`actor.json` are also available during the Docker build.
`--no-apply-env-vars-to-build` explicitly turns the setting off.
- When the flag is omitted, the field is left out of the API payload
entirely, so a value previously set in Console is **preserved** (pushes
to existing Actors don't reset it).
- Flag-parser tweak: `_parseFlags` matched provided flags by truthiness.
The real CLI path is unaffected (`multiple: true` means values always
arrive as arrays, which are truthy), but
`testRunCommand`/`internalRunCommand` inject scalar values, where an
explicit `false` was silently dropped. The matcher now checks for
presence, and the required-flag check is aligned to `undefined`, so
harness-injected negated booleans behave the same as parsed ones (the
new test relies on this).
- Regenerated `docs/` via `pnpm run update-docs`.
## Why
Env vars synced by `apify push` currently apply only at runtime; making
them apply to the build requires flipping a switch in Console. That
breaks CI and fresh pushes of Actors that need build-time secrets (e.g.
a GitHub token as a Docker build arg).
## Tests
- New `[api]` test in `test/api/commands/push.test.ts` covering: flag →
`true`, omitted → preserved, negated flag → `false`. Full push API suite
passes (13/13), plus `test:local`, lint, format, build.
## Follow-ups (separate PRs)
- `applyEnvVarsToBuild` field in `.actor/actor.json` (#1346, stacked on
this).
- `--env KEY=VALUE` passing on push (the other half of #734).
No new dependencies; no install-size impact.
Co-authored-by: Richard Solar <solar.richard@gmail.com>
'Make the environment variables also available to the Actor build process. Use --no-apply-env-vars-to-build to turn the setting off. When omitted, the setting currently stored on the platform is kept.',
229
+
required: false,
230
+
}),
226
231
};
227
232
228
233
staticoverrideargs={
@@ -454,9 +459,11 @@ Skipping push. Use --force to override.`,
454
459
allowMissing: this.flags.allowMissingSecrets,
455
460
})
456
461
: undefined;
462
+
// true/false when --[no-]apply-env-vars-to-build is passed, undefined when omitted so the value stored on the platform is preserved
0 commit comments