-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (121 loc) · 4.26 KB
/
deploy-to-cm-servers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# This workflow performs continuous delivery (CD) to CM servers.
# This workflow will build the agent and server binaries. Then deploy to CM servers.
name: Deploy to CM Servers
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- ".gitignore"
- "LICENSE"
- "CODEOWNERS"
- "agent/docs/**"
- "server/docs/**"
- "agent/scripts/**"
- "server/scripts/**"
# - "assets/**"
# - "scripts/**"
# - "src/testclient/scripts/**"
# - ".all-contributorsrc"
jobs:
build-and-deploy-agent:
name: Build and deploy agent
strategy:
matrix:
go-version: ["1.23.0"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go-version}}
- name: Build
run: make -C agent
- name: Copy agent binary to NFS server
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
source: "agent/cmd/cm-honeybee-agent/cm-honeybee-agent"
strip_components: 3
target: "/tmp/"
overwrite: true
- name: Restart agent from NFS server with new binary
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
script: |
systemctl stop cm-honeybee-agent
mv -f /tmp/cm-honeybee-agent /usr/bin/cm-honeybee-agent
systemctl start cm-honeybee-agent
echo "[cm-honeybee-agent Version]"
/usr/bin/cm-honeybee-agent version
- name: Copy agent binary to Web server
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_WEB }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
source: "agent/cmd/cm-honeybee-agent/cm-honeybee-agent"
target: "/tmp/"
strip_components: 3
overwrite: true
- name: Restart agent from Web server with new binary
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_WEB }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
script: |
systemctl stop cm-honeybee-agent
mv -f /tmp/cm-honeybee-agent /usr/bin/cm-honeybee-agent
systemctl start cm-honeybee-agent
echo "[cm-honeybee-agent Version]"
/usr/bin/cm-honeybee-agent version
build-and-deploy-server:
name: Build and deploy server
strategy:
matrix:
go-version: ["1.23.0"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go-version}}
- name: Build
run: make -C server
- name: Copy server binary to NFS server
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
source: "server/cmd/cm-honeybee/cm-honeybee"
target: "/tmp/"
strip_components: 3
overwrite: true
- name: Restart server from NFS server with new binary
uses: appleboy/[email protected]
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
script: |
systemctl stop cm-honeybee
mv -f /tmp/cm-honeybee /usr/bin/cm-honeybee
systemctl start cm-honeybee