云原生构建介绍
基于 Docker 生态,对环境、缓存、插件进行抽象,通过声明式的语法,帮助开发者以更酷的方式构建软件。
- 声明式:声明式语法,可编程、易分享。
- 易管理:与代码一起,同源管理。
- 云原生:资源池化,屏蔽基础设施复杂性。
声明式的构建环境
1main:
2 push:
3 - docker:
4 image: node:20
5 stages:
6 - node -v
7 - npm install
8 - npm test
声明式的构建缓存
1main:
2 push:
3 - docker:
4 image: node:20
5 volumes:
6 - /root/.npm:copy-on-write
7 stages:
8 - node -v
9 - npm install
10 - npm test
Docker 作为任务的运行环境
1main:
2 push:
3 - stages:
4 - name: run with node 20
5 image: node:20
6 script: node -v
7 - name: run with node 21
8 image: node:21
9 script: node -v
基于 Docker 生态的插件
1main:
2 push:
3 - stages:
4 - name: hello world
5 image: cnbcool/hello-world
按需获取计算资源
1main:
2 push:
3 - runner:
4 cpus: 64
5 docker:
6 image: node:20
7 stages:
8 - node -v
9 - npm install
10 - npm test
云原生开发
1$:
2 vscode:
3 - runner:
4 cpus: 64
5 services:
6 - vscode
7 docker:
8 image: node:20
9 volumes:
10 - node_modules:copy-on-write
11 stages:
12 - npm install
高性能
CPU自由
通过 runner.cpus 可按需声明需要的 CPU资源,最高可达 64核。
读秒克隆
基于 OverlayFS 的 git-clone-yyds 可以在数秒内完成代码准备,轻松支持 100GB+ 超大仓库。
缓存并发
copy-on-write 可以实现缓存的写时复制,在并发场景下,无需再担心缓存读写冲突问题。
1main:
2 push:
3 - runner:
4 cpus: 64
5 docker:
6 image: node:20
7 volumes:
8 - /root/.npm:copy-on-write
9 stages:
10 - node -v
11 - npm install
12 - npm test