projen / projen

Rapidly build modern applications with advanced configuration management
https://projen.io
Apache License 2.0
2.53k stars 362 forks source link

Support multiple workflow engines: Gitlab #2438

Open mattiamatrix opened 1 year ago

mattiamatrix commented 1 year ago

Hello everyone,

looking at projen vision document, one of the Ideas consist of supporting multiple workflow engines. Gitlab, what about it? Is it in the interest of the project to support GitLab with the same level of support given to GitHub?

I am mainly asking this because my personal adoption of projen has been impacted by the lack of full support for GitLab workflows.

I am aware of Manual release (#1938 ?), and I am sure there are many possible ways to work on GitLab.

However, as a beginner user of projen I would like to have my GitLab workflow autogenerated by the framework.

What do you think? Please correct me if I am completely wrong!

Cheer

mrgrain commented 1 year ago

We should do this. I reckon the tricky bit will be finding an abstraction for workflows that can be applied to multiple providers.

agdimech commented 1 year ago

I’ve been thinking of this and am actually in the position that we should allow these types of features to be decorated onto a simple kernel project, building the outer layers additively as component add ons.

new Project({name: “foo”}).with(new Github({defaultBranch: “main”}).with(new Typescript()).with(new CDKApp(…));

In this approach - users opt in to various features by stringing them together - allowing more tightly scoped required props and more ways to mix and match.

If a user always wanted to apply EsLint and GitHub they can simply configure them once into some type of middleware/decorator and just apply it to all their projects at creation time. For example:

const decorator = (project: Project) => project.with(
  new Github({defaultBranch: “main”}),
  new Eslint({ignorePatterns: [“bar”]})
);

new Project({name: “foo}).with(decorator);
new Project({name: “bar”}).with(decorator);

if other users wanted Gitlab, then they can configure that accordingly. And if there are certain combinations that make sense in lots of cases then we can just create default composition that people can use as is, but they always have the option of mixing and matching like lego if need be. This does assume that each component is contained and independent of one another as to not conflate concerns.

mrgrain commented 1 year ago

I really like the decorator API. Some initial thoughts: