Skip to content

Commit

Permalink
chore: parameterise s3 build cache setup
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Sep 3, 2024
1 parent 50b451f commit 851aa1c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/hole-punch-interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/transport-interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion hole-punch-interop/helpers/cache.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 6 additions & 1 deletion transport-interop/helpers/cache.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 851aa1c

Please sign in to comment.