drone / drone-runtime

[DEPRECATED] migrated to https://github.com/drone-runners
Other
62 stars 43 forks source link

feature: implement depends_on #22

Closed bradrydzewski closed 5 years ago

bradrydzewski commented 6 years ago

the depends_on keyword should enable execution of pipelines as a DAG. The runtime currently ignores depends_on, and executes pipeline steps sequentially.

bradrydzewski commented 5 years ago

Version 0.8 had a group field that allows you to group parallel tasks. The goal with 1.0 was to replace this with a depends_on field that allows you to create a graph execution, which is going to be slightly more powerful.

kind: pipeline
name: foo

steps:
- name: foo
  image: golang
  commands:
  - go build
  - go test

- name: bar
  image: node
  commands:
  - npm install
  - npm test

- name: baz
  image: plugins/slack
  settings:
    webhook:
      from_secret: webhook
  depends_on:
  - foo
  - bar

If none of the steps in the pipeline define the depends_on field, the runtime should execute each step sequentially. I created an isSerial helper function for this, however, it is not currently being used.

The yaml already supports depends_on and passes this information to the runtime, so luckily we only need to update the runtime to support this feature. The next step would be to update the runner to properly determine and execute the next set of tasks. I started writing some code here however it is not particularly efficient.

The above logic needs to be implemented here.

As a side note, we need to ensure that we handle cyclical references to prevent an infinite loop.

bradrydzewski commented 5 years ago

closed by https://github.com/drone/drone-runtime/commit/a0aa03692fb3d6552311e5ebc79c1bfbab536ab4 🎉