-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enforce rollback safety PR checks #5731
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
Merged
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
973339e
Split cargo ci subcommands into packages
clockwork-labs-bot 0272d77
Fix wasm bindings CI command path
clockwork-labs-bot 2c10c76
Replace gh run watch in Internal Tests
clockwork-labs-bot b4533da
Revert "Replace gh run watch in Internal Tests"
clockwork-labs-bot 5b30bff
Merge remote-tracking branch 'origin/master' into bot/split-public-ca…
clockwork-labs-bot 7166640
Split CI workflow helpers into packages
clockwork-labs-bot 22a3096
Address CI command review comments
clockwork-labs-bot ffcaa08
Finish CI command review fixes
clockwork-labs-bot 7da2130
Inline CI dlls command
clockwork-labs-bot 0848cd3
Prune unused CI command deps
clockwork-labs-bot 7447514
Inline CI keynote bench command
clockwork-labs-bot 39db97d
Finish CI command review cleanup
clockwork-labs-bot f2c8936
Inline CI TypeScript test command
clockwork-labs-bot cedce19
Keep CI keynote bench package
clockwork-labs-bot f61a431
Restore split CI command binaries
clockwork-labs-bot 84e12a0
Match split command argument handling
clockwork-labs-bot f74f418
Restore clap CI command dispatch
clockwork-labs-bot 539edb5
Address cargo ci review comments
clockwork-labs-bot 430a678
Allow CLI output in split CI commands
clockwork-labs-bot 07cf1ed
Preserve smoketest runner args
clockwork-labs-bot c2ba677
Address cargo ci review followups
clockwork-labs-bot d02e783
Inline coordinate internal tests entrypoint
clockwork-labs-bot 3d5d8fa
Apply suggestion from @bfops
bfops c1e9dbd
Render split cargo ci help from child commands
clockwork-labs-bot 323cd2a
Delegate split cargo ci help
clockwork-labs-bot a7dc141
Use split binary help for cargo ci subcommands
clockwork-labs-bot cb1cdf5
Trim split help docs output
clockwork-labs-bot 40bac67
Keep simple CI docs compact
clockwork-labs-bot a841ee0
Remove cargo ci self-docs
clockwork-labs-bot 2a76f40
Address cargo ci split review
clockwork-labs-bot 577f1f3
[bot/split-public-cargo-ci]: remove unneeded
bfops ccad6be
[bot/split-public-cargo-ci]: Merge branch 'bot/split-public-cargo-ci'…
bfops accb6d4
[bot/split-public-cargo-ci]: remove
bfops 0115f5f
Use split command args for cargo ci help
clockwork-labs-bot 14fa25e
Update cargo ci lockfile
clockwork-labs-bot cdae211
Move cargo ci args to slim package
clockwork-labs-bot 710611c
Merge remote-tracking branch 'origin/master' into HEAD
clockwork-labs-bot ef43489
Address cargo ci split reviews
clockwork-labs-bot 5406bb6
Match private cargo ci dispatcher style
clockwork-labs-bot 845d3ab
Remove shared cargo ci args crate
clockwork-labs-bot 1e61512
Remove deprecated cargo ci dlls command
clockwork-labs-bot 54dbda8
[bot/split-public-cargo-ci]: fix
bfops 9db6e33
[bot/split-public-cargo-ci]: Merge branch 'bot/split-public-cargo-ci'…
bfops 24c240e
Remove redundant ci command parser wrappers
clockwork-labs-bot 05dcba4
Flatten CLA assistant command parser
clockwork-labs-bot 57440f0
Use conventional CLA assistant parser names
clockwork-labs-bot 369f3c0
Inline workflow watch loop
clockwork-labs-bot 4398621
Allow CLI output macros in workflow watch
clockwork-labs-bot c9da972
[bot/split-public-cargo-ci]: fix release job
bfops 0e1843e
[bot/split-public-cargo-ci]: rename
bfops 5a60058
[bfops/rollback-safety]: Rollback safety
bfops e39e5ab
[bfops/rollback-safety]: update
bfops b3f0234
[bot/split-public-cargo-ci]: upload timing reports
bfops 7a482a9
Merge branch 'master' into bot/split-public-cargo-ci
joshua-spacetime ff77c53
[bfops/rollback-safety]: tests
bfops c5e3793
[bfops/rollback-safety]: move code
bfops b34df94
[bfops/rollback-safety]: move
bfops 078bbda
[bfops/rollback-safety]: rename
bfops b8ce588
[bfops/rollback-safety]: WIP
bfops 7696021
Apply suggestion from @bfops
bfops 2337fee
[bfops/rollback-safety]: comment
bfops e2921dc
[bfops/rollback-safety]: Merge branch 'bfops/rollback-safety' of gith…
bfops 6ff1639
[bfops/rollback-safety]: concurrency groups
bfops 8c1acb1
[bfops/rollback-safety]: better message when no deps
bfops 7c22ca3
Merge branch 'bot/split-public-cargo-ci' into bfops/rollback-safety
bfops c2b0dd2
[bfops/rollback-safety]: Merge commit 'origin/master~1' into bfops/ro…
bfops 6b13c76
[bfops/rollback-safety]: Merge remote-tracking branch 'origin/master'…
bfops 1feb6ea
[bfops/rollback-safety]: Merge remote-tracking branch 'origin/master'…
bfops e2bae30
[bfops/rollback-safety]: review
bfops 6b72266
[bfops/rollback-safety]: move
bfops 9dca2d8
Merge remote-tracking branch 'origin/master' into bfops/rollback-safety
bfops fa906e5
fixes
bfops 8c92bce
updates
bfops a6cb90e
Merge remote-tracking branch 'origin/bfops/rollback-safety' into bfop…
bfops cfdcb07
fixes
bfops f46f1d7
updates
bfops 220164a
fixes
bfops a329317
review
bfops 16ffa54
review
bfops 06b79e8
Apply suggestion from @bfops
bfops 7a24736
Apply suggestion from @bfops
bfops 6547245
Apply suggestion from @bfops
bfops b0f7a25
review
bfops 357b607
Merge branch 'bfops/rollback-safety' of github.com:clockworklabs/Spac…
bfops 1c13996
review
bfops 63846b3
review
bfops 521eeeb
rust_log
bfops be1fc56
review
bfops d7e000a
Merge remote-tracking branch 'origin/master' into bfops/rollback-safety
bfops 94e8851
accessors
bfops c982950
better log
bfops bd4f392
address review
bfops 64a25bd
Merge remote-tracking branch 'origin/master' into bfops/rollback-safety
bfops fde4831
fix run events
bfops File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [package] | ||
| name = "ci-check-release-deps" | ||
| version = "0.1.0" | ||
| edition.workspace = true | ||
|
|
||
| [dependencies] | ||
| anyhow.workspace = true | ||
| clap.workspace = true | ||
| rollback-coordination = { path = "../../../rollback-coordination" } | ||
| tracing-subscriber = { workspace = true, features = ["env-filter"] } | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #![allow(clippy::disallowed_macros)] | ||
|
|
||
| use anyhow::{Context, Result}; | ||
| use clap::Parser; | ||
| use rollback_coordination::{earliest_rollback_point, Gh}; | ||
| use std::fs; | ||
| use std::path::PathBuf; | ||
|
|
||
| #[derive(Parser)] | ||
| #[command( | ||
| about = "Checks the `Rollback safety impact` section and verifies that every referenced PR has been released." | ||
| )] | ||
| struct Args { | ||
| #[arg(long)] | ||
| current_repo: PathBuf, | ||
| /// Paths to local clones of the repos that are allowed to be considered as release dependencies in the rollback safety PR section | ||
| #[arg(long = "allowed-reference-repo", required = true)] | ||
| allowed_reference_repos: Vec<PathBuf>, | ||
| #[arg(long)] | ||
| pr_number: u64, | ||
| } | ||
|
|
||
| fn main() -> Result<()> { | ||
| tracing_subscriber::fmt() | ||
| .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) | ||
| .with_writer(std::io::stderr) | ||
| .init(); | ||
| let args = Args::parse(); | ||
| let template = fs::read_to_string(args.current_repo.join(".github/pull_request_template.md")) | ||
| .context("failed to read .github/pull_request_template.md")?; | ||
| let allowed_reference_repos = args | ||
| .allowed_reference_repos | ||
| .iter() | ||
| .map(PathBuf::as_path) | ||
| .collect::<Vec<_>>(); | ||
| let point = earliest_rollback_point( | ||
| &Gh, | ||
| &args.current_repo, | ||
| &allowed_reference_repos, | ||
| Some(&template), | ||
| false, | ||
| &[args.pr_number], | ||
| )?; | ||
| match point { | ||
| Some(release) => println!("All mentioned PRs have been released. Earliest rollback point: {release}"), | ||
| None => println!("No PR mentions found, so trivially succeeding."), | ||
| } | ||
| Ok(()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| [package] | ||
| name = "rollback-coordination" | ||
| version = "0.1.0" | ||
| edition.workspace = true | ||
|
|
||
| [dependencies] | ||
| anyhow.workspace = true | ||
| duct.workspace = true | ||
| regex.workspace = true | ||
| semver.workspace = true | ||
| serde.workspace = true | ||
| serde_json.workspace = true | ||
| tracing.workspace = true | ||
|
|
||
| [dev-dependencies] | ||
| tempfile.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| //! Thin wrappers around GitHub API requests. Business logic belongs in the | ||
| //! calling coordination modules, not here. | ||
|
|
||
| use anyhow::{Context, Result}; | ||
| use duct::cmd; | ||
| use serde::de::DeserializeOwned; | ||
| use serde::Deserialize; | ||
| use std::path::Path; | ||
|
|
||
| #[derive(Deserialize)] | ||
| pub struct PullRequest { | ||
| pub body: Option<String>, | ||
| } | ||
|
|
||
| #[derive(Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct RepositoryInfo { | ||
| pub name_with_owner: String, | ||
| } | ||
|
|
||
| pub trait Github { | ||
| fn get<T: DeserializeOwned>(&self, endpoint: &str) -> Result<T>; | ||
| fn repository_info(&self, path: &Path) -> Result<RepositoryInfo>; | ||
|
|
||
| fn pull_request(&self, repo: &str, number: u64) -> Result<PullRequest> { | ||
| self.get(&format!("repos/{repo}/pulls/{number}")) | ||
| } | ||
| } | ||
|
|
||
| pub struct Gh; | ||
|
|
||
| impl Github for Gh { | ||
| fn get<T: DeserializeOwned>(&self, endpoint: &str) -> Result<T> { | ||
| let output = cmd!("gh", "api", endpoint) | ||
| .read() | ||
| .with_context(|| format!("failed to run `gh api {endpoint}`"))?; | ||
| serde_json::from_str(&output).with_context(|| format!("invalid response from {endpoint}")) | ||
| } | ||
|
|
||
| fn repository_info(&self, path: &Path) -> Result<RepositoryInfo> { | ||
| let output = cmd!("gh", "repo", "view", "--json", "nameWithOwner") | ||
| .dir(path) | ||
| .read() | ||
| .with_context(|| format!("failed to run `gh repo view` in {}", path.display()))?; | ||
| serde_json::from_str(&output).context("invalid response from `gh repo view`") | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.