ARTS-07月1日到07月07日

英文閱讀

本文介紹了Gitlab CI CD,屬於Gitlab的官方文檔 https://about.gitlab.com/product/continuous-integration/

文中涉及到幾個概念Gitlab CI,Gitlab CD,GitLab Runner,Pipelines

Gitlab CI

What is CI?
Continuous Integration is the practice of integrating code into a shared repository and building/testing each change automatically, as early as possible - usually several times a day.

CI翻譯爲持續集成,是基於團隊共享代碼庫,開發人員合併提交代碼後,觸發事先編寫好的pinpine構建任務,對代碼進行構建,測試的過程。

CI是基於共享代碼庫的代碼集成實踐,基於每一次的更改進行構建和測試,通常一天進行很多次。

What is CD?

Continuous Delivery adds that the software can be released to production at any time, often by automatically pushing changes to a staging system.

CD用於對穩定系統的推送,在任何時候,自動的可以發佈到生產環境。
Continuous Deployment goes further and pushes changes to production automatically.

Why your team needs a CI/CD workflow

Continuous Integration
Detects errors as quickly as possible: fix problems while fresh in developers mind

更快更可能的檢測到錯誤

Reduces integration problems: smaller problems are easier to digest
降低集成問題,小的問題容易被消化

Avoid compounding problems: allows teams to develop faster, with more confidence
忽略混合問題,允許團隊更快,更信任的開發

Continuous Delivery

Ensures every change is releasable: test everything, including deployment, before calling it done
確保每次更改都是可發佈的
Lowers risk of each release: makes releases “boring”
對於每一次發佈是低風險的
Delivers value more frequently: reliable deployments mean more releases
更多的部署代表更多的版本
Tight customer feedback loops: fast and frequent customer feedback on changes
在變化中快速頻繁的接受客戶的反饋

What are the advantages of GitLab CI/CD?

  • Integrated: GitLab CI/CD is part of GitLab, enabling a single conversation from planning to deployment (and beyond)
    GitLab CI/CD 是GitLab 的一部分
  • Open source: CI/CD is a part of both the open source GitLab Community Edition and the proprietary GitLab Enterprise Edition
    社區版本和企業版本均是開源的
  • Easy to learn: See our Quick Start guide
  • Seamless: Part of the single GitLab application, with a single great user experience
  • Scalable: Tests run distributed on separate machines of which you can add as many as you want
  • Faster results: Each build can be split in multiple jobs that run in parallel on multiple machines
  • Optimized for delivery: multiple stages, manual deploy gates, [environments,]
    (https://docs.gitlab.com/ee/ci/environments.html) and variables

GitLab is one application for the entire DevOps lifecycle

GitLab是整個DevOps生命週期的一部分

  • Build your application using GitLab Runners
    構建
  • Run unit and integration tests to check if your code is valid
    測試
  • Look at a live preview of your development branch with [Review Apps]
    (https://about.gitlab.com/product/review-apps/)before merging into stable
    在線預覽
  • Deploy to multiple environments like staging and production, and support advanced features such as canary deployments
    基於不同環境的部署
  • Monitor performances and status of your application
    監控

Architecture

GitLab CI/CD

GitLab CI/CD is a part of GitLab, a web application with an API that stores its state in a database. It manages projects/builds and provides a nice user interface, besides all the features of GitLab.

GitLab Runner

GitLab Runner is an application which processes builds. It can be deployed separately and works with GitLab CI/CD through an API.

In order to run tests, you need at least one GitLab instance and one GitLab Runner.

GitLab Runner

To perform the actual build, you need to install GitLab Runner which is written in Go.

It can run on any platform for which you can build Go binaries, including Linux, OSX, Windows, FreeBSD and Docker.

It can test any programming language including .Net, Java, Python, C, PHP and others.

GitLab Runner has many features, including autoscaling, great Docker support, and the ability to run multiple jobs concurrently.

Pipeline

一次 Pipeline 其實相當於一次構建任務,裏面可以包含多個流程,如安裝依賴、運行測試、編譯、部署測試服務器、部署生產服務器等流程。

技巧呈現

php-ext-excel-export擴展使用札記

PHP環境下的導出功能優化改造,單次同步導出數據量在2萬之上。 原有導出功能使用的PHP5.6+PHPExcel.這一次換成了PHP7.2+php-ext-excel-export。同步導出幾萬條性能還可以接受。

文章分享

分享文章 Mac安裝Zookeeper帶來的Zookeeper簡單介紹及思考

本篇以PHP環境下Zookeeper擴展安裝爲起點,簡單介紹了Zookeeper基本概念和使用場景,不是很完整。如果PHP和Zookeeper作爲一個分佈式系統的客戶端而言,網上的使用案例非常有限,跟PHP環境下熔斷組建的使用一樣,案例非常少,穩定性不能保證。

從兩方面來看這個事:一,業界基本沒有這樣的使用場景和技術案例,爲什麼沒有,因爲PHP語言生態不適合做這塊,能做嗎,或許能做,但是不適合,不是強項。二,如果有類似的需求,我們不應該選擇PHP來做這塊,因爲整個業界都沒有這樣做的,我們應該把經歷花在更有意義的選擇上。

參考資料

用 GitLab CI 進行持續集成

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章