Skip to content

Commit

Permalink
Final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlerdominik committed Feb 27, 2024
1 parent f1ad514 commit d92d193
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
17 changes: 9 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions src/dockerRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ import {v4 as uuidv4} from 'uuid'
import * as input from './input'
import {FileMap, Mapping} from './fileMap'

const fileMap = new FileMap(input.get('tempdir'))
export async function runContainer(): Promise<void> {
// prepare the files for the command
const fileMap = new FileMap(input.get('tempdir'))

fileMap.pushRunnerPath('GITHUB_ENV', process.env.GITHUB_ENV)
fileMap.pushRunnerPath('GITHUB_PATH', process.env.GITHUB_PATH)
fileMap.pushRunnerPath('GITHUB_OUTPUT', process.env.GITHUB_OUTPUT)
fileMap.pushRunnerPath('GITHUB_STATE', process.env.GITHUB_STATE)
fileMap.pushRunnerPath('GITHUB_STEP_SUMMARY', process.env.GITHUB_STEP_SUMMARY)
const command = fileMap.pushRunnerPath(
'CONTAINER_COMMAND',
`${process.env.RUNNER_TEMP}/command_${uuidv4()}`
)
fileMap.pushRunnerPath('GITHUB_ENV', process.env.GITHUB_ENV)
fileMap.pushRunnerPath('GITHUB_PATH', process.env.GITHUB_PATH)
fileMap.pushRunnerPath('GITHUB_OUTPUT', process.env.GITHUB_OUTPUT)
fileMap.pushRunnerPath('GITHUB_STATE', process.env.GITHUB_STATE)
fileMap.pushRunnerPath('GITHUB_STEP_SUMMARY', process.env.GITHUB_STEP_SUMMARY)
const command = fileMap.pushRunnerPath(
'CONTAINER_COMMAND',
`${process.env.RUNNER_TEMP}/command_${uuidv4()}`
)

export async function runContainer(): Promise<void> {
fs.writeFileSync(command!.runner.path, input.get('run'), {mode: 0o755})
core.info(`
Wrote instruction file to "${command!.runner.path}"
Expand All @@ -26,6 +27,7 @@ with these instructions:
${fs.readFileSync(command!.runner.path).toString()}
----- END OF FILE -----`)

// run the command
await exec.exec('docker', [
`run`,
// default network
Expand All @@ -48,7 +50,6 @@ ${fs.readFileSync(command!.runner.path).toString()}
...input.getVolumes(),
// other options
...input.getSplittet('options'),
//'--cap-add=DAC_OVERRIDE',
input.get('image'),
input.get('shell'),
'-e',
Expand Down

0 comments on commit d92d193

Please sign in to comment.