Skip to content

Commit

Permalink
ci: Test Envoy sync in PRs
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax committed Oct 31, 2023
1 parent 52ca9ba commit a044aeb
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 35 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI Build and Test

on:
workflow_call:
secrets:
app-id:
app-key:
inputs:
sync:
type: boolean
default: true

jobs:
sync:
runs-on: ubuntu-22.04
steps:
- id: appauth
if: ${{ inputs.sync }}
uses: envoyproxy/toolshed/gh-actions/[email protected]
with:
key: ${{ secrets.app-key }}
app_id: ${{ secrets.app-id }}
- name: 'Checkout go-control-plane repository'
uses: actions/checkout@v4
with:
path: go-control-plane
fetch-depth: ${{ ! inputs.sync && 1 || 0 }}
token: ${{ steps.appauth.outputs.token || secrets.GITHUB_TOKEN }}
- name: 'Checkout Envoy repository'
uses: actions/checkout@v4
with:
repository: envoyproxy/envoy
fetch-depth: ${{ ! inputs.sync && 1 || 0 }}
path: envoy
- run: ci/sync_envoy.sh
env:
ENVOY_SRC_DIR: ../envoy
NO_COMMIT_CHANGES: ${{ ! inputs.sync && '1' || '' }}
working-directory: go-control-plane
9 changes: 7 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: build and test
run: make docker_tests
run: make docker_tests

sync:
uses: ./.github/workflows/_sync.yml
with:
sync: false
39 changes: 7 additions & 32 deletions .github/workflows/envoy-sync.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
name: Sync Envoy

permissions:
contents: read

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: read

jobs:
sync:
runs-on: ubuntu-22.04
permissions:
contents: write
if: |
${{
!contains(github.actor, '[bot]')
|| github.actor == 'sync-envoy[bot]'
}}
steps:
- id: appauth
uses: envoyproxy/toolshed/gh-actions/[email protected]
with:
key: ${{ secrets.ENVOY_CI_UPDATE_BOT_KEY }}
app_id: ${{ secrets.ENVOY_CI_UPDATE_APP_ID }}

# Checkout the repo
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ steps.appauth.outputs.token }}

# Checkout the Envoy repo
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
repository: envoyproxy/envoy
ref: main
fetch-depth: 0
path: upstream

- run: mv upstream ../envoy
- run: ci/sync_envoy.sh
env:
ENVOY_SRC_DIR: ../envoy
uses: ./.github/workflows/_sync.yml
secrets:
app-id: ${{ secrets.ENVOY_CI_UPDATE_APP_ID }}
app-key: ${{ secrets.ENVOY_CI_UPDATE_BOT_KEY }}
4 changes: 3 additions & 1 deletion ci/sync_envoy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ commit_changes () {

build_protos
sync_protos
commit_changes
if [[ -z "$NO_COMMIT_CHANGES" ]]; then
commit_changes
fi

0 comments on commit a044aeb

Please sign in to comment.