[codex] Add configurable container pre-stop commands#570
Closed
zhangpu1211 wants to merge 1 commit into
Closed
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #570 +/- ##
===========================================
- Coverage 59.17% 58.94% -0.23%
===========================================
Files 184 184
Lines 9354 9436 +82
Branches 1135 1144 +9
===========================================
+ Hits 5535 5562 +27
- Misses 3394 3447 +53
- Partials 425 427 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This PR adds an optional
PreStopCommandfor container-based challenges.The command is stored at the challenge level, copied into the created container record, and executed as a best-effort hook right before the platform destroys the container.
It includes:
PreStopCommandsupport for game and exercise challengesWhy
A fork (
mygzctf) uses a fixed/about_to_destroyhook before removing containers. That idea is valuable, but the hardcoded path is too specific for upstream.This PR generalizes it into a configurable, optional platform capability:
Behavior
PreStopCommandis empty, container deletion behavior is unchanged.PreStopCommandis configured, the platform tries to execute it inside the container before deletion.Validation
Local validation completed with .NET 10:
dotnet build src/GZCTF/GZCTF.csproj -c Release --no-restoredotnet test src/GZCTF.Test/GZCTF.Test.csproj -c Release --no-restore --filter FullyQualifiedName~TransferChallengeTestsdotnet test src/GZCTF.Integration.Test/GZCTF.Integration.Test.csproj -c Release --no-restore --filter FullyQualifiedName~UpdateGameChallenge_ShouldPersistPreStopCommandpnpm buildinsrc/GZCTF/ClientAppNote
This branch also includes the minimal
Program.resxnamespace fix inGZCTF.csproj, because the currentdevelopbranch still hits a resource-generation conflict locally without it. The same fix was already needed on the previous PR to make build and integration testing work.