@@ -47,23 +47,30 @@ function call() {
47
47
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -s -X POST -d "${PAYLOAD}" -H 'Accept: application/json' -H "Authorization: Bearer ${BEARER_TOKEN}" "${CALLBACK_URL}" || echo "failed to call home: exit code ($?)"
48
48
}
49
49
50
+ function systemInfo() {
51
+ if [ -f "/etc/os-release" ];then
52
+ . /etc/os-release
53
+ fi
54
+ OS_NAME=${NAME:-""}
55
+ OS_VERSION=${VERSION_ID:-""}
56
+ AGENT_ID=${1:-null}
57
+ # strip status from the callback url
58
+ [[ $CALLBACK_URL =~ ^(.*)/status(/)?$ ]] && CALLBACK_URL="${BASH_REMATCH[1]}" || true
59
+ SYSINFO_URL="${CALLBACK_URL}/system-info/"
60
+ PAYLOAD="{\"os_name\": \"$OS_NAME\", \"os_version\": \"$OS_VERSION\", \"agent_id\": $AGENT_ID}"
61
+ curl --retry 5 --retry-delay 5 --retry-connrefused --fail -s -X POST -d "${PAYLOAD}" -H 'Accept: application/json' -H "Authorization: Bearer ${BEARER_TOKEN}" "${SYSINFO_URL}" || true
62
+ }
63
+
50
64
function sendStatus() {
51
65
MSG="$1"
52
66
call "{\"status\": \"installing\", \"message\": \"$MSG\"}"
53
67
}
54
68
55
- {{- if .UseJITConfig }}
56
69
function success() {
57
70
MSG="$1"
58
- call "{\"status\": \"idle\", \"message\": \"$MSG\"}"
59
- }
60
- {{- else}}
61
- function success() {
62
- MSG="$1"
63
- ID=$2
71
+ ID=${2:-null}
64
72
call "{\"status\": \"idle\", \"message\": \"$MSG\", \"agent_id\": $ID}"
65
73
}
66
- {{- end}}
67
74
68
75
function fail() {
69
76
MSG="$1"
@@ -199,9 +206,9 @@ if [ -e "/sys/fs/selinux" ];then
199
206
sudo chcon -R -h {{ .RunnerUsername }}:object_r:bin_t /home/runner/* || fail "failed to change selinux context"
200
207
fi
201
208
209
+ AGENT_ID=""
202
210
{{- if .UseJITConfig }}
203
211
sudo systemctl start $SVC_NAME || fail "failed to start service"
204
- success "runner successfully installed"
205
212
{{- else}}
206
213
sendStatus "starting service"
207
214
sudo ./svc.sh start || fail "failed to start service"
@@ -212,8 +219,9 @@ if [ $? -ne 0 ];then
212
219
fail "failed to get agent ID"
213
220
fi
214
221
set -e
215
- success "runner successfully installed" $AGENT_ID
216
222
{{- end}}
223
+ systemInfo $AGENT_ID
224
+ success "runner successfully installed" $AGENT_ID
217
225
`
218
226
219
227
var WindowsSetupScriptTemplate = `#ps1_sysnative
0 commit comments