Skip to content

Commit 7eab1b6

Browse files
committed
ci: Test Envoy sync in PRs
Signed-off-by: Ryan Northey <[email protected]>
1 parent ba17790 commit 7eab1b6

File tree

4 files changed

+56
-35
lines changed

4 files changed

+56
-35
lines changed

.github/workflows/_sync.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI/sync
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
app-id:
7+
app-key:
8+
inputs:
9+
sync:
10+
type: boolean
11+
default: true
12+
13+
jobs:
14+
sync:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- id: appauth
18+
if: ${{ inputs.sync }}
19+
uses: envoyproxy/toolshed/gh-actions/[email protected]
20+
with:
21+
key: ${{ secrets.app-key }}
22+
app_id: ${{ secrets.app-id }}
23+
- name: 'Checkout go-control-plane repository'
24+
uses: actions/checkout@v4
25+
with:
26+
path: go-control-plane
27+
fetch-depth: ${{ ! inputs.sync && 1 || 0 }}
28+
token: ${{ steps.appauth.outputs.token || secrets.GITHUB_TOKEN }}
29+
- name: 'Checkout Envoy repository'
30+
uses: actions/checkout@v4
31+
with:
32+
repository: envoyproxy/envoy
33+
fetch-depth: ${{ ! inputs.sync && 1 || 0 }}
34+
path: envoy
35+
- run: ci/sync_envoy.sh
36+
env:
37+
ENVOY_SRC_DIR: ../envoy
38+
NO_COMMIT_CHANGES: ${{ ! inputs.sync && '1' || '' }}
39+
working-directory: go-control-plane

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: build and test
15-
run: make docker_tests
15+
run: make docker_tests
16+
17+
sync:
18+
uses: ./.github/workflows/_sync.yml
19+
with:
20+
sync: false

.github/workflows/envoy-sync.yaml

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
11
name: Sync Envoy
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_dispatch:
58

69
concurrency:
710
group: ${{ github.workflow }}
811
cancel-in-progress: true
912

10-
permissions:
11-
contents: read
1213

1314
jobs:
1415
sync:
1516
runs-on: ubuntu-22.04
16-
permissions:
17-
contents: write
1817
if: |
1918
${{
2019
!contains(github.actor, '[bot]')
2120
|| github.actor == 'sync-envoy[bot]'
2221
}}
23-
steps:
24-
- id: appauth
25-
uses: envoyproxy/toolshed/gh-actions/[email protected]
26-
with:
27-
key: ${{ secrets.ENVOY_CI_UPDATE_BOT_KEY }}
28-
app_id: ${{ secrets.ENVOY_CI_UPDATE_APP_ID }}
29-
30-
# Checkout the repo
31-
- name: 'Checkout Repository'
32-
uses: actions/checkout@v4
33-
with:
34-
ref: main
35-
fetch-depth: 0
36-
token: ${{ steps.appauth.outputs.token }}
37-
38-
# Checkout the Envoy repo
39-
- name: 'Checkout Repository'
40-
uses: actions/checkout@v4
41-
with:
42-
repository: envoyproxy/envoy
43-
ref: main
44-
fetch-depth: 0
45-
path: upstream
46-
47-
- run: mv upstream ../envoy
48-
- run: ci/sync_envoy.sh
49-
env:
50-
ENVOY_SRC_DIR: ../envoy
22+
uses: ./.github/workflows/_sync.yml
23+
secrets:
24+
app-id: ${{ secrets.ENVOY_CI_UPDATE_APP_ID }}
25+
app-key: ${{ secrets.ENVOY_CI_UPDATE_BOT_KEY }}

ci/sync_envoy.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ commit_changes () {
7373

7474
build_protos
7575
sync_protos
76-
commit_changes
76+
if [[ -z "$NO_COMMIT_CHANGES" ]]; then
77+
commit_changes
78+
fi

0 commit comments

Comments
 (0)