Drone

Drone file cannot be added to

If you want to extend the drone file to include another custom ‘kind’, you can’t quite yet.

For some reason drone doesn’t introspect the ‘kind’ when it parses the file. It will ingest every type of ‘kind’ and assume that is a drone pipeline, and show it in the pipeline runtime.

For instance if you had a drone file:

---
kind: pipeline 
name: default 
steps:
  - name: boston 
    image: boston/docker-stuff
---
kind: authorizer 
name: my-auther
spec:
  - name: this-is-used-by-a-plugin-or-extension

Do we need to add custom parsing or am I doing this wrong? Trying to build an extension that acts like an authorizer but I don’t want to deviate from the drone file.

The current version of Drone only supports kind: pipeline with custom type. For example we are going to launch two new runners, one with {kind: pipeline, type: exec} and one with {kind: pipeine, type: ssh}. Support for additional kind attributes is planned for a future release. Some of this is discussed in this thread.

It is important to note that Drone is implementing a custom extension framework (via drone/runner-go) which means documents added to the yaml will be parsed and evaluated by the extension subsystem and need to be valid.

Hi @bradrydzewski, just to clarify the issue here. We have 1 yml file that contains multiple documents - most do not affect drone (they are for our own use). However, drone ends up creating at least 1 other “broken” pipeline when it parses this file.

The expected behaviour was that we could put our pipeline definition in the same file with definitions for other applications.

What actually happens is that drone creates a new pipeline for each defintion and anything without a “kind: pipeline” is a “broken” pipeline that never runs.

43%20AM

In this screenshot there are 2 pipelines. The top one is “broken” ie: never starts. Our yaml file is similar to the one posted by @ktruckenmiller.

We have 1 yml file that contains multiple documents - most do not affect drone (they are for our own use). However, drone ends up creating at least 1 other “broken” pipeline when it parses this file.

unfortunately this will cause problems with future releases because kind and type will be used to create custom steps that will be visible in the user interface.

We don’t have to put the pipeline in the same file - but we’d like to! So good to know that this is an issue. We can definitely work around it.

One more question:

Why does drone parse, and interpret, a document in yml that does not have a “kind” of “pipeline” at all? My opinion is that Drone should ignore anything that is not a pipeline directive. Would it be worth opening an issue on Github for this feature? It seems counter intuitive that Drone tries to coerce any document in YAML to a pipeline even if it does not contain a pipeline definition. Especially considering that YAML allows for multiple documents in a single file.

Why does drone parse, and interpret, a document in yml that does not have a “kind” of “pipeline” at all

we have been planning support for custom kind attributes, and over the past few months, have been building an sdk [1] for people that want to create custom kind and custom type operators. We recently pushed (but have not officially announced) our first custom operators that use custom types [2][3]. We have not yet added support for custom kinds, but we will in the near future. For this reason Drone will process all kind values.

[1] https://github.com/drone/runner-go
[2] https://github.com/drone-runners/drone-runner-exec
[3] https://github.com/drone-runners/drone-runner-ssh

Awesome! This is great to see. I appreciate your quick responses. I feel like I have more questions related to this but I will wait to see how the new runners work first.

Thanks again