[codex] Add container context environment variables#569
Conversation
|
A quick note on the latest update: I added two follow-up commits on top of this PR:
Why the non-test fix is included:
Why the tests are written this way:
The tests now verify:
Local validation:
If you prefer, I can also split the build/runtime fixes into a separate PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## work #569 +/- ##
==========================================
+ Coverage 59.17% 59.26% +0.09%
==========================================
Files 184 184
Lines 9354 9371 +17
Branches 1135 1137 +2
==========================================
+ Hits 5535 5554 +19
Misses 3394 3394
+ Partials 425 423 -2
🚀 New features to boost your workflow:
|
|
Environment variables do not need to be ordered. It's fine to simply place the FLAG at the end without inserting it. If there are concerns about memory performance, just allocate a large enough List before push. |
|
@GZTimeWalker Thanks, that makes sense. I simplified both providers to append |
What changed
This PR expands the container environment metadata exposed to challenge containers for both Docker and Kubernetes providers.
It adds:
GZCTF_USER_IDGZCTF_CHALLENGE_IDGZCTF_GAME_IDfor game-backed containersThe existing
GZCTF_FLAGandGZCTF_TEAM_IDbehavior is preserved.Why
Today the platform already passes per-team and per-flag context into dynamic containers, but challenge images cannot reliably identify the current user, challenge, or game from environment variables alone.
Adding these official context variables makes it easier to build challenge images and helper services that need lightweight awareness of platform context without depending on provider-specific labels or external side channels.
Impact
GZCTF_GAME_IDbecause they are not attached to a game.Validation
ContainerConfigcall sites so the new field is populated for game and admin test containers.zhangpu1211/GZCTF.net10.0.