diff --git a/go.mod b/go.mod index 2a9087511..d25334225 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Dynatrace/libbuildpack-dynatrace v1.8.0 github.com/Masterminds/semver v1.5.0 github.com/cloudfoundry/libbuildpack v0.0.0-20251203175254-7be530ec9fef - github.com/cloudfoundry/switchblade v0.9.1 + github.com/cloudfoundry/switchblade v0.9.2 github.com/golang/mock v1.6.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.36.2 diff --git a/go.sum b/go.sum index 3a7ce2225..cac3eed54 100644 --- a/go.sum +++ b/go.sum @@ -478,8 +478,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudfoundry/libbuildpack v0.0.0-20251203175254-7be530ec9fef h1:lrggsL5p4dr3bBK/x1xIu3sn/6PGYV71GQIe/mCNfFw= github.com/cloudfoundry/libbuildpack v0.0.0-20251203175254-7be530ec9fef/go.mod h1:kn4FHMwI8bTd9gT92wPGjXHzUvGcj8CkPxG8q3AGBAQ= -github.com/cloudfoundry/switchblade v0.9.1 h1:WHEUhSnkoqCJOkqJ1WD3XcmKztpYmagdIWT+GJf6Gfc= -github.com/cloudfoundry/switchblade v0.9.1/go.mod h1:hIEQdGAsuNnzlyQfsD5OIORt38weSBar6Wq5/JX6Omo= +github.com/cloudfoundry/switchblade v0.9.2 h1:b2lwxrAblg9uKncNQRKZ09/teuKdZIixcENKgrLQPjo= +github.com/cloudfoundry/switchblade v0.9.2/go.mod h1:hIEQdGAsuNnzlyQfsD5OIORt38weSBar6Wq5/JX6Omo= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= diff --git a/src/nodejs/integration/override_test.go b/src/nodejs/integration/override_test.go index d11500f6f..0ec0c76cf 100644 --- a/src/nodejs/integration/override_test.go +++ b/src/nodejs/integration/override_test.go @@ -23,6 +23,7 @@ func testOverride(platform switchblade.Platform, fixtures string) func(*testing. var err error name, err = switchblade.RandomName() Expect(err).NotTo(HaveOccurred()) + println(name) }) it.After(func() { diff --git a/vendor/github.com/cloudfoundry/switchblade/internal/cloudfoundry/stage.go b/vendor/github.com/cloudfoundry/switchblade/internal/cloudfoundry/stage.go index 912572fb9..cee76d1d9 100644 --- a/vendor/github.com/cloudfoundry/switchblade/internal/cloudfoundry/stage.go +++ b/vendor/github.com/cloudfoundry/switchblade/internal/cloudfoundry/stage.go @@ -35,6 +35,21 @@ func (s Stage) Run(logs io.Writer, home, name string) (string, error) { Env: env, }) if err != nil { + // In CF API v3, staging failure logs are not automatically captured in stdout/stderr + // We need to fetch them explicitly using 'cf logs --recent' + recentLogs := bytes.NewBuffer(nil) + logErr := s.cli.Execute(pexec.Execution{ + Args: []string{"logs", name, "--recent"}, + Stdout: recentLogs, + Stderr: recentLogs, + Env: env, + }) + if logErr == nil && recentLogs.Len() > 0 { + // Append recent logs to the main logs buffer + _, _ = logs.Write([]byte("\n--- Recent Logs (cf logs --recent) ---\n")) + _, _ = logs.Write(recentLogs.Bytes()) + } + return "", fmt.Errorf("failed to start: %w\n\nOutput:\n%s", err, logs) } diff --git a/vendor/github.com/cloudfoundry/switchblade/random_name.go b/vendor/github.com/cloudfoundry/switchblade/random_name.go index b094449be..285f5cbff 100644 --- a/vendor/github.com/cloudfoundry/switchblade/random_name.go +++ b/vendor/github.com/cloudfoundry/switchblade/random_name.go @@ -13,5 +13,9 @@ func RandomName() (string, error) { return "", err } + // Replace underscores with hyphens to make the name DNS-safe + // Cloud Foundry uses app names in DNS URLs where underscores are not allowed + id = strings.ReplaceAll(id, "_", "-") + return strings.ToLower(fmt.Sprintf("switchblade-%s", id)), nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 6126d2cb8..80adb9fc8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -30,7 +30,7 @@ github.com/cloudfoundry/libbuildpack/cutlass github.com/cloudfoundry/libbuildpack/cutlass/docker github.com/cloudfoundry/libbuildpack/cutlass/glow github.com/cloudfoundry/libbuildpack/packager -# github.com/cloudfoundry/switchblade v0.9.1 +# github.com/cloudfoundry/switchblade v0.9.2 ## explicit; go 1.23.0 github.com/cloudfoundry/switchblade github.com/cloudfoundry/switchblade/internal/cloudfoundry