Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,22 @@ jobs:
run: go mod download -C src

- name: Build
run: go build -C src -o ../bin/cattery_linux_x86_${{ env.VERSION }} -ldflags="-X cattery/lib/version.Version=${{ env.VERSION }}"
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
run: |
go build -C src \
-trimpath \
-ldflags="-s -w -X cattery/lib/version.Version=${{ env.VERSION }}" \
-o ../bin/cattery_linux_x86_${{ env.VERSION }}

- name: Verify binary is statically linked
run: |
file bin/cattery_linux_x86_${{ env.VERSION }}
# ldd prints "not a dynamic executable" on fully-static binaries;
# exit 0 either way and just surface the result.
ldd bin/cattery_linux_x86_${{ env.VERSION }} || true

- run: ls -la bin/

Expand Down
10 changes: 8 additions & 2 deletions src/lib/scaleSetClient/scaleSetClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ func NewScaleSetClient(org *config.GitHubOrganization, trayType *config.TrayType
InstallationID: org.InstallationId,
PrivateKey: string(privateKey),
},
}, scaleset.WithLogger(newSlogLogger(logger)))
},
scaleset.WithLogger(newSlogLogger(logger)),
scaleset.WithRetryableHTTPClint(newRetryableClient(logger)),
)
if err != nil {
return nil, fmt.Errorf("failed to create scale set client: %w", err)
}
Expand Down Expand Up @@ -88,7 +91,10 @@ func (sc *ScaleSetClient) CreateSession(ctx context.Context) error {
const retryDelay = 30 * time.Second

for attempt := range maxRetries {
session, err := sc.client.MessageSessionClient(ctx, sc.scaleSet.ID, hostname, scaleset.WithLogger(newSlogLogger(sc.logger)))
session, err := sc.client.MessageSessionClient(ctx, sc.scaleSet.ID, hostname,
scaleset.WithLogger(newSlogLogger(sc.logger)),
scaleset.WithRetryableHTTPClint(newRetryableClient(sc.logger)),
)
if err == nil {
sc.session = session
sc.logger.Info("Message session created")
Expand Down
20 changes: 20 additions & 0 deletions src/lib/scaleSetClient/slog_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,29 @@ import (
"context"
"log/slog"

"github.com/hashicorp/go-retryablehttp"
log "github.com/sirupsen/logrus"
)

// newRetryableClient builds a retryablehttp.Client whose Logger is our slog
// bridge so that retry/debug HTTP lines flow through logrus instead of the
// stdlib stderr default.
//
// Why this exists: actions/scaleset@v0.3.0/common_client.go:123 only sets the
// retry client's Logger if it is nil — but retryablehttp.NewClient() always
// populates Logger with a default `log.New(os.Stderr, "", log.LstdFlags)`.
// Result: scaleset.WithLogger(...) is silently dropped for the inner retry
// client, and you see lines like `2026/05/09 23:04:30 [DEBUG] GET ...`
// bypassing logrus formatting.
//
// Pre-setting Logger here makes scaleset's nil guard a no-op and our bridge
// stays in place. *slog.Logger satisfies retryablehttp.LeveledLogger.
func newRetryableClient(entry *log.Entry) *retryablehttp.Client {
rc := retryablehttp.NewClient()
rc.Logger = newSlogLogger(entry)
return rc
}

// logrusHandler bridges slog into logrus so that third-party libraries using
// slog (e.g. actions/scaleset / go-retryablehttp) respect cattery's log level
// and emit records in the same format as the rest of the application.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/trays/providers/nomadProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func buildBootstrapPayload(userScript, runnerFolder string) []byte {
var sb strings.Builder
sb.WriteString("#!/bin/bash\n")
sb.WriteString("set -euo pipefail\n\n")
sb.WriteString(`curl -fsSL "$CATTERY_URL/agent/binary" -o /usr/local/bin/cattery` + "\n")
sb.WriteString(`curl -fsSL "$CATTERY_URL/agent/download" -o /usr/local/bin/cattery` + "\n")
sb.WriteString("chmod +x /usr/local/bin/cattery\n\n")
if userScript != "" {
sb.WriteString(userScript)
Expand Down
Loading
Loading