Skip to content

Conversation

@filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Jan 16, 2025

Description

For the purposes of insights, org owners might want to answer the question: "what portion of the commits committed to repository A were commited through Gitpod?".

This PR adds an organization setting, which org owners can toggle to annotate Gitpod-based commits with the following:

Tool: gitpod/$GITPOD_HOST
image

This is done by registering a prepare-commit-msg hook inside /etc/git/hooks. Because this is all done in user space, repositories or user could opt out by simply removing this /etc/git/hooks/prepare-commit-msg file via Gitpod tasks or dotfiles, respectively.

The organization setting this relies on is hidden behind a commit_annotation_setting_enabled feature flag, now enabled just in preview envs.

Related Issue(s)

Fixes CLC-1040

How to test

Documentation

Yes, docs are pending.

See issue CLC-1074

Preview status

You can try for yourself at https://ft-org-git4ab8821b53.preview.gitpod-dev.com/workspaces.

Copy link
Contributor

@mustard-mh mustard-mh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked nicely in preview env with no hooks setup in repository. Btw, It seems not work very well if I install something like husky, should we consider it as a special case (which to ignore with?) or we need more discussion and bring compatibility with them?

VSCode + CLI IntelliJ
image image

/>
</ConfigurationSettingsField>

{isCommitAnnotationEnabled && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, how we indicate what kind of settings should be on General and Policies? (I was trying to find this setting on Policies tab before look through the code)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mustard-mh I generally go with my gut here. This time around, I didn't consider this feature a policy, since it's not restricting anything per se, like our other policies we have on that page.

It could definitely be argued that "it's asserting that all of an organization's commits have our Tool: trailer", though, so maybe? What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion there, just curious 😋 Any place is good for me (Once the docs to the user is clear, and for sure you will do it)

@roboquat roboquat added size/XL and removed size/L labels Jan 21, 2025
@filiptronicek filiptronicek self-assigned this Jan 24, 2025
@filiptronicek filiptronicek marked this pull request as ready for review January 24, 2025 09:53
Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, tested and works! 🎉

@roboquat roboquat merged commit c24b8f4 into main Jan 24, 2025
18 checks passed
@roboquat roboquat deleted the ft/org-gitpod-commit-attribution branch January 24, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants