Skip to content

Commit

Permalink
chore(ci): add a mergify batch queue for external PRs (#5668)
Browse files Browse the repository at this point in the history
and remove the if conditions no longer required as we are running them
again on every PR

---------

Co-authored-by: Guillaume Michel <[email protected]>
Co-authored-by: João Oliveira <jxs>
  • Loading branch information
jxs and guillaumemichel authored Nov 21, 2024
1 parent 0e9dcdd commit 059742f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ pull_request_rules:
- base=master
actions:
queue:
name: default

# Adds the Pr to the batch queue, so that we can run the interop tests. See the `external_prs` queue for more info.
- name: Add to batch merge queue
conditions:
# All branch protection rules are implicit: https://docs.mergify.com/conditions/#about-branch-protection
- label=send-it-batch
- base=master
actions:
queue:
name: external_prs

- name: Add approved dependabot PRs to merge queue
conditions:
Expand All @@ -40,6 +51,7 @@ pull_request_rules:
- base=master
actions:
queue:
name: default

- name: Remove reviews on updates after PR is queued for merging
conditions:
Expand Down Expand Up @@ -74,3 +86,8 @@ pull_request_rules:
queue_rules:
- name: default
conditions: []
# External PR's don't have access to secrets and variables, therefore they don't run the interop tests.
# using a batch queue allows to circumvent that as mergify creates it from an internal branch.
- name: external_prs
conditions: []
batch_size: 1
3 changes: 3 additions & 0 deletions .github/workflows/interop-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
AWS_BUCKET_NAME: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }}
FLAVOUR: ${{ matrix.flavour }}

- name: Run ${{ matrix.flavour }} tests
Expand All @@ -38,6 +39,7 @@ jobs:
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 }}
aws-region: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }}
worker-count: 16
run-holepunching-interop:
name: Run hole-punch interoperability tests
Expand All @@ -56,4 +58,5 @@ jobs:
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 }}
aws-region: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_REGION }}
worker-count: 16
4 changes: 2 additions & 2 deletions scripts/build-interop-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ CACHE_TO=""

# If we have credentials, write to cache
if [[ -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
CACHE_TO="--cache-to type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=ap-southeast-2,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head"
CACHE_TO="--cache-to type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head"
fi

docker buildx build \
--load \
$CACHE_TO \
--cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=ap-southeast-2,prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \
--cache-from type=s3,mode=max,bucket=${AWS_BUCKET_NAME},region=${AWS_REGION},prefix=buildCache,name=${FLAVOUR}-rust-libp2p-head \
-t ${FLAVOUR}-rust-libp2p-head \
. \
-f interop-tests/Dockerfile.${FLAVOUR}

0 comments on commit 059742f

Please sign in to comment.