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

ci: Test Envoy sync in PRs #813

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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/sync

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are here, remove the unused GO_TARGETS and IMPORT_BASE variables?