drone 学习一 几个核心组件
1. clone
这个是内置的,实际上就行进行代码clone的
参考配置,同时我们可以使用自定义的插件
clone:
+ git:
+ image: plugins/git
pipeline:
build:
image: golang
commands:
- go build
- go test
2. workspace
字面意思是工作空间,drone 的pipeline 过程中是共享的
参考配置 ,实际上就是指定我们项目代码的位置,以及目录结构
+workspace:
+ base: /go
+ path: src/github.com/octocat/hello-world
pipeline:
build:
image: golang:latest
commands:
- go get
- go test
3. pipelins
构建的任务
参考配置
pipeline:
backend:
image: golang
commands:
- go build
- go test
frontend:
image: node
commands:
- npm install
- npm run test
- npm run build
4. webhook
实际上就是我们的项目构建出发的条件
实际的一些条件参考
http://docs.drone.io/pipeline-conditions/
5. service
我们项目运行依赖的一些服务(redis, 数据库 。。。)
参考配置, 访问方式类似docker-compose
pipeline:
build:
image: golang
commands:
- go build
- go test
services:
database:
image: mysql
cache:
image: redis
6. plugins
实际上drone 的每个任务都是使用容器插件构建的
参考
pipeline:
build:
image: golang
commands:
- go build
- go test
publish:
image: plugins/docker
repo: foo/bar
tags: latest
notify:
image: plugins/slack
channel: dev
7. promoting(提升,实际上就是开发中环境的转变)
参考
pipeline:
build:
image: golang
commands:
- go build
- go test
publish:
image: plugins/docker
registry: registry.heroku.com
repo: registry.heroku.com/my-staging-app/web
when:
+ event: deployment
+ environment: staging
publish_to_prod:
image: plugins/docker
registry: registry.heroku.com
repo: registry.heroku.com/my-production-app/web
when:
+ event: deployment
+ environment: production
8. Matrix Builds
实际上就是我们的一些构建环境参数 比如 golang 的不同运行时环境
参考配置
pipeline:
build:
image: golang:${GO_VERSION}
commands:
- go get
- go build
- go test
services:
database:
image: ${DATABASE}
matrix:
GO_VERSION:
- 1.4
- 1.3
DATABASE:
- mysql:5.5
- mysql:6.5
- mariadb:10.1
9. 参考资料
http://docs.drone.io/hooks/
http://docs.drone.io/workspace/
http://docs.drone.io/cloning/
http://docs.drone.io/pipelines/
http://docs.drone.io/services/
http://docs.drone.io/using-plugins/
http://docs.drone.io/promoting-builds/
http://docs.drone.io/matrix-builds/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)