Can I edit job_env or set a globally available ENV for all stages/scripts in a custom executor

I’m creating a custom executor. I am confused as to how I create a container in prepare stage and then set the ID to an ENV that is available to all other stages (specifically cleanup, so it knows what to delete). I can create the container in the config stage, but the docs indicate (loosely) that’s better done in the prepare stage. Any recommendations on how I ensure an ENV set in prepare is available in cleanup?