Add chownFilesTo (#187)
* add chownFilesTo * added missing newline * added more chownFilesTopull/191/head v2.0.3
parent
e8774f3837
commit
3d5d2f5834
|
@ -48,6 +48,10 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: 'Test Results'
|
default: 'Test Results'
|
||||||
description: 'Name for the check run that is created when a github token is provided.'
|
description: 'Name for the check run that is created when a github token is provided.'
|
||||||
|
chownFilesTo:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'User and optionally group (user or user:group or uid:gid) to give ownership of the resulting build artifacts'
|
||||||
outputs:
|
outputs:
|
||||||
artifactsPath:
|
artifactsPath:
|
||||||
description: 'Path where the artifacts are stored.'
|
description: 'Path where the artifacts are stored.'
|
||||||
|
|
|
@ -42,7 +42,7 @@ function run() {
|
||||||
try {
|
try {
|
||||||
model_1.Action.checkCompatibility();
|
model_1.Action.checkCompatibility();
|
||||||
const { workspace, actionFolder } = model_1.Action;
|
const { workspace, actionFolder } = model_1.Action;
|
||||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, chownFilesTo, } = model_1.Input.getFromUser();
|
||||||
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
||||||
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
||||||
try {
|
try {
|
||||||
|
@ -60,6 +60,7 @@ function run() {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
|
chownFilesTo,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -169,7 +170,7 @@ const Docker = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLinuxCommand(image, parameters) {
|
getLinuxCommand(image, parameters) {
|
||||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
if (!(0, fs_1.existsSync)(githubHome))
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
(0, fs_1.mkdirSync)(githubHome);
|
||||||
|
@ -208,6 +209,7 @@ const Docker = {
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}:/root:z" \
|
--volume "${githubHome}:/root:z" \
|
||||||
--volume "${githubWorkflow}:/github/workflow:z" \
|
--volume "${githubWorkflow}:/github/workflow:z" \
|
||||||
|
@ -222,7 +224,7 @@ const Docker = {
|
||||||
/bin/bash -c /entrypoint.sh`;
|
/bin/bash -c /entrypoint.sh`;
|
||||||
},
|
},
|
||||||
getWindowsCommand(image, parameters) {
|
getWindowsCommand(image, parameters) {
|
||||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
if (!(0, fs_1.existsSync)(githubHome))
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
(0, fs_1.mkdirSync)(githubHome);
|
||||||
|
@ -261,6 +263,7 @@ const Docker = {
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}":"c:/root" \
|
--volume "${githubHome}":"c:/root" \
|
||||||
--volume "${githubWorkflow}":"c:/github/workflow" \
|
--volume "${githubWorkflow}":"c:/github/workflow" \
|
||||||
|
@ -477,6 +480,7 @@ const Input = {
|
||||||
const gitPrivateToken = (0, core_1.getInput)('gitPrivateToken') || '';
|
const gitPrivateToken = (0, core_1.getInput)('gitPrivateToken') || '';
|
||||||
const githubToken = (0, core_1.getInput)('githubToken') || '';
|
const githubToken = (0, core_1.getInput)('githubToken') || '';
|
||||||
const checkName = (0, core_1.getInput)('checkName') || 'Test Results';
|
const checkName = (0, core_1.getInput)('checkName') || 'Test Results';
|
||||||
|
const chownFilesTo = (0, core_1.getInput)('chownFilesTo') || '';
|
||||||
// Validate input
|
// Validate input
|
||||||
if (!this.testModes.includes(testMode)) {
|
if (!this.testModes.includes(testMode)) {
|
||||||
throw new Error(`Invalid testMode ${testMode}`);
|
throw new Error(`Invalid testMode ${testMode}`);
|
||||||
|
@ -509,6 +513,7 @@ const Input = {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
|
chownFilesTo,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -114,3 +114,19 @@ for platform in ${TEST_PLATFORMS//;/ }; do
|
||||||
cat "$FULL_ARTIFACTS_PATH/$platform-results.xml" | grep test-run | grep Passed
|
cat "$FULL_ARTIFACTS_PATH/$platform-results.xml" | grep test-run | grep Passed
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Permissions
|
||||||
|
#
|
||||||
|
|
||||||
|
# Make a given user owner of all artifacts
|
||||||
|
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
||||||
|
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
|
||||||
|
chown -R "$CHOWN_FILES_TO" "$FULL_ARTIFACTS_PATH"
|
||||||
|
chown -R "$CHOWN_FILES_TO" "$FULL_COVERAGE_RESULTS_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add read permissions for everyone to all artifacts
|
||||||
|
chmod -R a+r "$UNITY_PROJECT_PATH"
|
||||||
|
chmod -R a+r "$FULL_ARTIFACTS_PATH"
|
||||||
|
chmod -R a+r "$FULL_COVERAGE_RESULTS_PATH"
|
||||||
|
|
|
@ -19,6 +19,7 @@ async function run() {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
|
chownFilesTo,
|
||||||
} = Input.getFromUser();
|
} = Input.getFromUser();
|
||||||
const baseImage = new ImageTag({ editorVersion, customImage });
|
const baseImage = new ImageTag({ editorVersion, customImage });
|
||||||
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
||||||
|
@ -38,6 +39,7 @@ async function run() {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
|
chownFilesTo,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
await Output.setArtifactsPath(artifactsPath);
|
await Output.setArtifactsPath(artifactsPath);
|
||||||
|
|
|
@ -33,6 +33,7 @@ const Docker = {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
|
chownFilesTo,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
@ -74,6 +75,7 @@ const Docker = {
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}:/root:z" \
|
--volume "${githubHome}:/root:z" \
|
||||||
--volume "${githubWorkflow}:/github/workflow:z" \
|
--volume "${githubWorkflow}:/github/workflow:z" \
|
||||||
|
@ -105,6 +107,7 @@ const Docker = {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
|
chownFilesTo,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
@ -146,6 +149,7 @@ const Docker = {
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}":"c:/root" \
|
--volume "${githubHome}":"c:/root" \
|
||||||
--volume "${githubWorkflow}":"c:/github/workflow" \
|
--volume "${githubWorkflow}":"c:/github/workflow" \
|
||||||
|
|
|
@ -26,6 +26,7 @@ const Input = {
|
||||||
const gitPrivateToken = getInput('gitPrivateToken') || '';
|
const gitPrivateToken = getInput('gitPrivateToken') || '';
|
||||||
const githubToken = getInput('githubToken') || '';
|
const githubToken = getInput('githubToken') || '';
|
||||||
const checkName = getInput('checkName') || 'Test Results';
|
const checkName = getInput('checkName') || 'Test Results';
|
||||||
|
const chownFilesTo = getInput('chownFilesTo') || '';
|
||||||
|
|
||||||
// Validate input
|
// Validate input
|
||||||
if (!this.testModes.includes(testMode)) {
|
if (!this.testModes.includes(testMode)) {
|
||||||
|
@ -65,6 +66,7 @@ const Input = {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
|
chownFilesTo,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue