Skip to content

Commit

Permalink
chore: enable 'HMAC-SHA256' signatures on turborepo artifacts (#6526)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Sep 27, 2024
1 parent 9c3edfc commit cf16ea2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions scripts/turbo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { spawnProcess } = require("../utils/spawn-process");
const path = require("path");

const runTurbo = async (task, args, apiSecret, apiEndpoint) => {
const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey } = {}) => {
const command = ["turbo", "run", task, "--concurrency=100%", "--output-logs=hash-only"];
command.push(...args);
const turboRoot = path.join(__dirname, "..", "..");
Expand All @@ -14,8 +14,10 @@ const runTurbo = async (task, args, apiSecret, apiEndpoint) => {
...process.env,
TURBO_TELEMETRY_DISABLED: "1",
...(apiSecret &&
apiEndpoint && {
apiEndpoint &&
apiSignatureKey && {
TURBO_API: apiEndpoint,
TURBO_REMOTE_CACHE_SIGNATURE_KEY: apiSignatureKey,
TURBO_TOKEN: apiSecret,
TURBO_TEAM: "aws-sdk-js",
}),
Expand All @@ -36,13 +38,14 @@ const runTurbo = async (task, args, apiSecret, apiEndpoint) => {
const main = async () => {
const apiSecret = process.env.AWS_JSV3_TURBO_CACHE_API_SECRET;
const apiEndpoint = process.env.AWS_JSV3_TURBO_CACHE_API_ENDPOINT;
const apiSignatureKey = process.env.AWS_JSV3_TURBO_CACHE_API_SIGNATURE_KEY;

const args = process.argv.slice(2);

if (!apiSecret || !apiEndpoint) {
if (!apiSecret || !apiEndpoint || !apiSignatureKey) {
await runTurbo(args[0], args.slice(1));
} else {
await runTurbo(args[0], args.slice(1), apiSecret, apiEndpoint);
await runTurbo(args[0], args.slice(1), { apiSecret, apiEndpoint, apiSignatureKey });
}
};

Expand Down
4 changes: 3 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"$schema": "https://turbo.build/schema.json",
"remoteCache": {},
"remoteCache": {
"signature": true
},
"tasks": {
"build": {
"outputs": ["dist-types/**", "dist-cjs/**", "dist-es/**"],
Expand Down

0 comments on commit cf16ea2

Please sign in to comment.