You can use a configuration extension to override the process of fetching the configuration file (e.g. .drone.yml). This can be used to return default or global configurations for projects where none exists, or even generate configurations on-the-fly. For other use cases you should consider using a conversion extension.
Configuration
You can register a configuration extension by providing the following configuration parameters to the Drone server:
-
DRONE_YAML_ENDPOINT
- Provides the endpoint used to make http requests to an extension.
-
DRONE_YAML_SECRET
- Provides the token used to authenticate http requests to the extension. This token is shared between the server and extension.
How it Works
The server makes an HTTP post to the configuration extension to fetch the configuration file. If the configuration extension returns a 204 status code the system will fallback to the configuration file in the repository.
Request
The configuration extension receives an HTTP request to return a configuration file. The request body includes the Repository and Build details in JSON format.
Request Body definition:
|
|
Repository definition:
|
|
Build definition:
|
|
Response
The configuration extension should respond to the request with a 200 response code and the raw configuration file. If the configuration extension returns a 204 status code the system will fallback to the configuration file in the repository.
Response definition:
|
|
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 a configuration extension we recommend using our starter project as a base to jumpstart development.