跳到正文
cccskills
免费在 GitHub 公开中文介绍

safe-push

本指南说明如何用 `safePush.cmd` 将 IntelliJ 仓库的当前提交或指定提交送入 Safe Push,经测试和编译检查后合并到受保护分支,并介绍试运行、进度查询和失败排查。

原文查看原文说明

Push IntelliJ repository changes through the Safe Push workflow.

JetBrains/intellij-community星标 20,685(GitHub 20,685 + cccskills 0)
集成工具Slack

实测评分 未实测

查看安装方法

适用场景

  • 了解如何将更改送入受保护分支
  • 推送前试运行 Safe Push
  • 排查 Safe Push 失败原因

中文介绍

功能

本指南介绍如何通过 safePush.cmd 将 IntelliJ 仓库的更改送入 Safe Push。您可以了解如何将当前 HEAD 或指定提交发送到目标分支、如何用 -dry-run 在不推送的情况下运行检查,以及各选项的作用。Safe Push 会先将更改发送到临时分支,再由 Patronus 执行测试、编译等 CI 检查。所有检查通过后,更改才会合并到目标分支。流程启动后,可通过显示的 Patronus 链接查看进度;失败时也可参考排查步骤。

适用场景

在把更改送入受保护分支前,想确认仓库要求的检查流程时,可以使用本指南。如果您希望提交更改时不跳过测试,或需要查明 Safe Push 失败或延迟的原因及恢复方法,本指南也能提供帮助。

使用示例

  • “请告诉我如何将当前更改 Safe Push 到 master。”
  • “如何在不推送的情况下试运行 Safe Push?”
  • “请说明 Safe Push 失败时的排查步骤。”

注意事项

本指南适用于 IntelliJ 仓库的 Safe Push 流程,执行时会使用仓库中的 safePush.cmd 和 Patronus。紧急推送会跳过测试,仅限指南中列出的特定紧急情况。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好常规流程要求检查通过,并限定紧急推送的适用情况。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要仓库中的命令和 Patronus,但未说明安装步骤。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md4.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/safe-push/SKILL.md -->

Safe Push Guide for AI Agents

This guide covers the Safe Push process for pushing changes to the IntelliJ repository.

Overview

Safe Push is a system that ensures code changes pass all required tests before being merged to protected branches (like master). It's powered by Patronus.

Safe Push CLI

The safePush.cmd script in the repository root provides command-line access to Safe Push without needing the IDE.

Basic Usage

# Push current HEAD to master (most common)
./safePush.cmd HEAD:master

# Push specific commit to master
./safePush.cmd <commit-hash>:master

# Push from feature branch to master
./safePush.cmd HEAD:master  # while on feature branch

# Dry run (test without pushing)
./safePush.cmd -dry-run HEAD:master

Options

-autosquash    Automatically squash fixup! commits (default true)
-dry-run       Run tests without push
-emergency     Skip tests and push directly (USE ONLY IN EMERGENCIES)
-verbose       Verbose output
-help          Print help

What Happens During Safe Push

  1. Your changes are pushed to a temporary branch
  2. Patronus triggers required CI checks (tests, compilation)
  3. Tests may retry up to 4 times for flaky failures
  4. If all checks pass, changes are merged to the target branch
  5. You receive Slack/Space/Email notification of results

Typical Duration

  • Successful Safe Push: ~3-5 hours (95th percentile ~4.7 hours)
  • Failed Safe Push: ~4-5 hours

Monitoring Progress

After starting a Safe Push you'll receive a Patronus URL like:

https://patronus.labs.jb.gg/robot/<uuid>

Always print this URL back to the user — it is their primary handle for the run (link to share, cancel button, restore-branch button). The <uuid> segment is the robot id.

You can also track the Safe Push directly: check current status, enumerate failing checks, drill into a specific attempt, or babysit a long-running robot until it finishes. All of that is in the [[patronus]] skill — pick it up when the user asks for status or when offering to follow up. It's reasonable to proactively suggest tracking or babysitting once the Safe Push is in flight; the user can say no. The [[patronus]] skill also documents the hand-off to [[teamcity-cli]] when an individual TC build needs deeper inspection.

Cancel and restore-branch actions stay in the browser.

Emergency Push

Use ./safePush.cmd -emergency ONLY for:

  • Fixing broken compilation
  • Reverting commits that break installers
  • Fixing .patronus/config.yaml misconfigurations

DO NOT use Emergency Push for:

  • Javadoc typo fixes
  • When Safe Push fails due to "unrelated" tests (they're likely related)
  • Skipping tests because you're in a hurry
  • Pushing large changes that conflict with concurrent pushes

Bazel Tests and Environment Variables

When writing tests that spawn external processes (like bazel.cmd), ensure required environment variables are passed:

// In BUILD.bazel for java_test targets:
env_inherit = [
    "LOCALAPPDATA",      // Windows
    "PROCESSOR_ARCHITECTURE",  // Windows
    "USERPROFILE",       // Windows
    "HOME",              // Unix/macOS - required for bazel cache directory
],

The Bazel sandbox does NOT inherit environment variables by default. Use env_inherit to explicitly pass variables from the host environment to tests.

Troubleshooting

Safe Push stuck or slow

  • Check #ij-builds Slack channel for infrastructure issues
  • Safe Push duration varies based on infrastructure load

Tests failing that seem unrelated

  • Patronus retries tests up to 4 times
  • If tests fail all 4 attempts and pass in master, your changes likely caused the failure
  • Report suspected infrastructure issues to #ij-qa-watch

Need to debug a failed Safe Push

  1. Go to your Safe Push on Patronus
  2. Click "commits" to see changes
  3. Click "Restore Branch" to recover your changes locally

References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

actions

免费有简介

实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。

  • 为 IDE 菜单添加操作
  • 修改操作注册或图标
  • 整理操作名称和说明
JetBrains/intellij-community2.1万2026年10月29日 更新

bazel-test-migration

免费有简介

将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。

  • 将 JPS 测试模块迁移到 Bazel
  • 排查仅在 Bazel 中失败的测试
  • 检查测试依赖和数据配置
JetBrains/intellij-community2.1万2026年10月29日 更新

code-style

免费有简介

按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。

  • 按 IntelliJ 规范编写 Kotlin
  • 审查 Java 代码
  • 检查异常处理和密封类型分支
JetBrains/intellij-community2.1万2026年10月29日 更新

commits

免费有简介

本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。

  • 按项目格式编写带工单号的提交信息
  • 整理测试或文档提交并选择合适标签
  • 按规则修改已有提交信息
JetBrains/intellij-community2.1万2026年10月29日 更新

使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。

  • 比较不同检查器的类型推断
  • 确认代码是否会被判为类型错误
  • 查看多个工具的诊断差异
JetBrains/intellij-community2.1万2026年10月29日 更新

整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。

  • 分离界面绘制与展示器决策
  • 整理界面状态的归属
  • 检查 Effect 键和协程用法
JetBrains/intellij-community2.1万2026年10月29日 更新

查看 JetBrains 的全部技能

报告此技能的问题