Skip to content

Commit

Permalink
Merge pull request #5 from mgr9525/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mgr9525 authored Oct 13, 2020
2 parents 79b28f4 + a1ed4da commit f783bb5
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 7 deletions.
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,120 @@ It is super easy to get started with your first project.

访问 `http://localhost:8030`



### 使用gokins


#### 下载运行
- 项目地址 : https://github.com/mgr9525/gokins
- 可以选择到Gokins的github主页下载对应平台的执行文件
- [下载最新版本](https://github.com/mgr9525/gokins/releases)

- 或者直接在服务器上执行以下命令
```
## 获取可执行文件
wget -c https://github.com/mgr9525/gokins/releases/download/v0.1.0/gokins-linux-amd64
## 授权
chmod +x gokins-linux-amd64
## 运行gokins
./gokins-linux-amd64
##查看帮助命令
./gokins-linux-amd64 --help
```
- 运行成功后 访问 `8030` 端口

#### 初始化配置
- 设置root账号密码

![在这里插入图片描述](https://img-blog.csdnimg.cn/2020101018222471.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)

- 登录后我们可以查看主界面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010183151544.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)

#### 流水线的使用
1. 更新git代码

配置代码目录

```
cd ~
mkdir programs
cd programs
git clone http://用户名:密码@git.xxx.cn/IPFS/IPFS-Slave.git
cd IPFS-Slave/
pwd
```
使用用户名密码clone防止流水线更新代码时需要登录凭证

复制此目录路径,新建流水线时需要

2. 流水线构建

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010185507308.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)
3. 新建好之后进入插件列表新建插件

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010190422932.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)


4. 首先新建一个更新git的插件

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010185741861.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)



5. 之后新建一个编译插件

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010185940669.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)
可以查看到有两个插件
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010190009652.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)


6. 返回运行流水线

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010190548125.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010190653913.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201010190721865.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21ncjk1MjU=,size_16,color_FFFFFF,t_70#pic_center)



- 以上就完成了一个简单的CI流水线工程



## 开发Gokins
Gokins目前还处于需要不断进步的阶段,如果你有兴趣假如我们,可以在github上提交pr或者iss


### 服务器环境
服务器: ubuntu18 linux64位
项目需要环境:git、golang、node.js
### 安装项目环境

1. git
`要求 git 2.17.1 或者 2.x 其他版本`

2. node.js
`要求 node 12.19.0 `

4. golang
`要求 golang 1.15.2 `


## Gokins的优势和未来趋势
- 体积小,无论是可执行文件还是运行内存,相对于Jenkins的运行内存节约不止一个量级,目前Gokins的运行内存大概就是在20kb左右
- 简单友好的UI交互,更加利于上手
- 自定义的插件配置,让你可以应对多种情况
- 安全,绝不收集任何用户或者服务器信息

在未来,一个简单、易用的CI/CD工具会大大提高企业的生产效率。同时Gokins不仅仅可以作为代码交付方面的工具,同样可以成为自动化运维的核心组件,用于支持大型工程。



## 更多

### 帮助
Expand Down
2 changes: 0 additions & 2 deletions comm/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ var (
Gin *gin.Engine
Db *xorm.Engine

Dbold *xorm.Engine

RunTaskLen int = 5
)
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
println("dir:" + dir)
flag.StringVar(&comm.Dir, "d", dir, "数据目录")
flag.StringVar(&comm.Host, "bind", ":8030", "绑定地址")
flag.IntVar(&comm.RunTaskLen, "rln", 5, "同时执行的流水线数量(默认5)")
flag.IntVar(&comm.RunTaskLen, "rln", 5, "同时执行的流水线数量")
flag.StringVar(&clearPass, "clp", "", "清除某个用户密码(请先关闭服务在执行)")
flag.StringVar(&mvData, "mvdata", "", "转移某个库数据到本地(目前转移的数据:流水线、流水线插件)")
flag.Parse()
Expand Down
3 changes: 1 addition & 2 deletions service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func MoveData(pth string) {
fmt.Println("old db path err:" + err.Error())
return
}
comm.Dbold = db

dbold = db
MoveModels()
}
8 changes: 6 additions & 2 deletions service/mv.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ import (
"gokins/model"
"time"

"github.com/go-xorm/xorm"

ruisUtil "github.com/mgr9525/go-ruisutil"
)

var dbold *xorm.Engine

func MoveModels() {
var olds []*ruisUtil.Map
err := comm.Dbold.SQL("select * from t_model").Find(&olds)
err := dbold.SQL("select * from t_model").Find(&olds)
if err != nil {
fmt.Println("find model err:" + err.Error())
return
Expand Down Expand Up @@ -49,7 +53,7 @@ func MoveModels() {

func mvPlugin(tid int64, md *model.TModel) {
var olds []*ruisUtil.Map
err := comm.Dbold.SQL("select * from t_plugin where tid=?", tid).Find(&olds)
err := dbold.SQL("select * from t_plugin where tid=?", tid).Find(&olds)
if err != nil {
fmt.Println("find model err:" + err.Error())
return
Expand Down

0 comments on commit f783bb5

Please sign in to comment.