Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support read-only cache #153

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/actions/run-interop-ping-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +25,10 @@ inputs:
description: "Which AWS region to use"
required: false
default: "us-east-1"
s3-cache-is-read-only:
description: "Is cache read only?"
required: false
default: ""
runs:
using: "composite"
steps:
Expand All @@ -33,7 +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 != ''
uses: aws-actions/configure-aws-credentials@v1
Expand Down
5 changes: 4 additions & 1 deletion multidim-interop/dockerBuildWrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down