-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional at Launch #38
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,38 +1,44 @@ | ||||||||||
# `gcr.io/paketo-buildpacks/google-stackdriver` | ||||||||||
The Paketo Google Stackdriver Buildpack is a Cloud Native Buildpack that contributes Stackdriver agents and configures them to connect to the service. | ||||||||||
# `paketo-buildpacks/google-cloud` | ||||||||||
The Paketo Google Cloud Buildpack is a Cloud Native Buildpack that contributes Google Cloud agents and configures them to connect to their services. | ||||||||||
|
||||||||||
## Behavior | ||||||||||
This buildpack will participate if any of the following conditions are met | ||||||||||
|
||||||||||
* A binding exists with `type` of `StackdriverDebugger` | ||||||||||
* A binding exists with `type` of `StackdriverProfiler` | ||||||||||
* If `$BP_GOOGLE_CLOUD_DEBUGGER_ENABLED` is set to `true` and the application is Java | ||||||||||
* At build time, contributes an agent to a layer | ||||||||||
* At launch time, if credentials are available, configures the application to use the agent | ||||||||||
* If `$BP_GOOGLE_CLOUD_DEBUGGER_ENABLED` is set to `true` and the application is NodeJS | ||||||||||
* At build time, contributes an agent to a layer | ||||||||||
* At launch time, if credentials are available, configures `$NODE_MODULES` with the agent path. If the main module does not already require `@google-cloud/debug-agent`, prepends the main module with `require('@google-cloud/debug-agent').start({...});`. | ||||||||||
|
||||||||||
The buildpack will do the following for Java applications: | ||||||||||
* If `$BP_GOOGLE_CLOUD_PROFILER_ENABLED` is set to `true` and the application is Java | ||||||||||
* At build time, contributes an agent to a layer | ||||||||||
* At launch time, if credentials are available, configures the application to use the agent | ||||||||||
* If `$BP_GOOGLE_CLOUD_PROFILER_ENABLED` is set to `true` and the application is NodeJS | ||||||||||
* At build time, contributes an agent to a layer | ||||||||||
* At launch time, if credentials are available, configures `$NODE_MODULES` with the agent path. If the main module does not already require `@google-cloud/profiler`, prepends the main module with `require('@google-cloud/profiler').start({...});`. | ||||||||||
|
||||||||||
* If `StackdriverDebugger` binding exists contributes a Java debugger agent to a layer and configures `$JAVA_TOOL_OPTIONS` to use it | ||||||||||
* If `StackdriverProfiler` binding exists contributes a Java profiler agent to a layer and configures `$JAVA_TOOL_OPTIONS` to use it | ||||||||||
* Sets `$GOOGLE_APPLICATION_CREDENTIALS` to the path of the `ApplicationCredentials` secret | ||||||||||
### Credential Availability | ||||||||||
If the applications runs within Google Cloud and the [Google Metadata Service][m] is accessible, those credentials will be used. If the application runs within any other environment, credentials must be provided with a service binding as described below. | ||||||||||
|
||||||||||
The buildpack will do the following for NodeJS applications: | ||||||||||
|
||||||||||
* If `StackdriverDebugger` binding exists | ||||||||||
* Contributes a NodeJS debugger agent to a layer and configures `$NODE_MODULES` to use it | ||||||||||
* If main module does not already require `@google-cloud/debug-agent` module, prepends the main module with `require('@google-cloud/debug-agent').start();` | ||||||||||
* If `StackdriverProfiler` binding exists | ||||||||||
* Contributes a NodeJS profiler agent to a layer and configures `$NODE_MODULES` to use it | ||||||||||
* If main module does not already require `@google-cloud/profiler` module, prepends the main module with `require('@google-cloud/profiler').start();` | ||||||||||
* Sets `$GOOGLE_APPLICATION_CREDENTIALS` to the path of the `ApplicationCredentials` secret | ||||||||||
[m]: https://cloud.google.com/compute/docs/storing-retrieving-metadata | ||||||||||
|
||||||||||
## Configuration | ||||||||||
| Environment Variable | Description | ||||||||||
| -------------------- | ----------- | ||||||||||
| `$BPL_GOOGLE_STACKDRIVER_MODULE` | Configure the name of the application. Defaults to `default-module`. | ||||||||||
| `$BPL_GOOGLE_STACKDRIVER_VERSION` | Configure the project id for the application. Defaults to `<EMPTY>`. | ||||||||||
| `$BPL_GOOGLE_STACKDRIVER_VERSION` | Configure the version of the application. Defaults to `<EMPTY>`. | ||||||||||
| `$BP_GOOGLE_CLOUD_DEBUGGER_ENABLED` | Whether to add Google Cloud Debugger during build | ||||||||||
| `$BP_GOOGLE_CLOUD_PROFILER_ENABLED` | Whether to add Google Cloud Profiler during build | ||||||||||
| `$BPL_GOOGLE_CLOUD_MODULE` | Configure the name of the application (required) | ||||||||||
| `$BPL_GOOGLE_CLOUD_PROJECT_ID` | Configure the project id for the application (required if running outside of Google Cloud) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know I made the opposite comment earlier but you mentioned that the project ID is now included in the service account key and therefore is not actually required in all situations. If we wanted to be clever (maybe too clever) we could pull the project ID out of the key |
||||||||||
| `$BPL_GOOGLE_CLOUD_VERSION` | Configure the version of the application (required) | ||||||||||
|
||||||||||
## Bindings | ||||||||||
The buildpack optionally accepts the following bindings: | ||||||||||
|
||||||||||
### Type: `GoogleCloud` | ||||||||||
|Key | Value | Description | ||||||||||
|-------------------------|------------------|------------ | ||||||||||
|`ApplicationCredentials` | `<JSON Payload>` | Google Cloud Application Credentials in JSON form | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think using the more specific terminology and a link will help folks understand the workflow more quickly. |
||||||||||
|
||||||||||
### Type: `dependency-mapping` | ||||||||||
|Key | Value | Description | ||||||||||
|----------------------|---------|------------ | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we make
BPL_GOOGLE_CLOUD_MODULE
andBPL_GOOGLE_CLOUD_VERSION
required?