Skip to content

apify push: add a flag that deletes the uploaded source after the build #1651

Backlog

Description

@DaveHanns

Add an opt-in flag to apify push for throwaway pushes: the source is uploaded as a zip, used for the build, and deleted afterwards. Nothing stays readable in the Web IDE or in the key-value store.

Today, a project under 3 MB uploads as "Multiple source files", which stay on the Actor version and show in the Web IDE. A larger project uploads as a zip to the key-value store actor-<actorId>-source, where it stays until somebody deletes it by hand.

This is the first, CLI-only step. It needs no platform change. Ship it as experimental.

Behavior

  • New flag on apify push. The name is open, for example --delete-source-after-build.
  • With the flag, the push always takes the zip path in src/commands/actors/push.ts, even when the project is under MAX_MULTIFILE_BYTES. The version becomes a zip version, so files from an earlier push leave the Web IDE too.
  • The zip gets a key of its own for each push, not the shared version-<version>.zip. Otherwise, the cleanup of one push could delete the archive of another push to the same version.
  • The CLI deletes the record when the build reaches any terminal status: succeeded, failed, aborted, or timed out.
  • The CLI also deletes the record when the push is interrupted. useAbortJobOnSignal already aborts the build on Ctrl+C, SIGTERM, and SIGHUP. The cleanup belongs next to it, and also on errors between the upload and the build start.
  • The flag needs the CLI to wait for the build. With --wait-for-finish=0, or when the wait runs out before the build ends, the CLI can't delete the zip safely. Refuse the combination with 0. When the wait runs out, leave the zip, warn, and print the store and key.
  • The flag is refused together with --all unless the cleanup is done for each Actor. Decide during implementation.
  • --json output says whether the source was deleted.

Known limits

Say these in the flag description and in the docs:

  • After the zip is deleted, the version can't be rebuilt from Apify Console or the API, and apify pull fails, until the next push. The build then fails with "Failed to download the archive". A change of environment variables in Console needs a rebuild, so it needs a new push.
  • A process that is killed hard (kill -9, lost connection) can still leave the zip in the store.

Acceptance criteria

  • With the flag, a push of a project under 3 MB leaves no source files on the version and no record in the store after the build ends.
  • The same holds after a failed build and after Ctrl+C during the build.
  • Without the flag, apify push behaves as before.
  • Tests cover the cleanup on success, on failure, and on interrupt.
  • The CLI reference documents the flag and its limits.

Activity

  1. added
    t-builders
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-builders

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions