Skip to content

Commit 7eb4e50

Browse files
authored
Merge pull request #36 from brave-intl/optional-repro-nix
Nix parameter for triggering reproducible Nix buildspec
2 parents 95b0bdf + c240aee commit 7eb4e50

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

code-build.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async function build(sdk, params, config) {
5757
branch: params.branch,
5858
sourceVersion: params.sourceVersion,
5959
reproducible: params.reproducible,
60+
useNix: params.useNix,
6061
gpSshPrivateKeyB64: params.gpSshPrivateKeyB64,
6162
imageTag,
6263
}),
@@ -101,15 +102,15 @@ async function waitForBuildEndTime(
101102
})
102103
),
103104
!hideCloudWatchLogs &&
104-
logGroupName &&
105-
cloudWatchLogs.send(
106-
new GetLogEventsCommand({
107-
logGroupName,
108-
logStreamName,
109-
startFromHead,
110-
nextToken,
111-
})
112-
),
105+
logGroupName &&
106+
cloudWatchLogs.send(
107+
new GetLogEventsCommand({
108+
logGroupName,
109+
logStreamName,
110+
startFromHead,
111+
nextToken,
112+
})
113+
),
113114
]).catch((err) => {
114115
errObject = err;
115116
/* Returning [] here so that the assignment above
@@ -206,9 +207,13 @@ function githubInputs() {
206207

207208
// default to non-reproducible builds
208209
var reproducible = false;
210+
var useNix = false;
209211
if (process.env[`REPRODUCIBLE`] == "true") {
210212
// we want a reproducible build
211213
reproducible = true;
214+
if (process.env[`USE_NIX`] == "true") {
215+
useNix = true;
216+
}
212217
}
213218

214219
const { payload } = github.context;
@@ -252,6 +257,7 @@ function githubInputs() {
252257
branch,
253258
sourceVersion,
254259
reproducible,
260+
useNix,
255261
updateInterval,
256262
updateBackOff,
257263
hideCloudWatchLogs,
@@ -267,6 +273,7 @@ function inputs2Parameters(inputs) {
267273
branch,
268274
sourceVersion,
269275
reproducible,
276+
useNix,
270277
gpSshPrivateKeyB64,
271278
} = inputs;
272279

@@ -278,6 +285,7 @@ function inputs2Parameters(inputs) {
278285
branch,
279286
sourceVersion,
280287
reproducible,
288+
useNix,
281289
gpSshPrivateKeyB64,
282290
};
283291
}

dist/index.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ async function build(sdk, params, config) {
6363
branch: params.branch,
6464
sourceVersion: params.sourceVersion,
6565
reproducible: params.reproducible,
66+
useNix: params.useNix,
6667
gpSshPrivateKeyB64: params.gpSshPrivateKeyB64,
6768
imageTag,
6869
}),
@@ -107,15 +108,15 @@ async function waitForBuildEndTime(
107108
})
108109
),
109110
!hideCloudWatchLogs &&
110-
logGroupName &&
111-
cloudWatchLogs.send(
112-
new GetLogEventsCommand({
113-
logGroupName,
114-
logStreamName,
115-
startFromHead,
116-
nextToken,
117-
})
118-
),
111+
logGroupName &&
112+
cloudWatchLogs.send(
113+
new GetLogEventsCommand({
114+
logGroupName,
115+
logStreamName,
116+
startFromHead,
117+
nextToken,
118+
})
119+
),
119120
]).catch((err) => {
120121
errObject = err;
121122
/* Returning [] here so that the assignment above
@@ -212,9 +213,13 @@ function githubInputs() {
212213

213214
// default to non-reproducible builds
214215
var reproducible = false;
216+
var useNix = false;
215217
if (process.env[`REPRODUCIBLE`] == "true") {
216218
// we want a reproducible build
217219
reproducible = true;
220+
if (process.env[`USE_NIX`] == "true") {
221+
useNix = true;
222+
}
218223
}
219224

220225
const { payload } = github.context;
@@ -258,6 +263,7 @@ function githubInputs() {
258263
branch,
259264
sourceVersion,
260265
reproducible,
266+
useNix,
261267
updateInterval,
262268
updateBackOff,
263269
hideCloudWatchLogs,
@@ -273,6 +279,7 @@ function inputs2Parameters(inputs) {
273279
branch,
274280
sourceVersion,
275281
reproducible,
282+
useNix,
276283
gpSshPrivateKeyB64,
277284
} = inputs;
278285

@@ -284,6 +291,7 @@ function inputs2Parameters(inputs) {
284291
branch,
285292
sourceVersion,
286293
reproducible,
294+
useNix,
287295
gpSshPrivateKeyB64,
288296
};
289297
}

0 commit comments

Comments
 (0)