ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

Improve Ballerina Standard Library Daily Build #384

Open shafreenAnfar opened 4 years ago

shafreenAnfar commented 4 years ago

Background

At the moment each standard library module has it is own repository and the health of the each module is tested by running daily builds against the master. This daily build get triggered on a preconfigured cron expression.

Further, since there are standard libraries which depends on other standard libraries, each module must be built in certain order. Therefore, in order to decide When to build What, we have come up with a level system. Each module belongs to certain level starting from 0 to N.

Problem

Even though this allows us to check the status of the each module, this has some drawbacks such as,

The short term solution

As the short term, it was decided to move from cron based daily builds to pub-sub style of builds. Idea is quite simple,

  1. Each standard library module allows interested parties to get notified every time a build is completed on master.
  2. Each module that depends on a certain module, need to subscribe to this build event.

What this means in terms of github actions is each module needs to have a final step which triggers a build on interested parties. Each interested party needs to have configured repository_dispatch event in their daily build workflow.

Note: Since all the modules depends the ballerina-lang, all the modules are required to subscribe for build events on ballerina-lang

Issues with the short term solution

Even though this solves the aforementioned problems, it does have it is own problems such as,

The long term solution

Centralized build pipeline is needed to solve this problem properly. Something similar to the release pipeline. Following is the high level idea,

Note: This centralized build pipeline can be made smarter and smarter. For instance, it can be improved to automatically update the dependency entry of each modules by walking each repo.

This solution is complex compared to the the short term solution but has no drawbacks.

shafreenAnfar commented 4 years ago

@ThisaruGuruge @Maninda @BuddhiWathsala @niveathika do let me know if I have missed anything.

ThisaruGuruge commented 4 years ago

Note: Since all the modules depends the ballerina-lang, all the modules are required to subscribe for build events on ballerina-lang

We don't need to subscribe all the modules to the ballerina-lang, but the level 0 and the level 1 modules. Then the subsequent builds will trigger automatically right? Or am I missing something here?

shafreenAnfar commented 4 years ago

Yeah, you are right. Just wanted to keep it simple at the expense of redundant builds due to two reasons.

1) Each module owner do not need to worry about the level their module belongs to. 2) Centralize the responsibility to each module owner. In case their module didn't get triggered, it is simply because (s)he didn't subscribe to it. Other module owners has nothing to do with it.

The long term solution can address all these things in a better way.

ThisaruGuruge commented 4 years ago

With the PR ballerina-platform/ballerina-lang#26083 we are now at the following state:

niveathika commented 3 years ago

@shafreenAnfar Shall we close this, as it no longer valid?