Directly mount temp and github directories (#88)

This commit is contained in:
T.J. Corrigan 2022-10-17 15:10:53 -05:00 коммит произвёл GitHub
Родитель 8203daa2d8
Коммит e1a11d5092
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 6 добавлений и 15 удалений

2
dist/index.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -10,8 +10,6 @@ import { createScriptFile, TEMP_DIRECTORY, NullOutstreamStringWritable, deleteFi
const START_SCRIPT_EXECUTION_MARKER: string = `Starting script execution via docker image mcr.microsoft.com/azure-cli:`;
const BASH_ARG: string = `bash --noprofile --norc -e `;
const CONTAINER_WORKSPACE: string = '/github/workspace';
const CONTAINER_TEMP_DIRECTORY: string = '/_temp';
const AZ_CLI_VERSION_DEFAULT_VALUE = 'agentazcliversion'
export const run = async () => {
@ -51,7 +49,7 @@ export const run = async () => {
}
inlineScript = ` set -e >&2; echo '${START_SCRIPT_EXECUTION_MARKER}' >&2; ${inlineScript}`;
scriptFileName = await createScriptFile(inlineScript);
let startCommand: string = ` ${BASH_ARG}${CONTAINER_TEMP_DIRECTORY}/${scriptFileName} `;
let startCommand: string = ` ${BASH_ARG}${TEMP_DIRECTORY}/${scriptFileName} `;
let environmentVariables = '';
for (let key in process.env) {
// if (key.toUpperCase().startsWith("GITHUB_") && key.toUpperCase() !== 'GITHUB_WORKSPACE' && process.env[key]){
@ -59,6 +57,7 @@ export const run = async () => {
environmentVariables += ` -e "${key}=${process.env[key]}" `;
}
}
/*
For the docker run command, we are doing the following
- Set the working directory for docker continer
@ -66,15 +65,9 @@ export const run = async () => {
- voulme mount .azure session token file between host and container,
- volume mount temp directory between host and container, inline script file is created in temp directory
*/
let github_env_file_relative_path = path.relative(TEMP_DIRECTORY, process.env.GITHUB_ENV);;
const CONTAINER_GITHUB_ENV = path.resolve(CONTAINER_TEMP_DIRECTORY, github_env_file_relative_path);
let command: string = `run --workdir ${CONTAINER_WORKSPACE} -v ${process.env.GITHUB_WORKSPACE}:${CONTAINER_WORKSPACE} `;
command += ` -v ${process.env.HOME}/.azure:/root/.azure -v ${TEMP_DIRECTORY}:${CONTAINER_TEMP_DIRECTORY} `;
let command: string = `run --workdir ${process.env.GITHUB_WORKSPACE} -v ${process.env.GITHUB_WORKSPACE}:${process.env.GITHUB_WORKSPACE} `;
command += ` -v ${process.env.HOME}/.azure:/root/.azure -v ${TEMP_DIRECTORY}:${TEMP_DIRECTORY} `;
command += ` ${environmentVariables} `;
command += `-e GITHUB_WORKSPACE=${CONTAINER_WORKSPACE} `;
command += `-e GITHUB_ENV=${CONTAINER_GITHUB_ENV} `;
command += `--name ${CONTAINER_NAME} `;
command += ` mcr.microsoft.com/azure-cli:${azcliversion} ${startCommand}`;
console.log(`${START_SCRIPT_EXECUTION_MARKER}${azcliversion}`);

Просмотреть файл

@ -60,8 +60,6 @@ export const checkIfEnvironmentVariableIsOmitted = (key: string): boolean => {
'GPG_KEY',
'CONDA',
'AGENT_TOOLSDIRECTORY',
'GITHUB_WORKSPACE',
'GITHUB_ENV',
'RUNNER_PERFLOG',
'RUNNER_WORKSPACE',
'RUNNER_TEMP',
@ -94,4 +92,4 @@ export const checkIfEnvironmentVariableIsOmitted = (key: string): boolean => {
}
return omitEnvironmentVariablesWithPrefix.some((prefix: string) => key.toUpperCase().startsWith(prefix));
}
}