跳过主要内容

Saved Posts

Build a CI/CD Pipeline in the Cloud: Part One

Dave Nicolette | LeadingAgile
Dave Nicolette Senior Consultant
Reading: Build a CI/CD Pipeline in the Cloud: Part One

嘿,这是我们可以一起做的有趣的事情:让我们开发微服务,并在云中建立端到端的连续集成/连续部署管道,而没有本地安装的开发工具。

This Part 1 of a four-part post. Here’s what we’ll do:

  • Part 1: Clarify scope, answer a few questions, and sign up for some online services we’ll be using during the exercise
  • Part 2: Configure version control, development environment, dependency manager, and run manager.
  • 第3部分:测试驱动我们的微服务的初始功能。
  • Part 4: Configure continuous integration, static code analysis, and automated deployment.

I can hear you saying:I’m not a developer, so this post isn’t for me.

这是对功能性,基于云的连续交付管道的基本元素的非常友好的演练。如果您是项目经理,Scrum Master,产品所有者,敏捷教练或其他在软件开发和交付方面都有利益的人,那么这可能是您了解世界开发人员生活的一种方式。

If you’re a developer and you want to get your feet wet with some configuration and deployment stuff, this could be fun for you. If you’re an infrastructure engineer and you want to try your hand at writing some code, this could be fun for you.

I can hear you saying:Well, okay, but…

什么是微服务?

The term服务通常是指可以通过网络调用以检索结果的应用程序(或应用程序的某些函数)。例如,如果您调用OpenWeatherMap服务to get weather information for London, UK, like this…

http://samples.openweathermap.org/data/2.5/weather?q=london,uk&appid = b6907d289e10d714a6e88b30761fae22

…服务可能会返回这样的结果:

{" coord ":{“朗”:-0.13,“纬度”:51.51},“天气”: [ { "id":300, "main":"Drizzle", "description":"light intensity drizzle", "icon":"09d" } ], "base":"stations", "main": { "temp":280.32, "pressure":1012, "humidity":81, "temp_min":279.15, "temp_max":281.15 }, "visibility":10000, "wind": { "speed":4.1, "deg":80 }, "clouds": { "all":90 }, "dt":1485789600, "sys": { "type":1, "id":5091, "message":0.0103, "country":"GB", "sunrise":1485762037, "sunset":1485794875 } "id":2643743, "name":"London", "cod":200 }

You can invoke most services just like that, and view the result as it is presented. But normally the expectation is you will write a piece of software that acts as a客户to the service. That piece of software will help the user formulate the request and will present the results in a friendlier form than the raw text. After all, most people don’t want to see that the sun will rise at precisely 1485762037 in the morning, or that the current temperature is 280.32 degrees. (Thatis有点冷。最好拿起夹克!)

The prefixmicro-implies “small.” But the idea isn’t just that the service is small. The idea is to design an application as a set of small services that can be deployed independently of one another. The term微服务体系结构is meant to distinguish this approach from previous design approaches, which in hindsight we call整体。In a monolithic application, you have to deploy the whole thing even if only one small part of it has changed.

It’s also difficult to reconfigure a running monolithic application to handle dynamic changes in workload or other environmental factors. If a monolithic application experienced an increase in demand for one of its functions, you’d have to spin up additional instances of the entire application. With a microservices architecture, you can scale and de-scale individual services. This can save both cost and effort.

What’s Continuous Integration?

As a software team makes changes to a code base, different team members soon find themselves working with modified versions of the code that are all out of sync with each other. With older software development methods, the various team members integrated their changes only after they had made significant modifications. This often led to difficulties in merging the various changes without losing code or breaking functionality.

With contemporary methods, team members commit very small changes to version control very frequently, throughout the day. Each time they commit they also update their local copy of the code base from version control, so that they have the latest version. In this way they integrate their changes very frequently (in a sense, “continuously”) rather than accumulating a large set of changes that may be more difficult to integrate all at once.

What’s Continuous Deployment?

连续部署与连续集成类似,只是它与将应用程序部署到生产有关,而不是与集成代码更改有关。现在,我们不想在将它们全部迁移到生产之前进行数周或几个月的修改,而是现在宁愿经常部署小型更改。

As a single small change may not completely implement a new feature, we use so-calledfeature togglesto mark some sections of code as “active” or “inactive,” so it will be safe to move incomplete modules into the production environment.

What’s a Delivery Pipeline?

交付管道包括一系列步骤,将代码从开发一直到生产环境中。使用较旧的方法,这几乎总是手动完成。人们并没有将其作为“管道”,因为它看起来和感觉像是一堆脱节的活动。这些活动通常以一定的顺序进行,但是整个过程并未整体上组织,并且经常将不同的活动分配给仅在一项任务中专业的团队。

如今,大多数或所有这些步骤通常是完全(或几乎完全)自动化的。当开发人员将代码更改为版本控制系统时,ACT会触发一系列自动步骤。假设一路上没有发现错误,并且假设自动部署从业务角度有意义,那么代码更改可以在没有任何人类干预的情况下找到生产的方式。亚博vip9通道

It’s something like this:

What are We Going to Do?

我们将汇总该图片中所示的管道。我们不会有那么多步骤,因为我们只有一个自动测试。我们将使用的在线设施将为我们处理一些步骤。我们也不会遇到合并冲突,因为我们不会与其他人同时进行服务。我们还将使用容器和容器管理工具。这将是您可能在企业IT情况下为真实生产操作设置的管道的子集。它将包括此类管道的所有主要移动部件,因此您可以对此有一种实用的感觉。

Let’s Get Set Up

这是您需要的:

  • A free account onGithub。This will be the version control system.
  • A free account on代码在任何地方。This will be the development environment.
  • A free (Open Source) account on特拉维斯CI。This will be the continuous integration service.
  • A free (Open Source) account on代码气候。这将是测试覆盖范围和静态代码分析服务。
  • A free account onHeroku。这将是生产环境。

从现在到第2部分的出版之间,您的作业是注册这些在线服务。与他们一起玩耍,探索他们支持的功能。做一些阅读以准备开始动手活动。

I’ll be back soon!

NextBuild a CI/CD Pipeline in the Cloud: Part Two

评论(1)

  1. 缺口
    Reply

    云工具无摩擦。我使用这些,但使用Cloud 9进行IDE,并将bash shell和Circleci用于构建管道。从来没有更简单的编码时间。

    Reply

Leave a comment

您的电子邮件地址不会被公开。必需的地方已做标记*