Run pipelines for affected microservices using starlark

Hi there!
I have a monorepo that use Bazel as its build tool.
To detect impacted microservices since the previous build’s commit I need to use bazel, and then filter my pipelines based on affected microservices. I found the conversion extension that does that based on changes on files and provided change list in each pipeline, I need something like this, but using bazel without providing change list, I think I have two options:

  • Implement an extension line the drone-convert-pathschanged but using bazel(In that extension we need to clone the repo to detect changes by bazel).
  • Use a Startlark script with this behviour:
    • If the provided build params contains affected microservices list, so it just returns affected microservices pipelines.
    • otherwise, returns a simple pipeline that detects affected microservices since the previous build’s commit and in the last step restart, the build(or request a new build) with custom params contains affected microservices. e.g., run the following command in the last step of pipeline,
         drone build restart octocat/hello-world 42 \
         --param=microservices=microservice_a,microservice_b \

I like the starlark option because we don’t need to implement a new extension(unfortunately we do not have much time), in addition to that we can see how we are detecting affected microservices more obviously.

What do you think @bradrydzewski?