mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-16 09:46:43 +00:00
Initial Commit
This commit is contained in:
21
packages/docker/src/hooks/cleanup-job.ts
Normal file
21
packages/docker/src/hooks/cleanup-job.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
containerRemove,
|
||||
containerNetworkRemove
|
||||
} from '../dockerCommands/container'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export async function cleanupJob(args, state, responseFile): Promise<void> {
|
||||
const containerIds: string[] = []
|
||||
if (state?.container) {
|
||||
containerIds.push(state.container)
|
||||
}
|
||||
if (state?.services) {
|
||||
containerIds.push(state.services)
|
||||
}
|
||||
if (containerIds.length > 0) {
|
||||
await containerRemove(containerIds)
|
||||
}
|
||||
if (state.network) {
|
||||
await containerNetworkRemove(state.network)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user