Skip to content

Commit a010f6a

Browse files
authored
Merge pull request #575 from flashcatcloud/sync/change-c1-e2e-test
docs(change): Jenkins and GitHub change integration corrections
2 parents 60c6ca4 + ce815d7 commit a010f6a

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

‎en/on-call/integration/change-integration/github.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ After you save, GitHub sends a `ping`. Flashduty accepts it without creating a c
7373
| deployment_status | in_progress | Processing |
7474
| deployment_status | success | Done |
7575
| deployment_status | failure, error | Failed |
76+
| deployment_status | error from a GitHub Actions job canceled on the run page (`workflow_run.conclusion` is `cancelled`) | Canceled |
7677
| release | published | Done |
7778
| release | unpublished, deleted | Canceled |
7879

‎en/on-call/integration/change-integration/jenkins.mdx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords: ["change integration", "Jenkins", "Notification plugin", "build", "dep
66

77
<Tip>**Plan requirement**: This feature requires an On-call Standard or higher subscription. [Learn more](https://flashcat.cloud/flashduty/price/)</Tip>
88

9-
Use the Jenkins [Notification plugin](https://plugins.jenkins.io/notification/) to sync job builds to Flashduty On-call. Each build becomes one Flashduty change; every phase of the build, from queued and started to finished, updates that same change.
9+
Use the Jenkins [Notification plugin](https://plugins.jenkins.io/notification/) to sync job builds to Flashduty On-call. Each build becomes one Flashduty change; the build's start and finish update that same change.
1010

1111
Jenkins cannot tell whether a build changed anything, so add the notification only to **jobs that deploy**, not to jobs that only compile or test.
1212

@@ -36,15 +36,17 @@ Go to **Manage Jenkins → System** and make sure **Jenkins URL** under **Jenkin
3636

3737
Go to **Manage Jenkins → Plugins → Available plugins**, search for **Notification**, and install it. You need Jenkins administrator permission.
3838

39+
The plugin also needs the **JUnit** plugin, which Jenkins does not install with it. If **Manage Jenkins → Plugins → Installed plugins** does not list JUnit, install it too. Without JUnit, no notification is sent and the build log shows `NoClassDefFoundError: hudson/tasks/test/AbstractTestResultAction`.
40+
3941
</Step>
4042

4143
<Step title="Add the endpoint to a deployment job">
4244

4345
1. Open the deployment job, click **Configure**, find the **Job Notifications** section, and click **Add Endpoint**
4446
2. **Format**: select `JSON`
4547
3. **Protocol**: select `HTTP`
46-
4. **Event**: select `All Events`, so Flashduty sees the whole build: queued, started, and finished
47-
5. **URL Source**: select `Plain Text` and paste the complete Flashduty integration Push URL into **URL**. To keep the URL out of the job configuration, select `Credentials Store` instead, save the Push URL as a Secret text credential, and reference its ID
48+
4. **Event**: select `All Events`, so Flashduty sees the build both start and finish
49+
5. **URL Source**: select `Credentials Store`, save the complete Flashduty integration Push URL as a **Secret text** credential, and select that credential in **URL**. With `Plain Text`, the plugin prints the full Push URL, including `integration_key`, in the log of every build
4850
6. Keep **Branch** at the default `.*`, leave the other options at their defaults, and click **Save**
4951

5052
If the job configuration is managed by a Jenkinsfile (for example, a multibranch pipeline), add the same settings to the Jenkinsfile's `properties`. You can generate the code on the pipeline's **Pipeline Syntax → Snippet Generator** page by selecting `properties: Set job properties`.
@@ -73,7 +75,6 @@ Each build is one change. Its change key (change_key) is `<full build URL>#<queu
7375

7476
| Build phase (phase) | Build result (status) | Flashduty change status |
7577
|---|---|---|
76-
| QUEUED | — | Ready |
7778
| STARTED | — | Processing |
7879
| COMPLETED, FINALIZED | SUCCESS | Done |
7980
| COMPLETED, FINALIZED | UNSTABLE | Done |
@@ -84,6 +85,8 @@ Done, Failed, and Canceled are end states; Flashduty records the change's end ti
8485

8586
UNSTABLE means every build step ran, but tests or quality checks reported problems, so it is recorded as Done; use the `result` label to filter these changes.
8687

88+
The plugin sends QUEUED only when the build starts, never while the build waits in the queue. Flashduty accepts QUEUED without recording it, so a change appears when its build starts.
89+
8790
A `notifyEndpoints` step in a pipeline with `phase` set to `NONE` is accepted without creating a change.
8891

8992
## Change content
@@ -106,7 +109,7 @@ Labels can be used in routes and to filter the change list:
106109
| `phase` | The latest build phase |
107110
| `result` | The build result, present once the build has finished |
108111

109-
`branch` and `commit` appear only in notifications sent after the build checks out code, not in the queued and started phases. Route on `job`; otherwise the early and late events of one build can land in different channels.
112+
`branch` and `commit` are sent only by freestyle jobs that use Git under **Source Code Management**. A Pipeline job that checks out with the `git` step does not send them. A notification sent when the build starts can carry the values from before this build's checkout, so rely on the values at the end of the build. Route on `job`; otherwise the early and late events of one build can land in different channels.
110113

111114
## FAQ
112115
---
@@ -117,13 +120,14 @@ Labels can be used in routes and to filter the change list:
117120
- Make sure **Format** is `JSON` and **Protocol** is `HTTP`
118121
- Make sure **Jenkins URL** is set under **Manage Jenkins → System**
119122
- Look for `Notifying endpoint` or `Failed to notify endpoint` in the build log
123+
- `NoClassDefFoundError: hudson/tasks/test/AbstractTestResultAction` in the build log means the JUnit plugin is missing. Install it
120124
- When **Branch** is not `.*`, only builds that have a `BRANCH_NAME` environment variable matching it send notifications
121125

122126
</Accordion>
123127

124128
<Accordion title="Why does one build have two end events?">
125129

126-
The plugin sends one notification when the build completes (COMPLETED) and another when post-build actions finish (FINALIZED). Both carry the same result, so the change status does not change. To receive only one, set **Event** to `Job Finalized`, but then the queued and running phases are not shown.
130+
The plugin sends one notification when the build completes (COMPLETED) and another when post-build actions finish (FINALIZED). Both carry the same result, so the change status does not change. When both arrive within the same second, the second one is not recorded. To receive only one, set **Event** to `Job Finalized`, but then the running phase is not shown.
127131

128132
</Accordion>
129133

‎zh/on-call/integration/change-integration/github.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ GitHub Actions 中声明了 `environment` 的任务会自动创建 Deployment,
7373
| deployment_status | in_progress | Processing |
7474
| deployment_status | success | Done |
7575
| deployment_status | failure、error | Failed |
76+
| deployment_status | error,且来自在运行页面被取消的 GitHub Actions 任务(`workflow_run.conclusion` 为 `cancelled`) | Canceled |
7677
| release | published | Done |
7778
| release | unpublished、deleted | Canceled |
7879

‎zh/on-call/integration/change-integration/jenkins.mdx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords: ["变更集成", "Jenkins", "Notification 插件", "构建", "部署
66

77
<Tip>**版本要求**:此功能需要 On-call 标准版及以上订阅。[了解更多](https://flashcat.cloud/flashduty/price/)</Tip>
88

9-
通过 Jenkins 的 [Notification 插件](https://plugins.jenkins.io/notification/),将任务(Job)的构建同步到 Flashduty On-call。每一次构建对应一条 Flashduty 变更;构建从排队、开始执行到结束的每个阶段,都会更新同一条变更。
9+
通过 Jenkins 的 [Notification 插件](https://plugins.jenkins.io/notification/),将任务(Job)的构建同步到 Flashduty On-call。每一次构建对应一条 Flashduty 变更;构建开始执行和结束时,都会更新同一条变更。
1010

1111
Jenkins 无法区分一次构建是否发布了变更,因此只需在**执行部署的任务**上配置通知,不要在单纯编译、测试的任务上配置。
1212

@@ -36,15 +36,17 @@ Jenkins 无法区分一次构建是否发布了变更,因此只需在**执行
3636

3737
进入 **Manage Jenkins → Plugins → Available plugins**,搜索 **Notification** 并安装。需要 Jenkins 管理员权限。
3838

39+
该插件还依赖 **JUnit** 插件,但安装时不会自动带上。如果 **Manage Jenkins → Plugins → Installed plugins** 中没有 JUnit,请一并安装。缺少 JUnit 时插件不发送任何推送,构建日志中会出现 `NoClassDefFoundError: hudson/tasks/test/AbstractTestResultAction`。
40+
3941
</Step>
4042

4143
<Step title="在部署任务上添加通知地址">
4244

4345
1. 打开部署任务,点击 **Configure**,找到 **Job Notifications** 区域,点击 **Add Endpoint**
4446
2. **Format**:选择 `JSON`
4547
3. **Protocol**:选择 `HTTP`
46-
4. **Event**:选择 `All Events`,Flashduty 才能看到排队、开始和结束的完整过程
47-
5. **URL Source**:选择 `Plain Text`,**URL** 粘贴 Flashduty 集成的完整推送地址。不希望在任务配置中明文显示地址时,可选择 `Credentials Store`,把推送地址保存为 Secret text 凭据后引用其 ID
48+
4. **Event**:选择 `All Events`,Flashduty 才能同时看到构建开始和结束
49+
5. **URL Source**:选择 `Credentials Store`,把 Flashduty 集成的完整推送地址保存为 **Secret text** 凭据,并在 **URL** 中选择该凭据。选择 `Plain Text` 时,插件会在每次构建的日志中打印完整推送地址,包括 `integration_key`
4850
6. **Branch** 保持默认的 `.*`,其余选项保持默认,点击 **Save**
4951

5052
任务配置由 Jenkinsfile 管理(例如多分支流水线)时,在 Jenkinsfile 的 `properties` 中添加同样的配置,可通过流水线页面的 **Pipeline Syntax → Snippet Generator** 选择 `properties: Set job properties` 生成代码。
@@ -73,7 +75,6 @@ Jenkins 无法区分一次构建是否发布了变更,因此只需在**执行
7375

7476
| 构建阶段(phase) | 构建结果(status) | Flashduty 变更状态 |
7577
|---|---|---|
76-
| QUEUED | — | Ready |
7778
| STARTED | — | Processing |
7879
| COMPLETED、FINALIZED | SUCCESS | Done |
7980
| COMPLETED、FINALIZED | UNSTABLE | Done |
@@ -84,6 +85,8 @@ Done、Failed 和 Canceled 是结束状态,Flashduty 会记录变更结束时
8485

8586
UNSTABLE 表示构建步骤全部执行完成,但测试或质量检查报告了问题,因此记为 Done;可以通过 `result` 标签筛选出这类变更。
8687

88+
插件只在构建开始时发送 QUEUED,构建在队列中等待期间不会推送。Flashduty 接收 QUEUED 但不记录,因此变更在构建开始时出现。
89+
8790
在流水线中调用 `notifyEndpoints` 步骤且 `phase` 为 `NONE` 时,推送返回成功但不生成变更。
8891

8992
## 变更内容
@@ -106,7 +109,7 @@ UNSTABLE 表示构建步骤全部执行完成,但测试或质量检查报告
106109
| `phase` | 最新的构建阶段 |
107110
| `result` | 构建结果,结束后才有 |
108111

109-
`branch` 和 `commit` 只在构建检出代码之后的推送中出现,排队和开始阶段没有。请按 `job` 配置路由规则,否则同一次构建的前后事件可能进入不同的协作空间。
112+
只有在 **Source Code Management** 中配置了 Git 的自由风格任务才会推送 `branch` 和 `commit`;流水线(Pipeline)任务用 `git` 步骤检出时,推送中不含这两个字段。构建开始时的推送可能带着本次检出之前的值,请以构建结束时的值为准。请按 `job` 配置路由规则,否则同一次构建的前后事件可能进入不同的协作空间。
110113

111114
## 常见问题
112115
---
@@ -117,13 +120,14 @@ UNSTABLE 表示构建步骤全部执行完成,但测试或质量检查报告
117120
- 确认 **Format** 选择的是 `JSON`,**Protocol** 选择的是 `HTTP`
118121
- 确认 **Manage Jenkins → System** 中已填写 **Jenkins URL**
119122
- 查看构建日志中是否有 `Notifying endpoint` 或 `Failed to notify endpoint`
123+
- 构建日志中出现 `NoClassDefFoundError: hudson/tasks/test/AbstractTestResultAction` 时,说明缺少 JUnit 插件,安装后即可
120124
- **Branch** 不是 `.*` 时,只有带 `BRANCH_NAME` 环境变量且分支匹配的构建才会推送
121125

122126
</Accordion>
123127

124128
<Accordion title="为什么一次构建有两个结束事件?">
125129

126-
插件在构建完成(COMPLETED)和构建后操作完成(FINALIZED)时各推送一次,两者结果相同,变更状态不变。只想接收一次时,可以把 **Event** 改为 `Job Finalized`,但这样就看不到排队和执行中的阶段。
130+
插件在构建完成(COMPLETED)和构建后操作完成(FINALIZED)时各推送一次,两者结果相同,变更状态不变;两次推送在同一秒内到达时,第二次不会重复记录。只想接收一次时,可以把 **Event** 改为 `Job Finalized`,但这样就看不到执行中的阶段。
127131

128132
</Accordion>
129133

0 commit comments

Comments
 (0)