You can use environment extensions to provide your pipeline steps with custom environment variables. In addition, this extension can be used to inject default secrets or default plugin parameters into your pipelines (secrets and plugin parameters are passed to your pipeline as environment variables).
Configuration
You can register an extension with your runners by providing the following configuration parameters:
-
DRONE_ENV_PLUGIN_ENDPOINT
- Provides the endpoint used to make http requests to the extension.
-
DRONE_ENV_PLUGIN_TOKEN
- Provides the token used to authenticate http requests to the extension. This token is shared between the server and extension.
How it Works
The runner makes an HTTP POST request to retrieve a map of environment variables which are injected into each pipeline step.
Request
The environment extension receives an HTTP request to return a map of environment variables. The JSON-encoded request body includes the repository and build information.
Request Body definition:
|
|
|
|
|
|
Response
The environment extension should respond to the request with a 200 response code and a list of environment variables in JSON format.
Example response:
|
|
Authorization
The http request is signed per the http signatures draft specification use the shared secret. The receiver should use the signature to verify the authenticity and integrity of the webhook.
Starter Project
If you are interested in creating an environment extension we recommend using our starter project as a base to jumpstart development.