包阅导读总结
1.
– `Gitlab CI/CD`
– `Cloud Deploy`
– `Continuous Delivery`
– `Software Delivery`
– `Google Cloud`
2. 本文介绍了利用Gitlab CI/CD和Cloud Deploy创建持续交付管道以实现软件从代码提交到生产发布的自动化,包括解决方案的要素、所需条件、管道流程等,并提及了Google Cloud与Gitlab的集成。
3.
– 持续交付(CD)
– 介绍了持续交付的概念及作用
– 解决方案要素
– Gitlab CI/CD:集成的持续集成和交付平台,自动化代码构建、测试和部署
– Cloud Deploy:谷歌托管服务,用于自动化应用在不同阶段的部署
– Google Cloud Gitlab 集成:包括认证、Artifact Registry、Cloud Deploy、Gcloud、Gitlab runners on Google Cloud 等方面
– 所需条件
– Gitlab 账户
– 具有项目所有者访问权限的 Google Cloud 项目
– 本地克隆包含示例代码的 Gitlab 仓库
– 管道流程
– 开发者创建分支、修改代码并提出合并请求
– Gitlab 管道运行相关作业,如构建容器镜像等
思维导图:
文章来源:cloud.google.com
作者:Giovanni Galloro
发布时间:2024/8/5 0:00
语言:英文
总字数:2222字
预计阅读时间:9分钟
评分:84分
标签:持续交付,GitLab CI/CD,云部署,CI/CD 管道,DevOps
以下为原文内容
本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com
Continuous Delivery (CD) is a set of practices and principles that enables teams to deliver software quickly and reliably by automating the entire software release process using a pipeline. In this article, we explain how to create a Continuous Delivery pipeline to automate software delivery from code commit to production release on Cloud Run using Gitlab CI/CD and Cloud Deploy, leveraging the recently released Gitlab Google Cloud integration.
Elements of the solution
Gitlab CI/CD
GitLab CI/CD is an integrated continuous integration and delivery platform within GitLab. It automates the build, test, and deployment of your code changes, streamlining your development workflow. For more information check the Gitlab CI/CD documentation.
Cloud Deploy
Cloud Deploy is a Google managed service that you can use to automate how your application is deployed across different stages to a series of runtime environments. With Cloud Deploy, you can define delivery pipelines to deploy container images to GKE and Cloud Run targets in a predetermined sequence. Cloud Deploy supports advanced deployment strategies as progressive releases, approvals, deployment verifications, parallel deployments.
Google Cloud Gitlab integration
Gitlab and Google Cloud recently released integrations to make it easier and more secure to deploy code from Gitlab to Google Cloud. The areas of integration described in this article are:
-
Authentication: The GitLab and Google Cloud integration leverages workload identity federation, enabling secure authorization and authentication for GitLab workloads, as CI/CD jobs, with Google Cloud. This eliminates the need for managing service accounts or service account keys, streamlining the process and reducing security risks. All the other integration areas described below leverage this authentication mechanism.
-
Artifact Registry: The integration lets you upload GitLab artifacts to Artifact Registry and access them from Gitlab UI.
-
Cloud Deploy: This Gitlab component facilitates the creation of Cloud Deploy releases from Gitlab CI/CD pipelines.
-
Gcloud: This component facilitates running gcloud commands in Gitlab CI/CD pipelines.
-
Gitlab runners on Google Cloud: The integration lets you configure runner settings from Gitlab UI and have them deployed on your Google Cloud project with Terraform.
You can access the updated list of Google Cloud Gitlab components here.
What you’ll need
To follow the steps in this article you need:
-
A Gitlab account (Free, Premium or Ultimate)
-
A Google Cloud project with project owner access
-
A fork, in your account, of the following Gitlab repository containing the example code: https://gitlab.com/galloro/cd-on-gcp-gl cloned locally to your workstation.
Pipeline flow
You can see the pipeline in the .gitlab-ci.yml file in the root of the repo or using the Gitlab Pipeline editor.
Following the instruction in this article you will create and execute an end to end software delivery pipeline where:
-
A developer creates a feature branch from an application repository
-
The developer makes a change to the code and then opens a merge request to merge the updated code to the main branch
-
The Gitlab pipeline will run the following jobs, all configured to run when a merge request is open through the
- if: $CI_PIPELINE_SOURCE == 'merge_request_event
‘ rule:
a. The image-build
job, in the build
stage, builds a container image with the updated code.