Skip to content

Commit cdc9638

Browse files
galarghjxsguillaumemichel
authored
chore: parameterise s3 build cache setup (#5586)
As we're setting up a new cache bucket, we'd like to be able to control its' configuration via GitHub vars/secrets fully. FYI, the secrets are not set up yet. --------- Co-authored-by: João Oliveira <[email protected]> Co-authored-by: Guillaume Michel <[email protected]>
1 parent 3837e33 commit cdc9638

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

.github/workflows/docker-image.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- 'master'
77
tags:
88
- 'libp2p-server-**'
9-
pull_request:
109

1110
jobs:
1211
server:
@@ -34,11 +33,6 @@ jobs:
3433
with:
3534
context: .
3635
file: ./misc/server/Dockerfile
37-
push: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} # Only push image if we have the required permissions, i.e. not running from a fork
38-
cache-from: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' && type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=rust-libp2p-server }}
39-
cache-to: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' && type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=rust-libp2p-server }}
36+
push: true
4037
tags: ${{ steps.meta.outputs.tags }}
4138
labels: ${{ steps.meta.outputs.labels }}
42-
env:
43-
AWS_ACCESS_KEY_ID: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
44-
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}

.github/workflows/interop-test.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ jobs:
2424
- name: Build ${{ matrix.flavour }} image
2525
run: ./scripts/build-interop-image.sh
2626
env:
27-
AWS_ACCESS_KEY_ID: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
28-
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
27+
AWS_BUCKET_NAME: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
28+
AWS_ACCESS_KEY_ID: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
29+
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
2930
FLAVOUR: ${{ matrix.flavour }}
3031

3132
- name: Run ${{ matrix.flavour }} tests
3233
uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master
3334
with:
3435
test-filter: ${{ matrix.flavour }}-rust-libp2p-head
3536
extra-versions: ${{ github.workspace }}/interop-tests/${{ matrix.flavour }}-ping-version.json
36-
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
37-
s3-access-key-id: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
38-
s3-secret-access-key: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
37+
s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
38+
s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
39+
s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
3940
worker-count: 16
4041
run-holepunching-interop:
4142
name: Run hole-punch interoperability tests
@@ -50,7 +51,7 @@ jobs:
5051
with:
5152
test-filter: rust-libp2p-head
5253
extra-versions: ${{ github.workspace }}/hole-punching-tests/version.json
53-
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
54-
s3-access-key-id: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
55-
s3-secret-access-key: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
54+
s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
55+
s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
56+
s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
5657
worker-count: 16

scripts/build-interop-image.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ CACHE_TO=""
66

77
# If we have credentials, write to cache
88
if [[ -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
9-
CACHE_TO="--cache-to type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head"
9+
CACHE_TO="--cache-to type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=us-east-1,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head"
1010
fi
1111

1212
docker buildx build \
1313
--load \
1414
$CACHE_TO \
15-
--cache-from type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \
15+
--cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=us-east-1,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \
1616
-t ${FLAVOUR}-rust-libp2p-head \
1717
. \
1818
-f interop-tests/Dockerfile.${FLAVOUR}

0 commit comments

Comments
 (0)