AWS log hose
parent
45f9a907ae
commit
0c952a745e
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
|
@ -17,10 +17,11 @@
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "1.0.4",
|
"@actions/exec": "1.0.4",
|
||||||
"@actions/github": "^2.1.1",
|
"@actions/github": "^2.1.1",
|
||||||
|
"aws-sdk": "^2.812.0",
|
||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
|
"cloudwatch-logs-hose": "0.0.2",
|
||||||
"kubernetes-client": "^9.0.0",
|
"kubernetes-client": "^9.0.0",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
"aws-sdk": "^2.812.0",
|
|
||||||
"websocket": "^1.0.33"
|
"websocket": "^1.0.33"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import * as SDK from 'aws-sdk';
|
||||||
const WebSocketClient = require('websocket').client;
|
const WebSocketClient = require('websocket').client;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
const hose = require('cloudwatch-logs-hose');
|
||||||
|
|
||||||
class AWS {
|
class AWS {
|
||||||
static async runBuildJob(buildParameters, baseImage) {
|
static async runBuildJob(buildParameters, baseImage) {
|
||||||
|
|
@ -126,32 +127,18 @@ class AWS {
|
||||||
core.info(`Build job is running, `);
|
core.info(`Build job is running, `);
|
||||||
|
|
||||||
// watching logs
|
// watching logs
|
||||||
const taskDescriptions = await ECS.describeTasks({
|
const source = new hose.Source({
|
||||||
tasks: [task.tasks[0].taskArn],
|
LogGroup: '/aws/lambda/MINUS-49dda359e9abcd4e180f73bd8ba7e2f9',
|
||||||
cluster: clusterName,
|
aws: { region: 'us-west-2' },
|
||||||
}).promise();
|
|
||||||
const networkInterfaces = await EC2.describeNetworkInterfaces({
|
|
||||||
NetworkInterfaceIds: [
|
|
||||||
taskDescriptions.tasks[0].attachments
|
|
||||||
.find((x) => x.type === 'ElasticNetworkInterface')
|
|
||||||
.details.find((x) => x.name === 'networkInterfaceId').value,
|
|
||||||
],
|
|
||||||
}).promise();
|
|
||||||
core.info(JSON.stringify(networkInterfaces.NetworkInterfaces[0].Association.PublicIp));
|
|
||||||
const client = new WebSocketClient(
|
|
||||||
`ws://${networkInterfaces.NetworkInterfaces[0].Association.PublicIp}:80`,
|
|
||||||
);
|
|
||||||
client.on('connect', (con) => {
|
|
||||||
con.on('message', (message) => {
|
|
||||||
core.info(message);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// await this.watch(async () => {
|
source.on('logs', AWS.onlog);
|
||||||
// return (
|
|
||||||
// await ECS.describeTasks({ tasks: [task.tasks[0].taskArn], cluster: clusterName }).promise()
|
source.on('error', (error) => {
|
||||||
// ).tasks[0].lastStatus;
|
core.info('Error: ', error);
|
||||||
// }, 'example');
|
});
|
||||||
|
|
||||||
|
source.open();
|
||||||
|
|
||||||
await ECS.waitFor('tasksStopped', {
|
await ECS.waitFor('tasksStopped', {
|
||||||
cluster: clusterName,
|
cluster: clusterName,
|
||||||
|
|
@ -160,5 +147,9 @@ class AWS {
|
||||||
|
|
||||||
core.info('Build job has ended');
|
core.info('Build job has ended');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static onlog(batch){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export default AWS;
|
export default AWS;
|
||||||
|
|
|
||||||
35
yarn.lock
35
yarn.lock
|
|
@ -1372,6 +1372,20 @@ atob@^2.1.2:
|
||||||
version "2.1.2"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
||||||
|
|
||||||
|
aws-sdk@^2.1.14:
|
||||||
|
version "2.839.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.839.0.tgz#74e9697e5dcb2d116032363ad80f5b705759fafb"
|
||||||
|
dependencies:
|
||||||
|
buffer "4.9.2"
|
||||||
|
events "1.1.1"
|
||||||
|
ieee754 "1.1.13"
|
||||||
|
jmespath "0.15.0"
|
||||||
|
querystring "0.2.0"
|
||||||
|
sax "1.2.1"
|
||||||
|
url "0.10.3"
|
||||||
|
uuid "3.3.2"
|
||||||
|
xml2js "0.4.19"
|
||||||
|
|
||||||
aws-sdk@^2.812.0:
|
aws-sdk@^2.812.0:
|
||||||
version "2.834.0"
|
version "2.834.0"
|
||||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.834.0.tgz#1d9f8ed7cf2ed885041142d67e29f45cbb8621b7"
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.834.0.tgz#1d9f8ed7cf2ed885041142d67e29f45cbb8621b7"
|
||||||
|
|
@ -1745,6 +1759,13 @@ clone@^1.0.2:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
||||||
|
|
||||||
|
cloudwatch-logs-hose@0.0.2:
|
||||||
|
version "0.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/cloudwatch-logs-hose/-/cloudwatch-logs-hose-0.0.2.tgz#711b3e5e8dd2ade4505796a6b33aaae4b93c0234"
|
||||||
|
dependencies:
|
||||||
|
aws-sdk "^2.1.14"
|
||||||
|
jasmine "^2.2.1"
|
||||||
|
|
||||||
co@^4.6.0:
|
co@^4.6.0:
|
||||||
version "4.6.0"
|
version "4.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
|
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
|
||||||
|
|
@ -2690,7 +2711,7 @@ glob-parent@^5.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
|
|
||||||
glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
glob@^7.0.0, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
||||||
version "7.1.6"
|
version "7.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -3166,6 +3187,18 @@ istanbul-reports@^3.0.2:
|
||||||
html-escaper "^2.0.0"
|
html-escaper "^2.0.0"
|
||||||
istanbul-lib-report "^3.0.0"
|
istanbul-lib-report "^3.0.0"
|
||||||
|
|
||||||
|
jasmine-core@~2.99.0:
|
||||||
|
version "2.99.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.1.tgz#e6400df1e6b56e130b61c4bcd093daa7f6e8ca15"
|
||||||
|
|
||||||
|
jasmine@^2.2.1:
|
||||||
|
version "2.99.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.99.0.tgz#8ca72d102e639b867c6489856e0e18a9c7aa42b7"
|
||||||
|
dependencies:
|
||||||
|
exit "^0.1.2"
|
||||||
|
glob "^7.0.6"
|
||||||
|
jasmine-core "~2.99.0"
|
||||||
|
|
||||||
jest-changed-files@^25.5.0:
|
jest-changed-files@^25.5.0:
|
||||||
version "25.5.0"
|
version "25.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.5.0.tgz#141cc23567ceb3f534526f8614ba39421383634c"
|
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.5.0.tgz#141cc23567ceb3f534526f8614ba39421383634c"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue