akuity / kargo

Application lifecycle orchestration
https://kargo.akuity.io/
Apache License 2.0
1.79k stars 146 forks source link

feat: add ability to configure custom pull request title/commit message/etc... #2047

Open akolacz opened 6 months ago

akolacz commented 6 months ago

Checklist

Proposed Feature

I would like to configure the pull request title and commit message to respect the git conventional commit, and also have the possibility to set a custom pull request title.

What we currently have :

updated env/eph-test/app/values.yaml to use image europe-docker.pkg.dev/xxxxxxxx/registry-docker-europe/app:c07b9312deee51eb305abce7cbd52d02c6f50e20 #44

What we want :

chore(deps): update image with <new_version> for project: <project> on stage: <stage>

Motivation

Respect git conventional commit and have a cleaner pull request name.

Suggested Implementation

Maybe inside the pull request field into stages ressources we can add a field to specify the message for the stage, or maybe a global configuration for git conventional commit for whole Kargo.

We can help to code the feature if needed, just let us know how you think this should be implemented.

krancour commented 6 months ago

Hi @akolacz. My first thought it that the level of customization you want seems to hint that some sort of expression language for defining the message format would be useful. Of course, defining one's own expression language is frequently a fool's errand...

What would you think about allowing the commit messages and/or PR titles to be defined using a string that is just a short Go text template and if it's defined, we make some well known things like .Project and .Stage available to it. (.Freight would be good, too, but that's probably an object containing structured data.)

wdyt?

akolacz commented 6 months ago

Yes I agree with that, I think it's a good proposal. How can I help you on this ?

krancour commented 6 months ago

Let's try to agree on some rough requirements.

I'm going back and forth on whether this is best considered a system-level setting (e.g. configured globally when installing the Kargo chart) or whether it's something best managed at the Project or Stage level...

Probably the answer is that many orgs are going to have an org-wide PR/commit title format they want to use and equally likely that there are going to be cases where it needs to be set (or overridden) at a lower level to address the requirements of a specific team or application.

So let's approach this in phases maybe...

Why don't we start with allowing PR title to be configured at the system level in the chart, since this looks the easiest. This format string would have to carry through to an environment variable that becomes the value of a new field in the Promotions reconciler's config object.

You'd have to propagate this information down to a function called reconcilePullRequest and use it to set the title differently than it's set now. Currently it is set to the title of the last commit.

akolacz commented 6 months ago

I agree, we can implement this at the system level to have an org-wide PR/commit title format.

I will have a look next week, I'll come back to you as soon as I have something.

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because it had no activity for 90 days. It will be closed if no activity occurs in the next 30 days but can be reopened if it becomes relevant again.

Historyman commented 1 week ago

This would be very helpful to our use case as well, the helm-update-image message is pretty good but in our situation the file edited is deep in a folder structure and it would be nice to make it simpler