It can be intimidating to tackle a large project by trying to do everything at once. Instead of saying, "I'm going to build a website today," start with "I'm going to map out the user interface and the website functionality."

Then, move on to selecting the technologies to build the infrastructure of the site. Next, set up a frontend and backend. After that, focus on connecting them so that sample data can be requested, received, and displayed in the interface. Next, set up a route so that user-generated data can be submitted to the database.

At this point, don't worry about the appearance of the website or the features. Why? Because focusing too much on the end product would risk missing basic but crucial details at the start. By taking the project one step at a time and validating each change, you will be more confident that you're building a solid codebase that supports greater functionality and a flashy interface.

立即下载:免费html&css hacks

This hypothetical approach to building a website is a simplified example of the principles of continuous integration in action.

Continuous integration (CI) is a cornerstone ofDevOps pipelinesand is used inagile development workflows。The goal of this approach is to limit the amount and complexity of merge conflicts by implementing frequent pushes to the mainline. Once code is integrated and tested, code on local machines is updated with frequent pulls so that developers are always working with the latest version of the code.

Continuous integration diagram

在传统的软件开发生命周期中,CI集中在bob电竞官方下载构建和集成阶段。CI管道是通过自动化(工具和服务)以及文化转变(将团队价值观和目标与DevOps原则保持一致)的结合来实现的。

This video from freeCodeCamp provides another explanation of CI:

连续集成的目的

在传统软件开发方法中 - 例如bob电竞官方下载waterfall model— developers would be assigned features to build throughout the sprint. At the end of the sprint, the engineers combine their finished code to create the final codebase to build the application.

这种方法听起来很理想,但现实是,两个开发人员可能最终会编辑文件的同一部分。

What happens if Developer A has extended a snippet of code's functionality to support their feature while Developer B has deleted that same code snippet? Both have been working with different versions of the same file for weeks, and now their edits fundamentally conflict with each other. The process to solve this conflict is tedious and time-consuming.

将这种风险乘以数百或数千个文件中的多个开发人员用于企业大小的应用程序,您可以看到为什么这种陷阱被称为“合并地狱”,有时被称为“集成地狱”。

CI使用自动化解决了传统开发管道中的这种低效率,以增加数周甚至几个小时的合并和集成频率。现在,任何合并冲突的范围都要小得多,更简单,从而加快了为开发团队解决的时间。此外,工程师现在正在使用一个代码库,该代码库反映了他们的同龄人的更改,使每个人都在同一页面上。

In addition to solving this common roadblock, continuous integration offers several other advantages.

连续整合的好处

CI provides benefits for both the development team and the organization at large, which are covered below.

1.更快地捕获错误

现在,每个提交都会触发自动代码审核和测试过程。如果代码失败,则会立即通知开发人员,以便他们可以修复错误。由于CI强调常规提交(通常每天至少每天一次),开发人员现在不断验证他们的工作,而要等到编码阶段结束。

2.更早对软件的信心bob电竞官方下载

Another benefit of constant commits is that the code is continuously updated and tested. Development teams have greater confidence in the application because they are consistently receiving feedback from their automated tests. This greatly improves the odds that the final product will meet project requirements since they have confirmed each new feature or component against these expectations.

3. More Visibility for the Organization

构建CI管道的工具还可以跟踪功能创建和其他开发目标的进度。该数据还用于使其他利益相关者了解推出时间表。

运营团队可以跟踪他们何时应该期望收到从开发中释放的软件包。业务团队可以看到新功能的预期交付时间,以使客户了解情况,并且营销团队可以在构建产品时而不是在发布后开发围绕该产品的新功能的抵押品和广告系列。

4. Constant Availability of a Testable Build

随着对测试案例进行更改和验证,代码正在不断集成。这样可以确保始终可以测试质量保证(QA)团队的应用程序,以评估性能和配置要求。

The QA team can then communicate any deficiencies back to the development team, improving the turnaround time rather than discovering these issues after the coding phase is completed.

5. Explicit Definition of Requirements

CI can only deliver its full benefits with a robust testing strategy. Otherwise, all a development team may accomplish is streamlining the pipeline for committing defective code.

An added benefit of this focus on testing is that business and development teams have extra incentive to clearly define objectives at the start of the lifecycle. Thorough planning is essential so that the engineers can write the test cases to validate that the code meets these goals.

连续集成是许多开发团队加速其软件生命周期的第一步。bob电竞官方下载下一步是连续交付,它可以自动发布合并的代码进行手动部署。

一些组织通过连续部署扩展这种方法,该方法可以自动发行anddeployment processes so the code enters production without any human intervention. Combined, these strategies form the CI/CD pipeline.

现在,您了解了连续的集成及其意义,让我们研究它在实践中的使用方式。

How does continuous integration work?

CI allows software developers to segment responsibilities and independently code features in parallel. To build a CI pipeline that effectively supports this workflow, a few different toolsets are required.

首先,开发团队需要一个版本sion control system to track and merge changes. Next, a CI pipeline requires a code repository to store the codebase. A common version control system and repository combination isGit and GitHub

Finally, the pipeline needs atesting suite。This subset of tools can be used to perform code quality checks and syntax reviews before the code is committed and to perform unit testing after the codebase is compiled and the application is built.

Continuous integration workflow diagram

图像源

Once the pipeline has been orchestrated with the proper tools, a sample CI workflow would look like the following:

  1. Developer checks out code to edit in their workspace.
  2. Developer commits changes to the repository.
  3. Code quality and syntax are validated before the commit is accepted.
  4. 提交触发应用程序构建。
  5. 如果无法构建应用程序,请警告团队以解决该问题。
  6. Build server runs unit tests against the application.
  7. If the application passes test cases, the team is informed that the code is ready to merge.
  8. If the application fails test cases, code is released back to the team to remediate bugs.
  9. Repeat this cycle throughout the development phase.

This video from Edureka reviews the concept of CI, its purpose, and then walks through how to build a sample CI workflow with Jenkins:

Continuous Integration Powers DevOps

CI is an important cornerstone of DevOps and aligns with the DevOps model's approach to constant iteration and improvement. In addition, CI synergizes with other DevOps best practices, such as Shift Left testing and automation.

CI工具还将组织的其余部分告知发展进步,以便所有利益相关者都可以计划努力与发展步伐相匹配并产生更好的业务成果。CI实现了敏捷团队的中心目标:更快地生产更高质量的软件。bob电竞官方下载

New Call-to-action

css introduction

Originally published Feb 11, 2022 7:00:00 AM, updated February 11 2022

主题:

Developer Operations