Skip to content

ci/deflake: Allow testing a pull request, ref or fork branch - #49129

Merged
phlax merged 3 commits into
envoyproxy:mainfrom
phlax:ci-deflake-ref
Nov 10, 2026
Merged

phlax merged 3 commits into
envoyproxy:mainfrom
phlax:ci-deflake-ref

Conversation

@phlax

@phlax phlax commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

The deflake workflow could only test commits already on main: the checkout asserts the ref is an ancestor of the current branch. Add pr, ref and repository inputs, fetched after the trusted checkout, so a flake can be reproduced from a pull request's merge ref or a branch on a fork before a fix lands, and a timeout-minutes input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this branch, so the job runs untrusted, as in PR CI: no app token, no deploy key, no signing keys. _run.yml enforces this itself rather than leaving it to each caller — the checkout step refuses checkout-ref/checkout-pr with trusted: true, and fails when checkout-repository is given without a ref rather than silently testing this branch. The run keeps this branch's Actions cache scope, so only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey [email protected]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Fork-controlled checkouts retain trusted-job credentials, enabling Docker Hub token exfiltration, while combined PR and repository overrides fetch merge refs from the wrong repository.

2 open issues
What changed in this PR

Extends Envoy’s deflake workflow to reproduce flaky tests on pull requests, explicit refs, and fork branches before changes land, with a configurable timeout for long runs.

Changes:

  • Adds pr, ref, and repository inputs to select the source under test.
  • Adds an override checkout step to the reusable CI runner.
  • Exposes a job timeout input with a 360-minute default.
File Description
.github/​workflows/​envoy-deflake.yml Adds source-selection and timeout inputs and forwards them to the CI runner.
.github/​workflows/​_run.yml Adds checkout override inputs and fetches the requested source after the initial checkout.

Review effort: Balanced

Comment on lines +336 to +337
git fetch --no-tags "$REPOSITORY" "$REF"
git checkout --force FETCH_HEAD

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in 5445054: an override checkout now makes the job untrusted (trusted: ${{ !(inputs.pr || inputs.ref) }}), so no app token or deploy key, as in PR CI. The read-only DOCKERHUB_TOKEN is kept, as every untrusted PR job already receives it (envoy-prechecks.yml, _check.yml). (bot assisted)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

2bd658a also withholds DOCKERHUB_TOKEN for untrusted runs, so an override run now carries no secrets. (bot assisted)

Comment thread .github/workflows/_run.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

PR/fork overrides retain main-scoped cache access, allowing untrusted code to poison caches consumed by trusted workflows that restore Docker state with sudo.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread .github/workflows/envoy-deflake.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

An unpublished finding about workflow-condition formatting needs human assessment to determine its significance under repository rules.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human judgment is needed to determine whether an unpublished workflow-condition convention nit should affect approval.

1 open issue

Review effort: Balanced

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add
`pr`, `ref` and `repository` inputs, fetched after the trusted
checkout, so a flake can be reproduced from a pull request's merge ref
or a branch on a fork before a fix lands, and a `timeout-minutes` input
for long runs.

Code fetched this way is not on the dispatching branch, so the job runs
untrusted, as PR CI does: no app token, deploy key or Docker Hub token.
A pull request's merge ref only exists in the base repository, so it is
always fetched from origin, whatever repository is given for a ref.
Unlike PR CI the run keeps the dispatching branch's Actions cache
scope, which is documented on the input.

Signed-off-by: Ryan Northey <[email protected]>
Comment thread .github/workflows/_run.yml Resolved
Comment thread .github/workflows/envoy-deflake.yml Resolved
Comment thread .github/workflows/envoy-deflake.yml Resolved
Comment thread .github/workflows/_run.yml Resolved
Review follow-ups: _run.yml itself now refuses checkout-ref/checkout-pr
with trusted: true, rather than relying on each caller's trusted
expression, and fails when checkout-repository is given without a ref
instead of silently testing this branch. The DOCKERHUB_TOKEN is passed
as before (PR CI gets it too, and the image is no longer cached since

Signed-off-by: Ryan Northey <[email protected]>
envoyproxy#49133), and checkout-ref documents that a sha must be the full one.
Comment thread .github/workflows/_run.yml Outdated
Comment on lines +326 to +333
if [[ "${{ inputs.trusted }}" == "true" ]]; then
echo "checkout-ref/checkout-pr can only be used with trusted: false" >&2
exit 1
fi
if [[ -z "$REF" ]]; then
echo "checkout-repository needs checkout-ref or checkout-pr" >&2
exit 1
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: From deflake, setting only repository leaves trusted: true, because trusted only looks at pr and ref. The step then fails on the first check with "checkout-ref/checkout-pr can only be used with trusted: false", so the clearer message can never be reached from there. Swapping the two checks would fix that:

Suggested change
if [[ "${{ inputs.trusted }}" == "true" ]]; then
echo "checkout-ref/checkout-pr can only be used with trusted: false" >&2
exit 1
fi
if [[ -z "$REF" ]]; then
echo "checkout-repository needs checkout-ref or checkout-pr" >&2
exit 1
fi
if [[ -z "$REF" ]]; then
echo "checkout-repository needs checkout-ref or checkout-pr" >&2
exit 1
fi
if [[ "${{ inputs.trusted }}" == "true" ]]; then
echo "checkout-ref/checkout-pr can only be used with trusted: false" >&2
exit 1
fi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in e3305ae.

Comment thread .github/workflows/envoy-deflake.yml Outdated
type: string
default: ''
ref:
description: 'Ref to test: sha, branch, tag or refs/pull/N/head (default: this branch)'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Same "full sha" clarification as in _run.yml:

Suggested change
description: 'Ref to test: sha, branch, tag or refs/pull/N/head (default: this branch)'
description: 'Ref to test: full sha, branch, tag or refs/pull/N/head (default: this branch)'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in e3305ae.

…eflake input

Review: from deflake, repository alone leaves trusted: true, so the
trusted check fired first and hid the message that explains the actual
mistake.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax merged commit c6986a1 into envoyproxy:main Nov 10, 2026
25 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
…oxy#49129)

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
…oxy#49129)

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
…oxy#49129)

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
…oxy#49129)

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 12, 2026
…oxy#49129)

The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 12, 2026
The deflake workflow could only test commits already on main: the
checkout asserts the ref is an ancestor of the current branch. Add `pr`,
`ref` and `repository` inputs, fetched after the trusted checkout, so a
flake can be reproduced from a pull request's merge ref or a branch on a
fork before a fix lands, and a `timeout-minutes` input for long runs.

Testing a pull request, ref or fork branch runs code that is not on this
branch, so the job runs untrusted, as in PR CI: no app token, no deploy
key, no signing keys. `_run.yml` enforces this itself rather than
leaving it to each caller — the checkout step refuses
`checkout-ref`/`checkout-pr` with `trusted: true`, and fails when
`checkout-repository` is given without a ref rather than silently
testing this branch. The run keeps this branch's Actions cache scope, so
only dispatch code you would push to this repository.

Signed-off-by: Ryan Northey <[email protected]>

---------

Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants