Skip to content

github/ci: Switch prechecks to pull_request_target and fix#30126

Merged
phlax merged 4 commits intoenvoyproxy:mainfrom
phlax:deps-pr-target
Oct 12, 2023
Merged

github/ci: Switch prechecks to pull_request_target and fix#30126
phlax merged 4 commits intoenvoyproxy:mainfrom
phlax:deps-pr-target

Conversation

@phlax
Copy link
Copy Markdown
Member

@phlax phlax commented Oct 12, 2023

Currently the code checks for inputs.trusted before that var has been derived/set - this fixes that issue

It also switches the github deps/prechecks wf to pull_request_target - this will require an update in our ci policy, but is a necessary step to enabling RBE for these workflows

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@phlax
Copy link
Copy Markdown
Member Author

phlax commented Oct 12, 2023

cc @gabibguti @krajshiva

@phlax phlax changed the title github/ci: Switch prechecks to pull_request_target and fix [WIP] github/ci: Switch prechecks to pull_request_target and fix Oct 12, 2023
@phlax phlax marked this pull request as draft October 12, 2023 05:37
Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax
Copy link
Copy Markdown
Member Author

phlax commented Oct 12, 2023

checking further - our policy currently discourages pull_request_targets but doesnt forbid - so i dont think update is necessary just now

@phlax phlax marked this pull request as ready for review October 12, 2023 05:49
@phlax phlax changed the title [WIP] github/ci: Switch prechecks to pull_request_target and fix github/ci: Switch prechecks to pull_request_target and fix Oct 12, 2023
@phlax phlax added the release label Oct 12, 2023
name: Checkout Envoy repository
with:
fetch-depth: ${{ ! (inputs.check_mobile_run || inputs.trusted) && 1 || 0 }}
fetch-depth: ${{ ! (inputs.check_mobile_run || ! startsWith(github.event_name, 'pull_request')) && 1 || 0 }}
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.

How about the event triggered by the trusted bots?

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.

the condition is a bit convoluted - but it would match - ie not startswith pull_request == fetch_depth=0

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.

open to suggestions on how to make it clearer - with these pseudo ternaries your options are a bit limited

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.

Sorry, what I actually want to say is how about the event triggered by the untrusted bots. Seems that events also be treated as trusted.

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.

i see - at this point we havent derived the trusted state and the repo hasnt been checked out

re untrusted bots - they should never happen - but in the case they do i think this does the right thing

what we dont want is for them to be able to check out a specified commit

in this case they will get the head of the branch, in the next step they will be deemed untrusted, and the step after that they wont be able to rewind the commit

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.

just realizing tho - this is still not quite right - it needs to call the env action a second time i think

imagining a ci run to actually release, where the branch has been reopened by the time this gets triggered (ie not this actual workflow - but others that reuse _env.yml etc)

in this case it will trigger the run, checkout HEAD, derive env vars, but because the branch is reopened it will see the version as being dev - so i think we need to call the env action a second time with the correct commit

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.

hmm - that scheme wont quite work - but we need something like that

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.

k - updated with a bit of rearrangement - hopefully should work and will get/set correct commits at right times

phlax added 3 commits October 12, 2023 07:54
Signed-off-by: Ryan Northey <ryan@synca.io>
Signed-off-by: Ryan Northey <ryan@synca.io>
Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax phlax enabled auto-merge (squash) October 12, 2023 07:25
Copy link
Copy Markdown
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@phlax phlax disabled auto-merge October 12, 2023 08:07
@phlax
Copy link
Copy Markdown
Member Author

phlax commented Oct 12, 2023

pushing past unrelated coverage fail

Code coverage for source/common/config is lower than limit of 95.4 (95.3)

@phlax phlax merged commit d88a4fc into envoyproxy:main Oct 12, 2023
phlax added a commit to phlax/envoy that referenced this pull request Oct 12, 2023
phlax added a commit to phlax/envoy that referenced this pull request Oct 12, 2023
…y#30126)

Signed-off-by: Ryan Northey <ryan@synca.io>

Signed-off-by: phlax <phlax@users.noreply.github.com>
phlax added a commit that referenced this pull request Oct 12, 2023
Signed-off-by: Ryan Northey <ryan@synca.io>

Signed-off-by: phlax <phlax@users.noreply.github.com>
phlax added a commit that referenced this pull request Oct 12, 2023
Signed-off-by: Ryan Northey <ryan@synca.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants