From 107f40847ebf29ccab6da711b7e4a3f66b446580 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 10 Mar 2023 08:41:28 -0800 Subject: [PATCH 1/9] Support readonly cache --- .github/actions/run-interop-ping-test/action.yml | 8 ++++++++ multidim-interop/dockerBuildWrapper.sh | 5 ++++- multidim-interop/src/generator.ts | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index ed99658e4..2633fc7a2 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -25,6 +25,10 @@ inputs: description: "Which AWS region to use" required: false default: "us-east-1" + s3-cache-is-read-only: + description: "Which AWS region to use" + required: false + default: "" runs: using: "composite" steps: @@ -33,6 +37,10 @@ runs: echo "AWS_BUCKET=${{ inputs.s3-cache-bucket }}" >> $GITHUB_ENV echo "AWS_REGION=${{ inputs.aws-region }}" >> $GITHUB_ENV shell: bash + - if: inputs.s3-cache-is-read-only != '' + run: | + echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV + shell: bash - name: Configure AWS credentials for S3 build cache if: inputs.s3-access-key-id != '' && inputs.s3-secret-access-key != '' diff --git a/multidim-interop/dockerBuildWrapper.sh b/multidim-interop/dockerBuildWrapper.sh index 087a4e8c9..7ad308dba 100755 --- a/multidim-interop/dockerBuildWrapper.sh +++ b/multidim-interop/dockerBuildWrapper.sh @@ -4,8 +4,11 @@ CACHING_OPTIONS="" # If in CI and we have a defined cache bucket, use caching if [[ -n "${CI}" ]] && [[ -n "${AWS_BUCKET}" ]]; then CACHING_OPTIONS="\ - --cache-to type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME \ --cache-from type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME" + if [[ -z "${READ_ONLY_CACHE}" ]]; then + CACHING_OPTIONS="$CACHING_OPTIONS\ + --cache-to type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME" + fi fi docker buildx build \ diff --git a/multidim-interop/src/generator.ts b/multidim-interop/src/generator.ts index 1d3986920..1b5260e0b 100644 --- a/multidim-interop/src/generator.ts +++ b/multidim-interop/src/generator.ts @@ -132,6 +132,7 @@ function buildSpec(containerImages: { [key: string]: string }, { name, dialerID, name, services: { dialer: { + init: true, image: containerImages[dialerID], depends_on: ["redis"], environment: { From 34b3059c2317b19839acec37806f87b4d1eb08a4 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Mon, 13 Mar 2023 10:23:03 -0700 Subject: [PATCH 2/9] Fix description --- .github/actions/run-interop-ping-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index 2633fc7a2..720082370 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -26,7 +26,7 @@ inputs: required: false default: "us-east-1" s3-cache-is-read-only: - description: "Which AWS region to use" + description: "Is cache read only?" required: false default: "" runs: From 1242ab478ba58ef191be29ef04621d6f8bdde30a Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Mon, 13 Mar 2023 10:23:25 -0700 Subject: [PATCH 3/9] Rollback init change on dialer --- multidim-interop/src/generator.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/multidim-interop/src/generator.ts b/multidim-interop/src/generator.ts index 1b5260e0b..1d3986920 100644 --- a/multidim-interop/src/generator.ts +++ b/multidim-interop/src/generator.ts @@ -132,7 +132,6 @@ function buildSpec(containerImages: { [key: string]: string }, { name, dialerID, name, services: { dialer: { - init: true, image: containerImages[dialerID], depends_on: ["redis"], environment: { From f4a4a91100b279e8e205e8d49dffe481a1463d18 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 11:45:34 -0700 Subject: [PATCH 4/9] Fallback to public cache --- .github/actions/run-interop-ping-test/action.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index 720082370..978c4cffe 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -12,7 +12,7 @@ inputs: s3-cache-bucket: description: "Which S3 bucket to use for container layer caching" required: false - default: "" + default: "libp2p-by-tf-aws-bootstrap" # Default public cache s3-access-key-id: description: "S3 Access key id for the cache" required: false @@ -41,7 +41,6 @@ runs: run: | echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV shell: bash - - name: Configure AWS credentials for S3 build cache if: inputs.s3-access-key-id != '' && inputs.s3-secret-access-key != '' uses: aws-actions/configure-aws-credentials@v1 @@ -50,6 +49,12 @@ runs: aws-secret-access-key: ${{ inputs.s3-secret-access-key}} aws-region: ${{ env.AWS_REGION }} + - name: Fallback to public cache + if: inputs.s3-access-key-id == '' && inputs.s3-secret-access-key == '' && inputs.s3-cache-bucket == 'libp2p-by-tf-aws-bootstrap' # No keys, but using default public cache + shell: bash + run: | + echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV + # This depends on where this file is within this repository. This walks up # from here to the multidim-interop folder - run: | From 9d8e5929f8ed7cfad2fe407aadcc6c640341ea7c Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 11:52:17 -0700 Subject: [PATCH 5/9] Rename workflow --- .github/workflows/multidim-interop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/multidim-interop.yml b/.github/workflows/multidim-interop.yml index 16bc19e5b..e766daf52 100644 --- a/.github/workflows/multidim-interop.yml +++ b/.github/workflows/multidim-interop.yml @@ -17,7 +17,7 @@ jobs: 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 }} - build-without-cache: + build-with-public-cache: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 9bfb940a1b0d775139718400188fbdec42fcfc08 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 11:52:23 -0700 Subject: [PATCH 6/9] Debug --- multidim-interop/dockerBuildWrapper.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/multidim-interop/dockerBuildWrapper.sh b/multidim-interop/dockerBuildWrapper.sh index 7ad308dba..ec006fc34 100755 --- a/multidim-interop/dockerBuildWrapper.sh +++ b/multidim-interop/dockerBuildWrapper.sh @@ -1,4 +1,5 @@ #!/usr/bin/env /bin/bash +set -x CACHING_OPTIONS="" # If in CI and we have a defined cache bucket, use caching From a2edc3ebce0198f02cc8c9e958c7c95c91fbc855 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 11:55:50 -0700 Subject: [PATCH 7/9] Fix fallback --- .github/actions/run-interop-ping-test/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index 978c4cffe..d510150e0 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -53,6 +53,8 @@ runs: if: inputs.s3-access-key-id == '' && inputs.s3-secret-access-key == '' && inputs.s3-cache-bucket == 'libp2p-by-tf-aws-bootstrap' # No keys, but using default public cache shell: bash run: | + echo "AWS_BUCKET=${{ inputs.s3-cache-bucket }}" >> $GITHUB_ENV + echo "AWS_REGION=${{ inputs.aws-region }}" >> $GITHUB_ENV echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV # This depends on where this file is within this repository. This walks up From e42171dd7f3fd6427d1879d77957e81e3d6a31ee Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 12:32:42 -0700 Subject: [PATCH 8/9] Try empty aws env creds --- .github/actions/run-interop-ping-test/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index d510150e0..924545cca 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -56,6 +56,8 @@ runs: echo "AWS_BUCKET=${{ inputs.s3-cache-bucket }}" >> $GITHUB_ENV echo "AWS_REGION=${{ inputs.aws-region }}" >> $GITHUB_ENV echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV + echo 'AWS_ACCESS_KEY_ID=""' >> $GITHUB_ENV + echo 'AWS_SECRET_ACCESS_KEY=""' >> $GITHUB_ENV # This depends on where this file is within this repository. This walks up # from here to the multidim-interop folder From 71eacd39f3479f2fd5138dadc7b49a6710747778 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 16 Mar 2023 14:41:11 -0700 Subject: [PATCH 9/9] Rollback default public cache fallback --- .github/actions/run-interop-ping-test/action.yml | 10 ---------- .github/workflows/multidim-interop.yml | 2 +- multidim-interop/dockerBuildWrapper.sh | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/actions/run-interop-ping-test/action.yml b/.github/actions/run-interop-ping-test/action.yml index 924545cca..da4dc7865 100644 --- a/.github/actions/run-interop-ping-test/action.yml +++ b/.github/actions/run-interop-ping-test/action.yml @@ -49,16 +49,6 @@ runs: aws-secret-access-key: ${{ inputs.s3-secret-access-key}} aws-region: ${{ env.AWS_REGION }} - - name: Fallback to public cache - if: inputs.s3-access-key-id == '' && inputs.s3-secret-access-key == '' && inputs.s3-cache-bucket == 'libp2p-by-tf-aws-bootstrap' # No keys, but using default public cache - shell: bash - run: | - echo "AWS_BUCKET=${{ inputs.s3-cache-bucket }}" >> $GITHUB_ENV - echo "AWS_REGION=${{ inputs.aws-region }}" >> $GITHUB_ENV - echo "READ_ONLY_CACHE=true" >> $GITHUB_ENV - echo 'AWS_ACCESS_KEY_ID=""' >> $GITHUB_ENV - echo 'AWS_SECRET_ACCESS_KEY=""' >> $GITHUB_ENV - # This depends on where this file is within this repository. This walks up # from here to the multidim-interop folder - run: | diff --git a/.github/workflows/multidim-interop.yml b/.github/workflows/multidim-interop.yml index e766daf52..16bc19e5b 100644 --- a/.github/workflows/multidim-interop.yml +++ b/.github/workflows/multidim-interop.yml @@ -17,7 +17,7 @@ jobs: 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 }} - build-with-public-cache: + build-without-cache: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/multidim-interop/dockerBuildWrapper.sh b/multidim-interop/dockerBuildWrapper.sh index ec006fc34..7ad308dba 100755 --- a/multidim-interop/dockerBuildWrapper.sh +++ b/multidim-interop/dockerBuildWrapper.sh @@ -1,5 +1,4 @@ #!/usr/bin/env /bin/bash -set -x CACHING_OPTIONS="" # If in CI and we have a defined cache bucket, use caching