Skip to content

Commit ba2cc5d

Browse files
authored
chore(build): set cache read/write based on build type (#6852)
1 parent 9ad490a commit ba2cc5d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Diff for: scripts/turbo/index.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ const path = require("path");
44

55
const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey } = {}) => {
66
const command = ["turbo", "run", task, "--concurrency=100%", "--output-logs=hash-only"];
7+
8+
const cacheReadWriteKey = process.env.AWS_JSV3_TURBO_CACHE_BUILD_TYPE ?? "dev";
9+
10+
const cacheReadWrite = {
11+
// Release is remote write-only.
12+
// Every release has unique artifacts and should not read from the cache.
13+
RELEASE: "--cache=local:,remote:w",
14+
// preview is remote read/write
15+
PREVIEW: "--cache=local:,remote:rw",
16+
// dev is local read/write and remote read-only
17+
dev: "--cache=local:rw,remote:r",
18+
};
19+
20+
command.push(cacheReadWrite[cacheReadWriteKey]);
721
command.push(...args);
22+
823
const turboRoot = path.join(__dirname, "..", "..");
924

1025
const turboEnv = {
@@ -18,9 +33,6 @@ const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey }
1833
TURBO_TOKEN: apiSecret,
1934
TURBO_TEAM: "aws-sdk-js",
2035
}),
21-
...(!process.env.CODEBUILD_BUILD_ARN && {
22-
TURBO_REMOTE_CACHE_READ_ONLY: "1",
23-
}),
2436
};
2537

2638
try {

0 commit comments

Comments
 (0)