aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan R Abrahams <ajordanr@google.com>2022-02-09 20:41:54 +0000
committerCommit Bot <commit-bot@chromium.org>2022-02-10 04:59:59 +0000
commit76d717633c0aa3371a3f9c28fdbf7092af81d9a0 (patch)
treec189d6f1a9b4048de686a718fde29fe707d1fd12
parent3527566c2b13b4977e10281a1cf62b07f1242be0 (diff)
downloadtoolchain-utils-76d717633c0aa3371a3f9c28fdbf7092af81d9a0.tar.gz
patch_sync: Toggle CQ for CrOS, Android
Currently, patch sync will always run CQ for CrOS, but never for Android. This was because the chrotomation bot didn't have the proper permissions to run the needed Presubmit-Ready checks. Now the bot does in fact have permission to enable the Presubmit check on Android, but some users may not have this permission when running locally. This commit introduces the ability to toggle running the presubmit/CQ checks early through the --disable-cq flags (by default it's assumed that running these checks is desirable). BUG=None TEST=patch_sync transpose --disable-cq <...> TEST=patch_sync transpose <...> Change-Id: I6185b98aa4394ba22f8433541885a450855cfbb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3451037 Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
-rw-r--r--llvm_tools/patch_sync/src/main.rs11
-rw-r--r--llvm_tools/patch_sync/src/version_control.rs12
2 files changed, 18 insertions, 5 deletions
diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs
index 58276151..b7967c31 100644
--- a/llvm_tools/patch_sync/src/main.rs
+++ b/llvm_tools/patch_sync/src/main.rs
@@ -37,6 +37,7 @@ fn main() -> Result<()> {
dry_run,
no_commit,
wip,
+ disable_cq,
} => transpose_subcmd(TransposeOpt {
cros_checkout_path,
cros_reviewers: cros_reviewers
@@ -53,6 +54,7 @@ fn main() -> Result<()> {
dry_run,
no_commit,
wip,
+ disable_cq,
}),
}
}
@@ -75,7 +77,8 @@ fn show_subcmd(args: ShowOpt) -> Result<()> {
cros_checkout: cros_checkout_path,
android_checkout: android_checkout_path,
sync_before: sync,
- wip_mode: true,
+ wip_mode: true, // Has no effect, as we're not making changes
+ enable_cq: false, // Has no effect, as we're not uploading anything
};
ctx.setup()?;
let make_collection = |platform: &str, patches_fp: &Path| -> Result<PatchCollection> {
@@ -114,6 +117,7 @@ struct TransposeOpt {
cros_reviewers: Vec<String>,
android_reviewers: Vec<String>,
wip: bool,
+ disable_cq: bool,
}
fn transpose_subcmd(args: TransposeOpt) -> Result<()> {
@@ -122,6 +126,7 @@ fn transpose_subcmd(args: TransposeOpt) -> Result<()> {
android_checkout: args.android_checkout_path,
sync_before: args.sync,
wip_mode: args.wip,
+ enable_cq: !args.disable_cq,
};
ctx.setup()?;
let cros_patches_path = ctx.cros_patches_path();
@@ -318,5 +323,9 @@ enum Opt {
/// emails.
#[structopt(long)]
wip: bool,
+
+ /// Don't run CQ if set. Only has an effect if uploading.
+ #[structopt(long)]
+ disable_cq: bool,
},
}
diff --git a/llvm_tools/patch_sync/src/version_control.rs b/llvm_tools/patch_sync/src/version_control.rs
index dc43523e..e07d39d6 100644
--- a/llvm_tools/patch_sync/src/version_control.rs
+++ b/llvm_tools/patch_sync/src/version_control.rs
@@ -20,6 +20,7 @@ pub struct RepoSetupContext {
/// Run `repo sync` before doing any comparisons.
pub sync_before: bool,
pub wip_mode: bool,
+ pub enable_cq: bool,
}
impl RepoSetupContext {
@@ -52,7 +53,7 @@ impl RepoSetupContext {
llvm_dir.display()
);
Self::rev_bump_llvm(&llvm_dir)?;
- let mut extra_args = vec!["--label=Commit-Queue+1"];
+ let mut extra_args = Vec::new();
for reviewer in reviewers {
extra_args.push("--re");
extra_args.push(reviewer.as_ref());
@@ -61,6 +62,9 @@ impl RepoSetupContext {
extra_args.push("--wip");
extra_args.push("--no-emails");
}
+ if self.enable_cq {
+ extra_args.push("--label=Commit-Queue+1");
+ }
Self::repo_upload(
&self.cros_checkout,
CHROMIUMOS_OVERLAY_REL_PATH,
@@ -76,9 +80,6 @@ impl RepoSetupContext {
pub fn android_repo_upload<S: AsRef<str>>(&self, reviewers: &[S]) -> Result<()> {
let mut extra_args = Vec::new();
- // TODO(ajordanr): Presubmit ready can only be enabled if we
- // have the permissions.
- // extra_args.push("--label=Presubmit-Ready+1");
for reviewer in reviewers {
extra_args.push("--re");
extra_args.push(reviewer.as_ref());
@@ -87,6 +88,9 @@ impl RepoSetupContext {
extra_args.push("--wip");
extra_args.push("--no-emails");
}
+ if self.enable_cq {
+ extra_args.push("--label=Presubmit-Ready+1");
+ }
Self::repo_upload(
&self.android_checkout,
ANDROID_LLVM_REL_PATH,