зеркало из https://github.com/Azure/cli.git
Directly mount temp and github directories (#88)
This commit is contained in:
Родитель
8203daa2d8
Коммит
e1a11d5092
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
15
src/main.ts
15
src/main.ts
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче