pull/235/head
mdugdale 2021-04-07 22:00:21 +01:00
parent 8d8f10f6f6
commit 1f747fb338
3 changed files with 7 additions and 11 deletions

8
dist/index.js vendored
View File

@ -267,7 +267,7 @@ class AWS {
# if library directory doesn't exist create it, # if library directory doesn't exist create it,
if [ ! -d "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" ]; then if [ ! -d "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" ]; then
echo 'Creating Library folder' echo "Creating Library folder"
mkdir "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" mkdir "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library"
else else
echo 'Library folder already present, make sure you setup .gitignore correctly (cleaning out Library folder for this build)!' echo 'Library folder already present, make sure you setup .gitignore correctly (cleaning out Library folder for this build)!'
@ -660,18 +660,16 @@ class AWS {
const logBaseUrl = `https://${SDK.config.region}.console.aws.amazon.com/cloudwatch/home?region=${SDK.config.region}#logsV2:log-groups/log-group/${taskDef.taskDefStackName}`; const logBaseUrl = `https://${SDK.config.region}.console.aws.amazon.com/cloudwatch/home?region=${SDK.config.region}#logsV2:log-groups/log-group/${taskDef.taskDefStackName}`;
core.info(`You can also see the logs at AWS Cloud Watch: ${logBaseUrl}`); core.info(`You can also see the logs at AWS Cloud Watch: ${logBaseUrl}`);
let readingLogs = true; let readingLogs = true;
const timestampReady = (t1, t2, tlimit) => {
return t2 - t1 / 1000 < tlimit;
};
let timestamp = 0; let timestamp = 0;
while (readingLogs) { while (readingLogs) {
yield new Promise((resolve) => setTimeout(resolve, 1500)); yield new Promise((resolve) => setTimeout(resolve, 1500));
const taskData = yield getTaskData(); const taskData = yield getTaskData();
if ((taskData === null || taskData === void 0 ? void 0 : taskData.lastStatus) !== 'RUNNING') { if ((taskData === null || taskData === void 0 ? void 0 : taskData.lastStatus) !== 'RUNNING') {
if (timestamp == 0) { if (timestamp == 0) {
core.info('Task stopped, streaming end of logs');
timestamp = Date.now(); timestamp = Date.now();
} }
if (timestampReady(timestamp, Date.now(), 30)) { if (Date.now() - timestamp < 30000) {
core.info('Task status is not RUNNING for 30 seconds, last query for logs'); core.info('Task status is not RUNNING for 30 seconds, last query for logs');
readingLogs = false; readingLogs = false;
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,7 @@ class AWS {
# if library directory doesn't exist create it, # if library directory doesn't exist create it,
if [ ! -d "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" ]; then if [ ! -d "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" ]; then
echo 'Creating Library folder' echo "Creating Library folder"
mkdir "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library" mkdir "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library"
else else
echo 'Library folder already present, make sure you setup .gitignore correctly (cleaning out Library folder for this build)!' echo 'Library folder already present, make sure you setup .gitignore correctly (cleaning out Library folder for this build)!'
@ -537,18 +537,16 @@ class AWS {
core.info(`You can also see the logs at AWS Cloud Watch: ${logBaseUrl}`); core.info(`You can also see the logs at AWS Cloud Watch: ${logBaseUrl}`);
let readingLogs = true; let readingLogs = true;
const timestampReady = (t1, t2, tlimit) => {
return t2 - t1 / 1000 < tlimit;
};
let timestamp: number = 0; let timestamp: number = 0;
while (readingLogs) { while (readingLogs) {
await new Promise((resolve) => setTimeout(resolve, 1500)); await new Promise((resolve) => setTimeout(resolve, 1500));
const taskData = await getTaskData(); const taskData = await getTaskData();
if (taskData?.lastStatus !== 'RUNNING') { if (taskData?.lastStatus !== 'RUNNING') {
if (timestamp == 0) { if (timestamp == 0) {
core.info('Task stopped, streaming end of logs');
timestamp = Date.now(); timestamp = Date.now();
} }
if (timestampReady(timestamp, Date.now(), 30)) { if (Date.now() - timestamp < 30000) {
core.info('Task status is not RUNNING for 30 seconds, last query for logs'); core.info('Task status is not RUNNING for 30 seconds, last query for logs');
readingLogs = false; readingLogs = false;
} }