Hi,
I’m working on a TypeScript monorepo using Drone for CICD. There’s a main branch, and whenever a PR is accepted onto main, the built artifacts shall be published to some private package registry. It seems to me it’s a classical need, and also the publish step should not be run concurrently. First, am I wrong?
I’ve tested two .drone.yml so far, and neither satisfy me:
- with two pipelines in the file, the former builds and tests with no condition, and the latter builds and publishes only on trigger push on the main branch, with concurrency: limit: 1, and a dependency on the former. The problem is that the whole thing takes quite some time because both pipelines have to install dependencies (they are cached, but still) and to transpile TS to JS (which right now are not cached because there is a dist directory in every package directory, so they would need to be extracted and restored in place).
- with one pipeline where some steps (e.g. publish) have a condition for push event + main branch. The problem is the publish step has to be concurrency-limited, so right now the only way is to limit the whole pipeline. For a PR, there’s one job for the push event (testing the branch) and one for the pull_request event (testing a potential merge), and so they run sequentially, which is unfortunate.
The process could be improved in two ways:
- Obviously, putting a concurrency limit on steps would be the best thing to do.
- Or, having one pipeline which runs only on push on main, and an other on the opposite, i.e. pull_request OR (push AND main branch). This latter expression is not possible right now. I propose to add a new node OR so to make such constructs possible. It could look like:
trigger:
or:
- event:
- pull_request
- branch:
- main
event:
- push
What do you think?
Thanks.