Files
nexus/wiki/sources/ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments.md

58 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "CTP Topic 32 Using Atlantis CICD for Infrastructure Deployments"
type: source
tags:
- Atlantis
- CI/CD
- IaC
- Terraform
- GitOps
date: 2026-04-29
---
## Source File
- [[Cloud & DevOps/Public-Cloud-Learning-Sessions/06_CI_CD_GitOps/ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments.md]]
## Summary用中文描述
- 核心主题Atlantis 作为 Terraform IaC 自动化工具,用于替代 Jenkins 执行基础设施部署
- 问题域:当前 CI/CD 流水线速度慢初始化时间长、多次代码克隆、顺序测试、ECS Deployer 预配置)、复杂度高(持续修修补补导致脆弱和漂移)
- 方法/机制Atlantis 部署在每个 Landing Zone 的 Shared Account 中单一 EC2 实例上,通过 GitHub Enterprise Webhook 接收通知,用户在 PR 上评论 `atlantis plan/apply` 触发操作;内置 Locking 机制防止并发冲突,支持并行构建和跨账户角色访问
- 结论/价值Atlantis 通过合并前 Apply 的机制确保代码与基础设施同步,提供更优协作模型、简化网络架构、节省 VPC 端点成本
## Key Claims用中文描述
- Atlantis 团队使用 Atlantis 替代 Jenkins 进行基础设施部署,解决了原流水线速度慢的问题
- Atlantis 部署在每个 Landing Zone 的 Shared Account 中单一 EC2 实例上,通过 GitHub Enterprise Webhook 与代码库集成
- Atlantis 支持模块级 LockingPlan 运行时锁定模块目录,直到 PR 合并、关闭或 Plan 被丢弃才释放,防止并发冲突
- Atlantis 通过声明模块和数据文件依赖关系实现依赖触发计划(依赖变更自动触发相关模块的 Plan
- Atlantis 支持并行构建,对多个模块同时运行 Plan 和 Apply 命令
## Key Quotes
> "The current pipeline is practically very slow due to significant initialization time, multiple code cloning, sequential testing, and ECS deployer provisioning." — 原流水线速度瓶颈描述
> "Atlantis applies changes before merging, ensuring code in sync with infrastructure." — Atlantis 核心价值:合并前 Apply确保代码与基础设施同步
> "When a plan is run, the directory of each module is locked until the pull request that has this folder locked is merged or closed, or the plan is manually discarded." — Atlantis Locking 机制说明
## Key Concepts
- [[Atlantis]]:开源、自托管的 Terraform 自动化工具,通过 GitHub PR 评论触发 Plan/Apply 操作,替代传统 CI/CD 流水线执行 IaC 部署
- [[Terraform]]基础设施即代码IaC工具用于声明式定义和配置云基础设施
- [[GitOps]]:基于 Git 仓库作为单一事实来源的基础设施和应用程序交付方法论Atlantis 是 GitOps 落地的核心工具
- [[Infrastructure as Code (IaC)]]通过代码管理和配置基础设施的实践Terraform 是主流 IaC 工具之一
- [[CI/CD Pipeline]]:持续集成/持续交付流水线Atlantis 在 IaC 场景下替代了传统 Jenkins 流水线
## Key Entities
- [[Atlantis]]:本视频核心产品 — 开源 Terraform CI/CD 自动化工具,替代 Jenkins 用于基础设施部署
- [[Jenkins]]Atlantis 所替代的传统 CI/CD 工具 — 存在初始化慢、复杂度高、脆弱等问题
- [[GitHub Enterprise]]Atlantis 的协作平台 — 通过 Webhook 与 Atlantis 通信,用户通过 PR 评论触发 Plan/Apply
## Connections
- [[CTP Topic 33 An Introduction to GitOps]] ← is_implemented_by ← [[CTP Topic 32 Using Atlantis CICD for Infrastructure Deployments]]
- [[CTP Topic 9 CI CD with Gruntwork]] ← shares_pattern ← [[CTP Topic 32 Using Atlantis CICD for Infrastructure Deployments]](均涉及 IaC 自动化)
- [[CTP Topic 56 Automated Infrastructure Testing]] ← relates_to ← [[CTP Topic 32 Using Atlantis CICD for Infrastructure Deployments]]Terraform 测试为 Atlantis Plan 阶段的一部分)
- [[CTP Topic 55 AWS Firewall Manager]] ← uses ← [[Atlantis]]Firewall Manager 策略通过 Atlantis CI/CD 流水线部署)
- [[Jenkins]] ← replaced_by → [[Atlantis]](在 IaC 部署场景下的替代关系)
## Contradictions
- 与 [[Jenkins]] 的传统 CI/CD 模式:
- 冲突点Atlantis 主张合并前 ApplyJenkins 传统模式通常为合并后部署
- 当前观点Atlantis 认为合并前 Apply 能确保代码与基础设施始终同步,减少漂移风险
- 对方观点:传统 Jenkins 流水线通过自动化测试后合并部署,更符合 DevOps 最佳实践