Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Tencent/bk-ci into issue_…
Browse files Browse the repository at this point in the history
…5836
  • Loading branch information
JamiKX1 committed May 26, 2022
2 parents 3d0df3a + 291c78e commit a8d095b
Show file tree
Hide file tree
Showing 865 changed files with 24,120 additions and 12,305 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.13.15
go-version: 1.18.1
- uses: actions/checkout@v2
- run: make clean build_linux
working-directory: src/agent/
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.13.15
go-version: 1.18.1
- uses: actions/checkout@v2
- run: make clean build_linux
working-directory: src/agent/
Expand Down Expand Up @@ -179,11 +179,10 @@ jobs:
${{ runner.os }}-codecc-gradle-
- name: Gradle Build
id: codecc-backend
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 4.6
build-root-directory: src/backend/codecc
arguments: clean copyToRelease -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"
working-directory: src/backend/codecc
run: |
chmod +x gradlew
./gradlew clean copyToRelease -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"
- name: frontend
id: codecc-frontend
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy-codecc/bk-codecc-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ detect_main (){
# 检查服务启动成功. health接口为格式化后的, 要求整行匹配.
check_springboot_up (){
local port="$1"
curl -m 1 -sf "http://127.0.0.1:$port/management/health" 2>/dev/null | grep -qx ' "status" : "UP",'
curl -m 1 -sf "http://127.0.0.1:$port/management/health" 2>/dev/null | grep -qx ' "status" : "UP"'
}
# 等待服务启动成功.
wait_springboot_up (){
Expand Down
57 changes: 46 additions & 11 deletions src/agent/Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
BINDIR := $(CURDIR)/bin
CMDDIR := $(CURDIR)/src/cmd

all: build_linux
all: build_linux build_linux_arm64 build_linux_mips64 build_macos build_macos_arm64 build_windows

linux: build_linux build_linux_arm64 build_linux_mips64

windows: build_windows

build_linux:
mkdir -p $(BINDIR)
go env
GO111MODULE=on go build -o $(BINDIR)/devopsDaemon_linux $(CMDDIR)/daemon
GO111MODULE=on go build -o $(BINDIR)/devopsAgent_linux $(CMDDIR)/agent
GO111MODULE=on go build -o $(BINDIR)/upgrader_linux $(CMDDIR)/upgrader
GO111MODULE=on go build -o $(BINDIR)/installer_linux $(CMDDIR)/installer
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINDIR)/devopsDaemon_linux $(CMDDIR)/daemon/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINDIR)/devopsAgent_linux $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINDIR)/upgrader_linux $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINDIR)/installer_linux $(CMDDIR)/installer/main.go
ls -la $(BINDIR)
build_linux_arm64:
mkdir -p $(BINDIR)
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(BINDIR)/devopsDaemon_linux_arm64 $(CMDDIR)/daemon/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(BINDIR)/devopsAgent_linux_arm64 $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(BINDIR)/upgrader_linux_arm64 $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(BINDIR)/installer_linux_arm64 $(CMDDIR)/installer/main.go
ls -la $(BINDIR)
build_linux_mips64:
mkdir -p $(BINDIR)
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -o $(BINDIR)/devopsDaemon_linux_mips64 $(CMDDIR)/daemon/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -o $(BINDIR)/devopsAgent_linux_mips64 $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -o $(BINDIR)/upgrader_linux_mips64 $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -o $(BINDIR)/installer_linux_mips64 $(CMDDIR)/installer/main.go
ls -la $(BINDIR)

# Telegraf 的 cpu和diskio 插件采集使用的 shirou 包需要开启cgo才可以在darwin情况下采集成功
build_macos:
mkdir -p $(BINDIR)
go env
GO111MODULE=on go build -o $(BINDIR)/devopsDaemon_macos $(CMDDIR)/daemon
GO111MODULE=on go build -o $(BINDIR)/devopsAgent_macos $(CMDDIR)/agent
GO111MODULE=on go build -o $(BINDIR)/upgrader_macos $(CMDDIR)/upgrader
GO111MODULE=on go build -o $(BINDIR)/installer_macos $(CMDDIR)/installer
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $(BINDIR)/devopsDaemon_macos $(CMDDIR)/daemon/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $(BINDIR)/devopsAgent_macos $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $(BINDIR)/upgrader_macos $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $(BINDIR)/installer_macos $(CMDDIR)/installer/main.go
ls -la $(BINDIR)
build_macos_arm64:
mkdir -p $(BINDIR)
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $(BINDIR)/devopsDaemon_macos_arm64 $(CMDDIR)/daemon/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $(BINDIR)/devopsAgent_macos_arm64 $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $(BINDIR)/upgrader_macos_arm64 $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $(BINDIR)/installer_macos_arm64 $(CMDDIR)/installer/main.go
ls -la $(BINDIR)

build_windows:
mkdir -p $(BINDIR)
GO111MODULE=on CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o $(BINDIR)/devopsDaemon.exe $(CMDDIR)/daemon/main_win.go
GO111MODULE=on CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o $(BINDIR)/devopsAgent.exe $(CMDDIR)/agent/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o $(BINDIR)/upgrader.exe $(CMDDIR)/upgrader/main.go
GO111MODULE=on CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o $(BINDIR)/installer.exe $(CMDDIR)/installer/main.go
ls -la $(BINDIR)

clean:
mkdir -p $(BINDIR)
rm -f $(BINDIR)/*
9 changes: 5 additions & 4 deletions src/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
构建Agent是指包含了agent进程监控和调度部分逻辑的代码,不包含与流水线交互的构建类业务逻辑代码,需要与另外一个worker(kotlin) 一起整合才能是完整的Agent包。

## Agent二进制程序编译

> 以下命令请在本目录执行
linux系统,执行命令 `make clean build_linux`
Expand All @@ -23,10 +24,10 @@ windows编译,执行脚本 `build_windows.bat`

举例Linux, 其他系统依此类推。

- scripts/linux/install.sh: agent安装脚本
- scripts/linux/start.sh: agent启动脚本
- scripts/linux/stop.sh: agent停止脚本
- scripts/linux/uninstall.sh: agent卸载脚本
- scripts/linux/install.sh: agent安装脚本
- scripts/linux/start.sh: agent启动脚本
- scripts/linux/stop.sh: agent停止脚本
- scripts/linux/uninstall.sh: agent卸载脚本



74 changes: 66 additions & 8 deletions src/agent/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,72 @@
module github.com/Tencent/bk-ci/src/agent

go 1.13
go 1.18

require (
github.com/astaxie/beego v1.12.1
github.com/gofrs/flock v0.7.1
github.com/influxdata/telegraf v1.14.3
github.com/kardianos/service v1.0.0
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
github.com/gofrs/flock v0.8.1
github.com/influxdata/telegraf v1.22.3
github.com/kardianos/service v1.2.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
gopkg.in/ini.v1 v1.66.4
gopkg.in/natefinch/lumberjack.v2 v2.0.0
)

replace github.com/influxdata/telegraf => github.com/ci-plugins/telegraf v1.99.0
replace golang.zx2c4.com/wireguard v0.0.20200121 => golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090
require (
collectd.org v0.5.0 // indirect
github.com/alecthomas/participle v0.4.1 // indirect
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect
github.com/antchfx/jsonquery v1.1.5 // indirect
github.com/antchfx/xmlquery v1.3.9 // indirect
github.com/antchfx/xpath v1.2.0 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/caio/go-tdigest v3.1.0+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/doclambda/protobufquery v0.0.0-20210317203640-88ffabe06a60 // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gosnmp/gosnmp v1.34.0 // indirect
github.com/influxdata/line-protocol/v2 v2.2.1 // indirect
github.com/influxdata/toml v0.0.0-20190415235208-270119a8ce65 // indirect
github.com/influxdata/wlog v0.0.0-20160411224016-7c63b0a71ef8 // indirect
github.com/jhump/protoreflect v1.8.3-0.20210616212123-6cc1efa697ca // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/prometheus v1.8.2-0.20210430082741-2a4b8e12bbf2 // indirect
github.com/shirou/gopsutil/v3 v3.22.3 // indirect
github.com/sleepinggenius2/gosmi v0.4.4 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.1 // indirect
github.com/tidwall/gjson v1.10.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/vjeantet/grok v1.0.1 // indirect
github.com/wavefronthq/wavefront-sdk-go v0.9.10 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit a8d095b

Please sign in to comment.