Fixup notification logging to stdout and notifications fixes.
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Colin 2024-06-13 12:23:02 -04:00
parent eb7a1dec82
commit beb963d322
9 changed files with 10 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

10
main.go
View File

@ -36,6 +36,8 @@ var (
monitoredContainers = make(map[string]*MonitoredContainer)
mu sync.Mutex
httpClient *http.Client
goGlitchPath string
oculusFilterPath string
)
func init() {
@ -49,6 +51,9 @@ func init() {
log.Fatal("GLITCHTIP_DSN environment variable is not set")
}
goGlitchPath = "/usr/local/bin/go-glitch"
oculusFilterPath = "/usr/local/bin/oculus_filter"
httpClient = &http.Client{
Timeout: 30 * time.Second,
}
@ -281,7 +286,7 @@ func filterDiffOutput(diffOutput, cname string, ignores []string) (string, error
// Construct the filter command
args := append([]string{filename}, ignores...)
cmd := exec.Command("/usr/local/bin/oculus_filter", args...)
cmd := exec.Command(oculusFilterPath, args...)
fullCommand := fmt.Sprintf("oculus_filter %s", strings.Join(cmd.Args, " "))
log.Printf("Running command: %s", fullCommand)
fmt.Printf("Running command: %s\n", fullCommand) // Print the command to stdout for debugging
@ -338,13 +343,14 @@ func copyFile(src, dst string) error {
}
func sendNotification(content string) error {
cmd := exec.Command("go-glitch")
cmd := exec.Command(goGlitchPath)
cmd.Stdin = strings.NewReader(content)
output, err := cmd.CombinedOutput()
if err != nil {
log.Printf("go-glitch output: %s", output)
return err
}
log.Printf("go-glitch output: %s", output)
return nil
}

View File

@ -15,6 +15,8 @@ services:
- API_ADDRESS=http://oculus_api-ingress:8080
volumes:
- logs:/logs
tmpfs:
- /tmp
networks:
- ingress
labels: