mirror of
https://github.com/actions/runner.git
synced 2025-12-12 05:37:01 +00:00
.
This commit is contained in:
@@ -51,15 +51,33 @@ async function run(): Promise<void> {
|
|||||||
// -v "/home/runner/work/_temp/_github_home":"/github/home"
|
// -v "/home/runner/work/_temp/_github_home":"/github/home"
|
||||||
// -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
|
// -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
|
||||||
// --entrypoint "tail" node:10.16-jessie "-f" "/dev/null"
|
// --entrypoint "tail" node:10.16-jessie "-f" "/dev/null"
|
||||||
const containerId = await exec.getExecOutput('podman', [
|
const creatArgs = ['create']
|
||||||
'create',
|
creatArgs.push(`--workdir=${jobContainer.containerWorkDirectory}`)
|
||||||
// `--workdir ${jobContainer.containerWorkDirectory}`,
|
creatArgs.push(`--network=${networkName}`)
|
||||||
`--network=${networkName}`,
|
creatArgs.push(`--entrypoint=${jobContainer.containerEntryPoint}`)
|
||||||
// `-v /Users/ting/Desktop/runner/_layout/_work:/__w`,
|
|
||||||
`--entrypoint=${jobContainer.containerEntryPoint}`,
|
for (const mountVolume of jobContainer.mountVolumes) {
|
||||||
`${containerImage}`,
|
creatArgs.push(
|
||||||
`${jobContainer.containerEntryPointArgs}`
|
`-v=${mountVolume.sourceVolumePath}:${mountVolume.targetVolumePath}`
|
||||||
])
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
creatArgs.push(containerImage)
|
||||||
|
creatArgs.push(jobContainer.containerEntryPointArgs)
|
||||||
|
|
||||||
|
core.debug(JSON.stringify(creatArgs))
|
||||||
|
|
||||||
|
// const containerId = await exec.getExecOutput('podman', [
|
||||||
|
// 'create',
|
||||||
|
// // `--workdir ${jobContainer.containerWorkDirectory}`,
|
||||||
|
// `--network=${networkName}`,
|
||||||
|
// // `-v=/Users/ting/Desktop/runner/_layout/_work:/__w`,
|
||||||
|
// `--entrypoint=${jobContainer.containerEntryPoint}`,
|
||||||
|
// `${containerImage}`,
|
||||||
|
// `${jobContainer.containerEntryPointArgs}`
|
||||||
|
// ])
|
||||||
|
|
||||||
|
const containerId = await exec.getExecOutput('podman', creatArgs)
|
||||||
|
|
||||||
core.debug(JSON.stringify(containerId))
|
core.debug(JSON.stringify(containerId))
|
||||||
|
|
||||||
@@ -78,7 +96,9 @@ async function run(): Promise<void> {
|
|||||||
const output = JSON.stringify({CreationOutput: creationOutput})
|
const output = JSON.stringify({CreationOutput: creationOutput})
|
||||||
core.debug(output)
|
core.debug(output)
|
||||||
|
|
||||||
process.stderr.write(output)
|
process.stderr.write(
|
||||||
|
`___CONTAINER_ENGINE_HANDLER_OUTPUT___${output}___CONTAINER_ENGINE_HANDLER_OUTPUT___`
|
||||||
|
)
|
||||||
} else if (command === 'Remove') {
|
} else if (command === 'Remove') {
|
||||||
const removeInput = inputJson.removeInput
|
const removeInput = inputJson.removeInput
|
||||||
core.debug(JSON.stringify(removeInput))
|
core.debug(JSON.stringify(removeInput))
|
||||||
@@ -91,7 +111,7 @@ async function run(): Promise<void> {
|
|||||||
// else if (command === 'Exec') {
|
// else if (command === 'Exec') {
|
||||||
// }
|
// }
|
||||||
await exec.exec('podman', ['network', 'ls'])
|
await exec.exec('podman', ['network', 'ls'])
|
||||||
await exec.exec('podman', ['network', 'ps', '-a'])
|
await exec.exec('podman', ['ps', '-a'])
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|||||||
@@ -1089,15 +1089,26 @@ function run() {
|
|||||||
// -v "/home/runner/work/_temp/_github_home":"/github/home"
|
// -v "/home/runner/work/_temp/_github_home":"/github/home"
|
||||||
// -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
|
// -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
|
||||||
// --entrypoint "tail" node:10.16-jessie "-f" "/dev/null"
|
// --entrypoint "tail" node:10.16-jessie "-f" "/dev/null"
|
||||||
const containerId = yield exec.getExecOutput('podman', [
|
const creatArgs = ['create'];
|
||||||
'create',
|
creatArgs.push(`--workdir=${jobContainer.containerWorkDirectory}`);
|
||||||
// `--workdir ${jobContainer.containerWorkDirectory}`,
|
creatArgs.push(`--network=${networkName}`);
|
||||||
`--network=${networkName}`,
|
creatArgs.push(`--entrypoint=${jobContainer.containerEntryPoint}`);
|
||||||
// `-v /Users/ting/Desktop/runner/_layout/_work:/__w`,
|
for (const mountVolume of jobContainer.mountVolumes) {
|
||||||
`--entrypoint=${jobContainer.containerEntryPoint}`,
|
creatArgs.push(`-v=${mountVolume.sourceVolumePath}:${mountVolume.targetVolumePath}`);
|
||||||
`${containerImage}`,
|
}
|
||||||
`${jobContainer.containerEntryPointArgs}`
|
creatArgs.push(containerImage);
|
||||||
]);
|
creatArgs.push(jobContainer.containerEntryPointArgs);
|
||||||
|
core.debug(JSON.stringify(creatArgs));
|
||||||
|
// const containerId = await exec.getExecOutput('podman', [
|
||||||
|
// 'create',
|
||||||
|
// // `--workdir ${jobContainer.containerWorkDirectory}`,
|
||||||
|
// `--network=${networkName}`,
|
||||||
|
// // `-v=/Users/ting/Desktop/runner/_layout/_work:/__w`,
|
||||||
|
// `--entrypoint=${jobContainer.containerEntryPoint}`,
|
||||||
|
// `${containerImage}`,
|
||||||
|
// `${jobContainer.containerEntryPointArgs}`
|
||||||
|
// ])
|
||||||
|
const containerId = yield exec.getExecOutput('podman', creatArgs);
|
||||||
core.debug(JSON.stringify(containerId));
|
core.debug(JSON.stringify(containerId));
|
||||||
// podman start {containerId}
|
// podman start {containerId}
|
||||||
yield exec.exec('podman', ['start', containerId.stdout.trim()]);
|
yield exec.exec('podman', ['start', containerId.stdout.trim()]);
|
||||||
@@ -1109,7 +1120,7 @@ function run() {
|
|||||||
};
|
};
|
||||||
const output = JSON.stringify({ CreationOutput: creationOutput });
|
const output = JSON.stringify({ CreationOutput: creationOutput });
|
||||||
core.debug(output);
|
core.debug(output);
|
||||||
process.stderr.write(output);
|
process.stderr.write(`___CONTAINER_ENGINE_HANDLER_OUTPUT___${output}___CONTAINER_ENGINE_HANDLER_OUTPUT___`);
|
||||||
}
|
}
|
||||||
else if (command === 'Remove') {
|
else if (command === 'Remove') {
|
||||||
const removeInput = inputJson.removeInput;
|
const removeInput = inputJson.removeInput;
|
||||||
@@ -1122,7 +1133,7 @@ function run() {
|
|||||||
// else if (command === 'Exec') {
|
// else if (command === 'Exec') {
|
||||||
// }
|
// }
|
||||||
yield exec.exec('podman', ['network', 'ls']);
|
yield exec.exec('podman', ['network', 'ls']);
|
||||||
yield exec.exec('podman', ['network', 'ps', '-a']);
|
yield exec.exec('podman', ['ps', '-a']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
run();
|
||||||
|
|||||||
@@ -161,11 +161,11 @@ namespace GitHub.Runner.Worker
|
|||||||
processInvoker.ErrorDataReceived += delegate (object sender, ProcessDataReceivedEventArgs message)
|
processInvoker.ErrorDataReceived += delegate (object sender, ProcessDataReceivedEventArgs message)
|
||||||
{
|
{
|
||||||
executionContext.Output(message.Data);
|
executionContext.Output(message.Data);
|
||||||
if (podmanOutput == null)
|
if (podmanOutput == null && message.Data.IndexOf("___CONTAINER_ENGINE_HANDLER_OUTPUT___") >= 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
podmanOutput = JsonUtility.FromString<ContainerEngineHandlerOutput>(message.Data);
|
podmanOutput = JsonUtility.FromString<ContainerEngineHandlerOutput>(message.Data.Replace("___CONTAINER_ENGINE_HANDLER_OUTPUT___", ""));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -335,11 +335,11 @@ namespace GitHub.Runner.Worker
|
|||||||
processInvoker.ErrorDataReceived += delegate (object sender, ProcessDataReceivedEventArgs message)
|
processInvoker.ErrorDataReceived += delegate (object sender, ProcessDataReceivedEventArgs message)
|
||||||
{
|
{
|
||||||
executionContext.Output(message.Data);
|
executionContext.Output(message.Data);
|
||||||
if (podmanOutput == null)
|
if (podmanOutput == null && message.Data.IndexOf("___CONTAINER_ENGINE_HANDLER_OUTPUT___") >= 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
podmanOutput = JsonUtility.FromString<ContainerEngineHandlerOutput>(message.Data);
|
podmanOutput = JsonUtility.FromString<ContainerEngineHandlerOutput>(message.Data.Replace("___CONTAINER_ENGINE_HANDLER_OUTPUT___", ""));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user