7 Commits

Author SHA1 Message Date
Jay d894b1861e update
continuous-integration/drone/tag Build is passing
2021-06-15 00:16:56 +08:00
Jay 49281cdc24 udpate
continuous-integration/drone/tag Build is failing
continuous-integration/drone/push Build is passing
2021-06-15 00:13:05 +08:00
Jay a94f041a89 update ci
continuous-integration/drone/tag Build was killed
continuous-integration/drone/push Build is passing
2021-06-15 00:12:17 +08:00
root 95c57a3b8a Merge pull request 'add ci setting' (#3) from release/1.0.1 into master
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
Reviewed-on: #3
2021-06-14 16:09:14 +00:00
Jay 52680ec8f5 add ci setting
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-06-15 00:02:37 +08:00
root 9a9ccaf5f5 Merge pull request '[feat] remove cgo and add cmd stderr output' (#2) from release/1.0.1 into master
Reviewed-on: #2
2021-06-14 14:59:48 +00:00
Jay cc128b5b9d [feat] remove cgo and add cmd stderr output 2021-06-14 22:58:39 +08:00
3 changed files with 59 additions and 8 deletions
+36
View File
@@ -0,0 +1,36 @@
kind: pipeline
name: release
steps:
- name: build
image: golang:rc
volumes:
- name: dist
path: /data
commands:
- make build
- cp -r contrib /data
- cp deploy /data
- cp config.yml.sample /data/config.yml
- cd /data && tar cvf release.tar --exclude=release.tar .
- name: relase
image: plugins/gitea-release
volumes:
- name: dist
path: /data
settings:
api_key:
from_secret: api-key
base_url: https://git.trj.tw
files: /data/release.tar
title: ${DRONE_TAG}
checksum:
- md5
- sha1
- sha256
when:
event: tag
volumes:
- name: dist
temp: {}
+1 -1
View File
@@ -3,7 +3,7 @@
BIN_NAME := deploy BIN_NAME := deploy
build: build:
go build -buildmode=pie -ldflags '-w -s' -o $(BIN_NAME) ./cmd/svc/main.go CGO_ENABLED=0 go build -buildmode=pie -ldflags '-w -s' -o $(BIN_NAME) ./cmd/svc/main.go
clean: clean:
rm $(BIN_NAME) rm $(BIN_NAME)
+15
View File
@@ -52,11 +52,16 @@ func (s *HTTPServer) setHandler(check map[string]string, script string) gin.Hand
if err != nil { if err != nil {
nlog.Warnf("setup pipe out fail: %+v\n", err) nlog.Warnf("setup pipe out fail: %+v\n", err)
} }
errReader, err := cmd.StderrPipe()
if err != nil {
nlog.Warnf("setup pipe out fail: %+v\n", err)
}
if err := cmd.Start(); err != nil { if err := cmd.Start(); err != nil {
nlog.Warnf("start script fail: %+v\n", err) nlog.Warnf("start script fail: %+v\n", err)
} }
go func() {
in := bufio.NewScanner(reader) in := bufio.NewScanner(reader)
for in.Scan() { for in.Scan() {
nlog.Debugf(in.Text()) nlog.Debugf(in.Text())
@@ -64,6 +69,16 @@ func (s *HTTPServer) setHandler(check map[string]string, script string) gin.Hand
if err := in.Err(); err != nil { if err := in.Err(); err != nil {
nlog.Warnf("script error: %+v\n", err) nlog.Warnf("script error: %+v\n", err)
} }
}()
go func() {
in := bufio.NewScanner(errReader)
for in.Scan() {
nlog.Debugf(in.Text())
}
if err := in.Err(); err != nil {
nlog.Warnf("script error: %+v\n", err)
}
}()
}() }()