From cf16ea250e75963fae0fa2b01052ca6c51bb14ff Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:49:12 -0700 Subject: [PATCH] chore: enable 'HMAC-SHA256' signatures on turborepo artifacts (#6526) --- scripts/turbo/index.js | 11 +++++++---- turbo.json | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/turbo/index.js b/scripts/turbo/index.js index e1086f8c7f0c..1bf55e046dc3 100644 --- a/scripts/turbo/index.js +++ b/scripts/turbo/index.js @@ -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, "..", ".."); @@ -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", }), @@ -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 }); } }; diff --git a/turbo.json b/turbo.json index 175e7a9e859a..7147c0561fd0 100644 --- a/turbo.json +++ b/turbo.json @@ -1,6 +1,8 @@ { "$schema": "https://turbo.build/schema.json", - "remoteCache": {}, + "remoteCache": { + "signature": true + }, "tasks": { "build": { "outputs": ["dist-types/**", "dist-cjs/**", "dist-es/**"],