open-telemetry / opentelemetry-sqlcommenter

SQLCommenter components for various languages
Apache License 2.0
27 stars 12 forks source link

CI Branching #27

Open Thiyagu55 opened 2 years ago

Thiyagu55 commented 2 years ago
weyert commented 2 years ago

I can see this working :)

sjs994 commented 2 years ago

To give some context: This is a monorepo with multiple languages. So a normal release would:

  1. put java, nodejs, python and ruby code in the same artifact tarball.
  2. we can't independently release a particular language library.

What we were thinking with this PR is

  1. to have separate branches for different languages.
  2. When changes are done to a particular language path, on merge, we will copy the changes to particular branch e.g. changes to sqlcommenter-python/** on merging would trigger a workflow to copy the content into python-sqlcommenter branch.
  3. Then we can release different language libraries from their respective branches, which will trigger workflows to publish libraries to respective repositories.

@aabmass @lonewolf3739 Do you guys see any concerns with this approach ?

srikanthccv commented 2 years ago

I don't see any immediate concerns with this approach. Since there is one workflow for each lang would it be possible to do this in main branch itself?

sjs994 commented 2 years ago

I don't see any immediate concerns with this approach. Since there is one workflow for each lang would it be possible to do this in main branch itself?

yes, we can do it from main branch but it has its pros and cons.

  1. We can have multiple workflows depending on different paths. Now, if we release from main branch, then the workflows would be triggered at the same time. So on a single release, we will have 4 deployments to pypi, npm, sonatype(java) and marginalia(ruby). Also the assets generated would contain all language libraries.
  2. As the previous ways do not allow us to release a single language library. So, we can use tags during release and have conditions set to release particular language library using tags. For Ex: if tag like 'java-sqlcommenter-%' use java-workflow.yml. With this, we can release particular language library, but still our release assets will contains the whole code as we don't have control on what to add to assets.

Now, this approach of creating release from branches would mitigate the assets part, where python release would only contain python sources and so for other languages. But there is one problem with this approach, that is the release branch by default allow git push directly. Anyone can push changes to that. If we lock it, github actions can't force push the changes automatically and would require robot account to make those branches secure. Exploring if there are other ways like using a DEPLOY_TOKEN