Skip to content

Commit d370d22

Browse files
committed
Update the hide-cloudwatch-logs feature
1 parent 80cf72c commit d370d22

File tree

4 files changed

+69378
-62245
lines changed

4 files changed

+69378
-62245
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ The only required input is `project-name`.
6868
When API rate-limiting is hit the back-off time, augmented with jitter, will be
6969
added to the next update interval.
7070
E.g. with update interval of 30 and back-off time of 15, upon hitting the rate-limit
71-
the next interval for the update call will be 30 + random_between(0, 15 _ 2 \*\* 0))
71+
the next interval for the update call will be 30 + random*between(0, 15 * 2 \*\* 0))
7272
seconds and if the rate-limit is hit again the next interval will be
73-
30 + random_between(0, 15 _ 2 \*\* 1) and so on.
73+
30 + random*between(0, 15 * 2 \*\* 1) and so on.
7474

7575
The default value is 15.
7676

77+
1. **hide-cloudwatch-logs** (optional) :
78+
Set to `true` if you do not want CloudWatch logs to be streamed to GitHub Action.
79+
7780
### Outputs
7881

7982
1. **aws-build-id** : The CodeBuild build ID of the build that the action ran.

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ inputs:
3131
disable-source-override:
3232
description: 'Set to `true` if you want do disable source repo override'
3333
required: false
34+
hide-cloudwatch-logs:
35+
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
36+
required: false
37+
default: false
3438
outputs:
3539
aws-build-id:
3640
description: 'The AWS CodeBuild Build ID for this build.'

code-build.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ function runBuild() {
2222

2323
const inputs = githubInputs();
2424

25-
const config = (({ updateInterval, updateBackOff }) => ({
25+
const config = (({ updateInterval, updateBackOff, hideCloudwatchLogs }) => ({
2626
updateInterval,
2727
updateBackOff,
28+
hideCloudwatchLogs,
2829
}))(inputs);
2930

3031
// Get input options for startBuild
@@ -44,7 +45,7 @@ async function build(sdk, params, config) {
4445
async function waitForBuildEndTime(
4546
sdk,
4647
{ id, logs },
47-
{ updateInterval, updateBackOff },
48+
{ updateInterval, updateBackOff, hideCloudwatchLogs },
4849
seqEmptyLogs,
4950
totalEvents,
5051
throttleCount,
@@ -62,13 +63,12 @@ async function waitForBuildEndTime(
6263
const { logGroupName, logStreamName } = logName(cloudWatchLogsArn);
6364

6465
let errObject = false;
65-
6666
// Check the state
6767
const [batch, cloudWatch = {}] = await Promise.all([
6868
codeBuild.batchGetBuilds({ ids: [id] }).promise(),
69-
// The CloudWatchLog _may_ not be set up, only make the call if we have a logGroupName
70-
logGroupName &&
71-
cloudWatchLogs
69+
!hideCloudwatchLogs &&
70+
logGroupName &&
71+
cloudWatchLogs // only make the call if hideCloudwatchLogs is not enabled and a logGroupName exists
7272
.getLogEvents({
7373
logGroupName,
7474
logStreamName,
@@ -155,7 +155,7 @@ async function waitForBuildEndTime(
155155
return waitForBuildEndTime(
156156
sdk,
157157
current,
158-
{ updateInterval, updateBackOff },
158+
{ updateInterval, updateBackOff, hideCloudwatchLogs },
159159
seqEmptyLogs,
160160
totalEvents,
161161
throttleCount,
@@ -210,6 +210,9 @@ function githubInputs() {
210210
10
211211
) * 1000;
212212

213+
const hideCloudwatchLogs =
214+
core.getInput("hide-cloudwatch-logs", { required: false }) || undefined;
215+
213216
return {
214217
projectName,
215218
owner,
@@ -223,6 +226,7 @@ function githubInputs() {
223226
updateInterval,
224227
updateBackOff,
225228
disableSourceOverride,
229+
hideCloudwatchLogs,
226230
};
227231
}
228232

0 commit comments

Comments
 (0)