Skip to content

feat: add --apply-env-vars-to-build flag to push (#734) - #1345

Open
MatousMarik wants to merge 1 commit into
masterfrom
feat/push-apply-env-vars-to-build-734
Open

feat: add --apply-env-vars-to-build flag to push (#734)#1345
MatousMarik wants to merge 1 commit into
masterfrom
feat/push-apply-env-vars-to-build-734

Conversation

@MatousMarik

@MatousMarik MatousMarik commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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)

No new dependencies; no install-size impact.

@MatousMarik
MatousMarik force-pushed the feat/push-apply-env-vars-to-build-734 branch from f9e8ca3 to 9c96569 Compare August 24, 2026 14:39
@MatousMarik
MatousMarik marked this pull request as ready for review August 24, 2026 14:55
@MatousMarik MatousMarik self-assigned this Aug 24, 2026
@MatousMarik
MatousMarik force-pushed the feat/push-apply-env-vars-to-build-734 branch from 9c96569 to 923d4a8 Compare August 25, 2026 07:42
Allows env vars from actor.json to be applied to the Actor build
process (Docker build args) without flipping the switch in Console.
--no-apply-env-vars-to-build explicitly turns the setting off. When
the flag is omitted, the value stored on the platform is kept.

The flag parser matched provided flags by truthiness, which dropped
scalar false values injected by the test harness (the real CLI path
always yields arrays via multiple: true and was unaffected); it now
checks for presence so harness-injected negated booleans behave the
same as parsed ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants