Skip to Content
Jenkins 2权威指南
book

Jenkins 2权威指南

by Brent Laster
April 2019
Intermediate to advanced
566 pages
12h 12m
Chinese
Publishing House of Electronics Industry
Content preview from Jenkins 2权威指南
427
12
集成分析工具
大多数流水线都有一个“分析”阶段,用于处理诸如收集代码指标、确定复杂度、识别
不良编码实践和可能的漏洞,以及计算潜在的资源成本(如技术债务)。这些分析可以
识别出潜在的问题(有些问题比其他问题更严重),修复这些“漏洞”可以增强代码的
关键特性,如可读性、可靠性和可维护性。
在本章中,我们将介绍如何把最受欢迎的应用之一(如
SonarQube
)集成到
Jenkins
流水
线中。我们还会介绍如何集成另一个工具
JaCoCo
,用于代码覆盖率分析。代码覆盖率分
析经常被集成到像
SonarQube
这样的工具中,考虑到代码覆盖率在分析代码时经常发挥
重要作用,因此如何将其分离出来就很值得我们去了解。
对于
SonarQube
,我们将首先简要讨论该工具,以及如何将其集成到传统流水线中。然后,
我们将看看它如何转换为流水线即代码环境。在此过程中,我们将介绍在流水线中使用
此类工具的一个最重要的用途,即根据应用程序中设置的既定阈值,让流水线阶段成功
或者失败。
虽然我们将再次使用
Gradle
作为示例的支持技术,但是一旦你了解了基本原理,就知道
这种方法对于大多数其他技术也适用。
同样的,对于
JaCoCo
,我们将简要讨论该应用程序,看看它是如何集成到传统流水线中的,
然后看看我们如何将其迁移到流水线即代码中。
下面让我们首先讨论
SonarQube
可以为流水线提供哪些代码质量分析的功能。
SonarQube
调查
根据其网站介绍,
SonarQube
(以前被称为“
Sonar
)是一个开放的平台,用于管理一
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Jenkins Administrator's Guide

Jenkins Administrator's Guide

Calvin Sangbin Park, Lalit Adithya, Sam Gleske
Kubernetes 实战

Kubernetes 实战

Brendan Burns, Eddie Villalba, Dave Strebel, Lachlan Evenson

Publisher Resources

ISBN: 9787121357633