remove trailing new lines

pull/263/head
Frostebite 2021-05-20 21:38:58 +01:00
parent 43a37a0daf
commit 2d86865cb6
3 changed files with 3 additions and 54 deletions

28
dist/index.js vendored
View File

@ -1214,12 +1214,12 @@ class AWS {
const ECS = new SDK.ECS(); const ECS = new SDK.ECS();
const CF = new SDK.CloudFormation(); const CF = new SDK.CloudFormation();
const entrypoint = ['/bin/sh']; const entrypoint = ['/bin/sh'];
const taskDef = yield this.setupCloudFormations(CF, buildId, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets); const taskDef = yield this.setupCloudFormations(CF, buildId, stackName, image, entrypoint, commands, mountdir, workingdir, secrets);
yield this.runTask(taskDef, ECS, CF, environment, buildId); yield this.runTask(taskDef, ECS, CF, environment, buildId);
yield this.cleanupResources(CF, taskDef); yield this.cleanupResources(CF, taskDef);
}); });
} }
static setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets) { static setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, secrets) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const logid = nanoid_1.customAlphabet(remote_builder_alphabet_1.default.alphabet, 9)(); const logid = nanoid_1.customAlphabet(remote_builder_alphabet_1.default.alphabet, 9)();
commands[1] += ` commands[1] += `
@ -1267,30 +1267,6 @@ class AWS {
taskDefCloudFormation.slice(indexp3), taskDefCloudFormation.slice(indexp3),
].join(''); ].join('');
} }
for (const environmentVariable of environment) {
const insertionStringKey = 'p1 - input';
const index = taskDefCloudFormation.search(insertionStringKey) + insertionStringKey.length + '\n'.length;
const parameterTemplate = `
${environmentVariable.name.replace(/[^\dA-Za-z]/g, '')}:
Type: String
Default: ''
`;
taskDefCloudFormation = [
taskDefCloudFormation.slice(0, index),
parameterTemplate,
taskDefCloudFormation.slice(index),
].join('');
const insertionStringKeyContainerDef = 'template - env vars';
const indexContainerDef = taskDefCloudFormation.search(insertionStringKeyContainerDef) + insertionStringKeyContainerDef.length;
const parameterContainerDefTemplate = `
- Name: '${environmentVariable.name}'
ValueFrom: !Ref ${environmentVariable.name.replace(/[^\dA-Za-z]/g, '')}`;
taskDefCloudFormation = [
taskDefCloudFormation.slice(0, indexContainerDef),
parameterContainerDefTemplate,
taskDefCloudFormation.slice(indexContainerDef),
].join('');
}
const mappedSecrets = secrets.map((x) => { const mappedSecrets = secrets.map((x) => {
return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue };
}); });

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,6 @@ class AWS {
commands, commands,
mountdir, mountdir,
workingdir, workingdir,
environment,
secrets, secrets,
); );
@ -50,7 +49,6 @@ class AWS {
commands: string[], commands: string[],
mountdir: string, mountdir: string,
workingdir: string, workingdir: string,
environment: RemoteBuilderEnvironmentVariable[],
secrets: RemoteBuilderSecret[], secrets: RemoteBuilderSecret[],
): Promise<RemoteBuilderTaskDef> { ): Promise<RemoteBuilderTaskDef> {
const logid = customAlphabet(RemoteBuilderAlphabet.alphabet, 9)(); const logid = customAlphabet(RemoteBuilderAlphabet.alphabet, 9)();
@ -104,31 +102,6 @@ class AWS {
taskDefCloudFormation.slice(indexp3), taskDefCloudFormation.slice(indexp3),
].join(''); ].join('');
} }
for (const environmentVariable of environment) {
const insertionStringKey = 'p1 - input';
const index = taskDefCloudFormation.search(insertionStringKey) + insertionStringKey.length + '\n'.length;
const parameterTemplate = `
${environmentVariable.name.replace(/[^\dA-Za-z]/g, '')}:
Type: String
Default: ''
`;
taskDefCloudFormation = [
taskDefCloudFormation.slice(0, index),
parameterTemplate,
taskDefCloudFormation.slice(index),
].join('');
const insertionStringKeyContainerDef = 'template - env vars';
const indexContainerDef =
taskDefCloudFormation.search(insertionStringKeyContainerDef) + insertionStringKeyContainerDef.length;
const parameterContainerDefTemplate = `
- Name: '${environmentVariable.name}'
ValueFrom: !Ref ${environmentVariable.name.replace(/[^\dA-Za-z]/g, '')}`;
taskDefCloudFormation = [
taskDefCloudFormation.slice(0, indexContainerDef),
parameterContainerDefTemplate,
taskDefCloudFormation.slice(indexContainerDef),
].join('');
}
const mappedSecrets = secrets.map((x) => { const mappedSecrets = secrets.map((x) => {
return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue };
}); });