diff --git a/docs/framework-google_stackdriver_profiler.md b/docs/framework-google_stackdriver_profiler.md index e10b98ca8..8c0b6b117 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). 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/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) + } + } +}