Skip to content

Commit e45cbf5

Browse files
authored
Fix build script and exit handling (#44)
1 parent 3bf4116 commit e45cbf5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

cmd/nebius-observability-agent-updater/main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import (
1818
)
1919

2020
func main() {
21+
os.Exit(run())
22+
}
23+
24+
func run() int {
25+
exitCode := 0
2126
configPath := flag.String("config", "", "path to config file")
2227
flag.Parse()
2328
var cfg *config.Config
@@ -37,8 +42,7 @@ func main() {
3742
cli, err := client.New(metadataReader, oh, dh, cfg, logger, metadataReader.GetIamToken)
3843
if err != nil {
3944
logger.Error("failed to create client", "error", err)
40-
defer syscall.Exit(1)
41-
return
45+
return 1
4246
}
4347
agentsList := []agents.AgentData{agents.NewO11yagent()}
4448
app := application.New(cfg, cli, logger, agentsList, oh)
@@ -54,7 +58,6 @@ func main() {
5458
errChan <- app.Run(ctx)
5559
}()
5660

57-
exitCode := 0
5861
select {
5962
case err := <-errChan:
6063
if err != nil {
@@ -74,5 +77,5 @@ func main() {
7477
logger.Info("App shut down gracefully")
7578
}
7679
}
77-
defer os.Exit(exitCode)
80+
return exitCode
7881
}

debian/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: nebius-observability-agent-updater
22
Name: Nebius Observability Agent Updater
33
Description: Service to update the Nebius Observability Agent
4-
Author:: Nebius <support@nebius.ai>
4+
Author: Nebius <support@nebius.ai>
55
Maintainer: Nebius <support@nebius.ai>

scripts/build_deb.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -euo pipefail
23
set -x
34
DEB_BUILD_DIR=/tmp/nebius-observability-agent-updater
45

0 commit comments

Comments
 (0)