bitsbeats / drone-tree-config

Drone helper for mono repositories.
Apache License 2.0
103 stars 24 forks source link

Always fallback #45

Closed Ben10k closed 11 months ago

Ben10k commented 1 year ago

This PR adds ability for the plugin to always read through all available pipeline definition.

This feature is useful when a there needs to be pipeline dependencies between pipelines that are described in different pipeline definition yaml files.

For example repo structure:

 repository/
 ├── .drone,yml
 ├── foo
 │   ├── some_code.py
 │   └── .drone.yml
 ├── bar
 │   ├── some_other_code.py
 │   └── .drone.yml

root level .drone,yml defines a pipeline to build a golden image that should be reused by services foo and bar. Pipeline for service foo has a declared dependency on a pipeline that builds the golden image.

When developer creates a PR by modifying the file repository/foo/some_code.py, this plugin only reads the repository/foo/.drone.yml. And then the pipeline fails with the error:

linter: invalid or unknown pipeline dependency

After enabling this feature PLUGIN_ALWAYS_FALLBACK - the plugin would also read repository/drone,yml (if PLUGIN_CONCAT is also enabled) and provide both of the pipelines to Drone.

Ben10k commented 1 year ago

Hi @foosinn! Sorry to bother you, but could I get a review? If there is anything wrong/missing, I will be happy to rework the PR. Thank you!

foosinn commented 1 year ago

Hey Ben, i'll to have a look at it, but i'm currently out of office until the end of the month.

Sorry for the delay

Ben10k commented 1 year ago

Hello @foosinn! Did you have a chance to look into this?

Ben10k commented 11 months ago

Hi @foosinn Can you take a look into this PR?

foosinn commented 11 months ago

Hey @Ben10k, sorry this got totally lost.

The naming still confuses me. ALLWAYS_FALLBACK would suggest to me that all pipelines in the repository will run. If understood your request correctly: you want to run all .drone.yml from the matching path upwards. Is that correct?

Ben10k commented 11 months ago

No problem, not a lot of changes happens on this repository.

ALLWAYS_FALLBACK would suggest to me that all pipelines in the repository will run.

Yes, that is exactly what we want. The idea is to take all .drone.yml files in the repository and always (regardless of what was changed on the repo) stitch them together.

If understood your request correctly: you want to run all .drone.yml from the matching path upwards. Is that correct?

Not exactly, we do not want to run all .drone.yml from the matching path upwards, we want to run all .drone.yml in the repo.

foosinn commented 11 months ago

Would you be okay with renaming it into ALWAYS_RUN_ALL?. I think think that would make it a lot clearer.

Otherwise the pr looks good :)

Ben10k commented 11 months ago

Yeah, ALWAYS_RUN_ALL seems more clear. On it

Ben10k commented 11 months ago

@foosinn PR updated with ALWAYS_RUN_ALL

Ben10k commented 11 months ago

@foosinn Thank you for merging the PR! Would it be possible to create a new release or build a new docker image containing the changes?

foosinn commented 11 months ago

has been released