diff --git a/docs/framework-google_stackdriver_profiler.md b/docs/framework-google_stackdriver_profiler.md index e10b98ca8..a6490a2c2 100644 --- a/docs/framework-google_stackdriver_profiler.md +++ b/docs/framework-google_stackdriver_profiler.md @@ -16,6 +16,9 @@ The Google Stackdriver Profiler Framework causes an application to be automatica Tags are printed to standard output by the buildpack detect script +## Version +The agent version is the version of the Google release, `vX.Y.Z` of [GoogleCloudPlatform/cloud-profiler-java](https://github.com/GoogleCloudPlatform/cloud-profiler-java/releases), and the manifest points at the asset `profiler_java_agent.tar.gz` of that release. The default version pin `0.x` resolves to it. + ## User-Provided Service (Optional) Users may optionally provide their own Google Stackdriver Profiler service. A user-provided Google Stackdriver Profiler service must have a name or tag with `google-stackdriver-profiler` in it so that the Google Stackdriver Profiler Agent Framework will automatically configure the application to work with the service. diff --git a/manifest.yml b/manifest.yml index 1bc7f6b6f..c60ee925e 100644 --- a/manifest.yml +++ b/manifest.yml @@ -338,8 +338,8 @@ dependencies: source: https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/1.14.0/elastic-otel-javaagent-1.14.0.jar source_sha256: '' - name: google-stackdriver-profiler - version: 0.4.0 - uri: https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz + version: 0.5.0 + uri: https://github.com/GoogleCloudPlatform/cloud-profiler-java/releases/download/v0.5.0/profiler_java_agent.tar.gz sha256: bd44383322b51b4ddd45233306d318a4f89afa69d5461c412f06ccbb6e11f835 cf_stacks: - cflinuxfs4 diff --git a/src/java/frameworks/manifest_uris_test.go b/src/java/frameworks/manifest_uris_test.go new file mode 100644 index 000000000..5d7ba5418 --- /dev/null +++ b/src/java/frameworks/manifest_uris_test.go @@ -0,0 +1,42 @@ +package frameworks_test + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "go.yaml.in/yaml/v3" +) + +// A dependency URI must point to one fixed artifact. A floating URI such as +// .../latest/... changes content without changing the URI, so the pinned sha256 +// breaks whenever the vendor republishes, and the packager keeps reusing a stale +// download that is cached under the URI. +func TestManifestDependencyURIsAreNotFloating(t *testing.T) { + data, err := os.ReadFile(filepath.Join("..", "..", "..", "manifest.yml")) + if err != nil { + t.Fatalf("read manifest.yml: %v", err) + } + + var manifest struct { + Dependencies []struct { + Name string `yaml:"name"` + Version string `yaml:"version"` + URI string `yaml:"uri"` + } `yaml:"dependencies"` + } + if err := yaml.Unmarshal(data, &manifest); err != nil { + t.Fatalf("parse manifest.yml: %v", err) + } + if len(manifest.Dependencies) == 0 { + t.Fatal("no dependencies found in manifest.yml") + } + + for _, dependency := range manifest.Dependencies { + if strings.Contains(dependency.URI, "/latest/") { + t.Errorf("%s %s has a floating uri, use the versioned artifact instead: %s", + dependency.Name, dependency.Version, dependency.URI) + } + } +}