From 851aa1c91eac0645a399a21ec7384ca6c6781ad7 Mon Sep 17 00:00:00 2001 From: galargh Date: Tue, 3 Sep 2024 10:40:52 +0200 Subject: [PATCH] chore: parameterise s3 build cache setup --- .github/workflows/hole-punch-interop.yml | 6 +++--- .github/workflows/transport-interop.yml | 6 +++--- hole-punch-interop/helpers/cache.ts | 7 ++++++- transport-interop/helpers/cache.ts | 7 ++++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/hole-punch-interop.yml b/.github/workflows/hole-punch-interop.yml index 723cc2327..d306da2b7 100644 --- a/.github/workflows/hole-punch-interop.yml +++ b/.github/workflows/hole-punch-interop.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/run-interop-hole-punch-test with: - s3-cache-bucket: libp2p-by-tf-aws-bootstrap - s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }} - s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }} + s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} + s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} worker-count: 16 diff --git a/.github/workflows/transport-interop.yml b/.github/workflows/transport-interop.yml index 275ebb1bf..713ce585c 100644 --- a/.github/workflows/transport-interop.yml +++ b/.github/workflows/transport-interop.yml @@ -18,9 +18,9 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/run-transport-interop-test with: - s3-cache-bucket: libp2p-by-tf-aws-bootstrap - s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }} - s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }} + s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }} + s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }} + s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }} worker-count: 16 build-without-secrets: runs-on: ubuntu-latest diff --git a/hole-punch-interop/helpers/cache.ts b/hole-punch-interop/helpers/cache.ts index a5d07fdf8..3dec0535d 100755 --- a/hole-punch-interop/helpers/cache.ts +++ b/hole-punch-interop/helpers/cache.ts @@ -1,4 +1,4 @@ -const AWS_BUCKET = process.env.AWS_BUCKET || 'libp2p-by-tf-aws-bootstrap'; +const AWS_BUCKET = process.env.AWS_BUCKET; const scriptDir = __dirname; import * as crypto from 'crypto'; @@ -73,6 +73,11 @@ async function loadCacheOrBuild(dir: string, ig: Ignore) { const cacheKey = await hashFiles(files) console.log("Cache key:", cacheKey) + if (AWS_BUCKET === "") { + console.log("Cache not found", new Error("AWS_BUCKET not set")) + return + } + if (mode == Mode.PushCache) { console.log("Pushing cache") try { diff --git a/transport-interop/helpers/cache.ts b/transport-interop/helpers/cache.ts index 697e452fb..7a47f76db 100755 --- a/transport-interop/helpers/cache.ts +++ b/transport-interop/helpers/cache.ts @@ -1,4 +1,4 @@ -const AWS_BUCKET = process.env.AWS_BUCKET || 'libp2p-by-tf-aws-bootstrap'; +const AWS_BUCKET = process.env.AWS_BUCKET; const scriptDir = __dirname; import * as crypto from 'crypto'; @@ -62,6 +62,11 @@ switch (modeStr) { const cacheKey = await hashFiles(files) console.log("Cache key:", cacheKey) + if (AWS_BUCKET === "") { + console.log("Cache not found", new Error("AWS_BUCKET not set")) + continue + } + if (mode == Mode.PushCache) { console.log("Pushing cache") try {