Skip to content

Commit

Permalink
support integration with python family buildpacks
Browse files Browse the repository at this point in the history
This change will help apps build with python-family paketo buildpacks
to use the dynatrace buildpack.

The new buildplan integrates with cpython's "provides cpython" contract.
(https://github.com/paketo-buildpacks/cpython/blob/v1.10.0/detect.go#L70-L73)
  • Loading branch information
arjun024 committed Oct 27, 2023
1 parent d52caa5 commit d9a17f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The binding must include the following required Secret values to successfully co
the API URL and API token secret keys support multiple casing options for ease of integration.
This buildpack will choose to use `api-url` over `apiurl` and `api-token` over `apitoken` if both are set.

The buildpack will do the following for .NET, Go, Apache HTTPd, Java, Nginx, NodeJS, and PHP applications:
The buildpack will do the following for .NET, Go, Apache HTTPD, Java, Nginx, NodeJS, PHP and Python applications:

* Contributes a OneAgent including the appropriate libraries to a layer and configures `$LD_PRELOAD` to use it
* Sets `$DT_TENANT`, `$DT_TENANTTOKEN`, and `$DT_CONNECTION_POINT` at launch time.
Expand Down
2 changes: 1 addition & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ api = "0.7"
description = "A Cloud Native Buildpack that contributes the Dynatrace OneAgent and configures it to connect to the service"
homepage = "https://github.com/paketo-buildpacks/dynatrace"
id = "paketo-buildpacks/dynatrace"
keywords = ["dynatrace", "agent", "one-agent", "apm", "java", "node.js", "go", "apache-httpd", "nginx", "php", "dotnet"]
keywords = ["dynatrace", "agent", "one-agent", "apm", "java", "node.js", "go", "apache-httpd", "nginx", "php", "dotnet", "python"]
name = "Paketo Buildpack for Dynatrace"
sbom-formats = ["application/vnd.syft+json", "application/vnd.cyclonedx+json"]
version = "{{.version}}"
Expand Down
2 changes: 1 addition & 1 deletion dt/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {

uri := fmt.Sprintf("%s/v1/deployment/installer/agent/unix/paas/latest?bitness=64&skipMetadata=true", BaseURI(s))

for _, t := range []string{"apache", "dotnet", "go", "java", "nginx", "nodejs", "php"} {
for _, t := range []string{"apache", "dotnet", "go", "java", "nginx", "nodejs", "php", "python"} {

This comment has been minimized.

Copy link
@dilu24x7

dilu24x7 May 10, 2024

python is not a supported parameter for include as documented here:
https://docs.dynatrace.com/docs/dynatrace-api/environment-api/deployment/oneagent/download-oneagent-version?secureweb=Teams
Hence the agent download will fail giving 404

if _, ok, err := pr.Resolve(fmt.Sprintf("dynatrace-%s", t)); err != nil {
return libcnb.BuildResult{}, fmt.Errorf("unable to resolve dynatrace-%s plan entry\n%w", t, err)
} else if ok {
Expand Down
9 changes: 9 additions & 0 deletions dt/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error
{Name: "php"},
},
},
{
Provides: []libcnb.BuildPlanProvide{
{Name: "dynatrace-python"},
},
Requires: []libcnb.BuildPlanRequire{
{Name: "dynatrace-python"},
{Name: "cpython"},
},
},
},
}, nil
}
9 changes: 9 additions & 0 deletions dt/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ var expectedResult = libcnb.DetectResult{
{Name: "php"},
},
},
{
Provides: []libcnb.BuildPlanProvide{
{Name: "dynatrace-python"},
},
Requires: []libcnb.BuildPlanRequire{
{Name: "dynatrace-python"},
{Name: "cpython"},
},
},
},
}

Expand Down

0 comments on commit d9a17f1

Please sign in to comment.