Better log names

pull/235/head
mdugdale 2021-04-03 17:38:23 +01:00
parent 513fd1efb6
commit 9eaf1c1718
3 changed files with 15 additions and 15 deletions

14
dist/index.js vendored
View File

@ -444,7 +444,7 @@ class AWS {
return __awaiter(this, void 0, void 0, function* () {
const imageStackName = image.replace(/[^\da-z]/gi, '');
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
const taskDefStackName = `${stackName}-${imageStackName}-build-${buildUidStackName}`;
const taskDefStackName = `${stackName}-${imageStackName}-${buildUidStackName}-build`;
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
yield CF.createStack({
StackName: taskDefStackName,
@ -481,7 +481,7 @@ class AWS {
...secrets,
],
}).promise();
core.info('Creating build cluster...');
core.info('Creating worker cluster...');
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
const cleanupCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
yield CF.createStack({
@ -519,7 +519,7 @@ class AWS {
}).promise();
const baseResources = yield CF.describeStackResources({ StackName: stackName }).promise();
// in the future we should offer a parameter to choose if you want the guarnteed shutdown.
core.info('Build cluster created successfully (skipping wait for cleanup cluster to be ready)');
core.info('Worker cluster created successfully (skipping wait for cleanup cluster to be ready)');
return {
taskDefStackName,
taskDefCloudFormation,
@ -560,7 +560,7 @@ class AWS {
},
},
}).promise();
core.info('Build job is starting');
core.info('Task is starting');
const taskArn = ((_o = task.tasks) === null || _o === void 0 ? void 0 : _o[0].taskArn) || '';
try {
yield ECS.waitFor('tasksRunning', { tasks: [taskArn], cluster }).promise();
@ -571,11 +571,11 @@ class AWS {
tasks: [taskArn],
cluster,
}).promise();
core.info(`Build job has ended ${(_q = (_p = describeTasks.tasks) === null || _p === void 0 ? void 0 : _p[0].containers) === null || _q === void 0 ? void 0 : _q[0].lastStatus}`);
core.info(`Task has ended ${(_q = (_p = describeTasks.tasks) === null || _p === void 0 ? void 0 : _p[0].containers) === null || _q === void 0 ? void 0 : _q[0].lastStatus}`);
core.setFailed(error);
core.error(error);
}
core.info(`Build job is running`);
core.info(`Task is running`);
yield this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
yield ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (_s = (_r = (yield ECS.describeTasks({
@ -587,7 +587,7 @@ class AWS {
throw new Error(`job failed with exit code ${exitCode}`);
}
else {
core.info(`Build job has finished successfully`);
core.info(`Task has finished successfully`);
}
});
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -299,7 +299,7 @@ class AWS {
) {
const imageStackName = image.replace(/[^\da-z]/gi, '');
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
const taskDefStackName = `${stackName}-${imageStackName}-build-${buildUidStackName}`;
const taskDefStackName = `${stackName}-${imageStackName}-${buildUidStackName}-build`;
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
await CF.createStack({
StackName: taskDefStackName,
@ -336,7 +336,7 @@ class AWS {
...secrets,
],
}).promise();
core.info('Creating build cluster...');
core.info('Creating worker cluster...');
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
const cleanupCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
@ -377,7 +377,7 @@ class AWS {
const baseResources = await CF.describeStackResources({ StackName: stackName }).promise();
// in the future we should offer a parameter to choose if you want the guarnteed shutdown.
core.info('Build cluster created successfully (skipping wait for cleanup cluster to be ready)');
core.info('Worker cluster created successfully (skipping wait for cleanup cluster to be ready)');
return {
taskDefStackName,
@ -430,7 +430,7 @@ class AWS {
},
}).promise();
core.info('Build job is starting');
core.info('Task is starting');
const taskArn = task.tasks?.[0].taskArn || '';
try {
@ -441,11 +441,11 @@ class AWS {
tasks: [taskArn],
cluster,
}).promise();
core.info(`Build job has ended ${describeTasks.tasks?.[0].containers?.[0].lastStatus}`);
core.info(`Task has ended ${describeTasks.tasks?.[0].containers?.[0].lastStatus}`);
core.setFailed(error);
core.error(error);
}
core.info(`Build job is running`);
core.info(`Task is running`);
await this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
await ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (
@ -458,7 +458,7 @@ class AWS {
core.error(`job failed with exit code ${exitCode}`);
throw new Error(`job failed with exit code ${exitCode}`);
} else {
core.info(`Build job has finished successfully`);
core.info(`Task has finished successfully`);
}
}