fix: op not permitted in self-hosted runner (#359)

In self hosted runners in fedora with SELinux enabled,
it sometimes gives a random error
```
Error: lsetxattr /var/run/docker.sock: operation not permitted

Error: The process '/usr/bin/docker' failed with exit code 126
```

This seems to happen with docker.sock which is a link to
/run/podman/podman.sock
looks like lsetxattr is broken for links.
pull/361/head
Paul Pacheco 2022-03-23 13:41:57 -05:00 committed by GitHub
parent efa2eddee9
commit 8ed8ccb20c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4331 additions and 4322 deletions

21
dist/index.js generated vendored
View File

@ -3286,13 +3286,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const exec_1 = __nccwpck_require__(71514);
const image_tag_1 = __importDefault(__nccwpck_require__(57648));
const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
const fs_1 = __nccwpck_require__(57147);
const path_1 = __importDefault(__nccwpck_require__(71017));
class Docker {
static build(buildParameters, silent = false) {
return __awaiter(this, void 0, void 0, function* () {
const { path, dockerfile, baseImage } = buildParameters;
const { path: buildPath, dockerfile, baseImage } = buildParameters;
const { version, platform } = baseImage;
const tag = new image_tag_1.default({ repository: '', name: 'unity-builder', version, platform });
const command = `docker build ${path} \
const command = `docker build ${buildPath} \
--file ${dockerfile} \
--build-arg IMAGE=${baseImage} \
--tag ${tag}`;
@ -3315,16 +3317,23 @@ class Docker {
}
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent) {
switch (baseOs) {
case 'linux':
case 'linux': {
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
if (!fs_1.existsSync(githubHome))
fs_1.mkdirSync(githubHome);
const githubWorkflow = path_1.default.join(runnerTemporaryPath, '_github_workflow');
if (!fs_1.existsSync(githubWorkflow))
fs_1.mkdirSync(githubWorkflow);
return `--env UNITY_SERIAL \
--env GITHUB_WORKSPACE=/github/workspace \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "${runnerTemporaryPath}/_github_home":"/root" \
--volume "${runnerTemporaryPath}/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
--volume "${githubHome}":"/root:z" \
--volume "${githubWorkflow}":"/github/workflow:z" \
--volume "${workspace}":"/github/workspace:z" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
}
case 'win32':
return `--env UNITY_SERIAL="${unitySerial}" \
--env GITHUB_WORKSPACE=c:/github/workspace \

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -52,7 +52,7 @@ class Docker {
return `--env UNITY_SERIAL \
--env GITHUB_WORKSPACE=/github/workspace \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock:z" \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "${githubHome}":"/root:z" \
--volume "${githubWorkflow}":"/github/workflow:z" \
--volume "${workspace}":"/github/workspace:z" \