external-plugins: add netlify-preview plugin to retry deploy previews#708
external-plugins: add netlify-preview plugin to retry deploy previews#708Caesarsage wants to merge 6 commits into
Conversation
|
Skipping CI for Draft Pull Request. |
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Caesarsage The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
I also tested locally against the real Netlify API and the real GitHub API, Decision branches verified end-to-end:
|
|
I agree with the intent of this PR. |
| type Config struct { | ||
| Repos map[string]Repo `json:"repos,omitempty"` | ||
| } | ||
|
|
||
| type Repo struct { | ||
| SiteID string `json:"site_id,omitempty"` | ||
| } |
There was a problem hiding this comment.
Nit: type name Config & Repo is a bit misleading wrapper.
maybe:
| type Config struct { | |
| Repos map[string]Repo `json:"repos,omitempty"` | |
| } | |
| type Repo struct { | |
| SiteID string `json:"site_id,omitempty"` | |
| } | |
| type SiteConfig struct { | |
| SiteID string `json:"site_id,omitempty"` | |
| } | |
| type Config struct { | |
| Repos map[string]SiteConfig `json:"repos,omitempty"` | |
| } |
There was a problem hiding this comment.
Config is the configuration wrapper to the repository and each repository mapped to their netlify site id.
such as:
repos:
kubernetes/website:
site_id: <netlify-site-id>
kubernetes/contributor-site:
site_id: <netlify-site-id>
0cc3500 to
35fd839
Compare
|
/retest |
|
cc @stmcginnis Could you help take a look |
Adds a new external Prow plugin,
netlify-preview, that retries thelatest Netlify deploy preview for a pull request in response to chat
commands. Intended for repositories whose PR previews are built by
Netlify (initially
kubernetes/websiteandkubernetes/contributor-site).Design
Two commands (sign-off in #693):
/retest— retries the latest Netlify deploy preview only whenthat preview is in
errorstate. If it isready, the pluginposts a comment pointing the user to
/rebuild-previewinstead.Avoids wasteful rebuilds of passing previews on routine
/retest./rebuild-preview— forces a retry regardless of the preview'scurrent state, except when a build is already running
(
building/enqueued). The in-flight guard prevents maintainersfrom triggering redundant builds while one is in progress.
Per-repo site mapping
This PR adds a small configuration package that maps each repository
to a Netlify site ID (This is assuming one Netlify for all related netlify projects, hence a single PAT):
Each repo can map to a different Netlify site independently. The
external_plugins: block in Prow configuration is only the enablement
mechanism; site mapping never goes there.
Trust gating
Retries are gated by the same trust rules Prow's trigger plugin
applies (org membership, configured trusted apps and orgs, or
/ok-to-test on the PR). The gate is a build-minute / abuse
protection rather than a code-execution protection, Netlify has
already built the commit once, so a retry does not grant new code
execution. Wasted Netlify build minutes are the real risk.
Assisted by Claude
Closes #693.