•  
     
    story #17183 close artifacts from commit messages
Summary
Empty
close artifacts from commit messages
Empty

Disclaimer, this is meant to mimic what GitLab already does with Jira.

The goal is to be able to automatically change an artifact to Done when a commit with a message containing "Closes TULEAP-1234" is merged into the main GitLab branch.

There are 3 keywords that are supported:

  • Resolves TULEAP-1234
  • Closes TULEAP-1234
  • Fixes TULEAP-1234

Commit made in GitLab

The artifact is closes when the commit message match the defined format and the commit is made in the GitLab defined main branch (might not be master).

When the provided ID (1234 in TULEAP-1234 for instance) matches an artifact in the same project than the integrated repository:

  • if the tracker have a Done semantic, the corresponding value is used.
    • As Done semantic is provided by Agile Dashboard, we should first investigate if it's possible to transfer to Tracker. If not possible to transfer, the Done part will not be implemented
  • if there is no Done semantic, the first value of Closed semantic is used.
  • otherwise, no attempt to transition is made but a comment is added to follow-up "User XXX attempt to close this artifact from GitLab but neither Done or Closed semantic defined".

If the target value exists and the workflow authorize the transition, the artifact is updated to the "Closed" value with a follow-up comment made by Workflow_Aritfact_Useron the behalf of the user:

  • Resolves => solved by @user with gitlab_commit #....
  • Closes => closed by @user with gitlab_commit #....
  • Fixes => <tracker_shortname> fixed by @user with gitlab_commit #....

Matching for @user is made with email address if there is only one address that corresponds in Tuleap database. If more than one user match or if no user matches at all, the "author" name is used.

(the message is in English, regardless of the lang used by the commit author)

Edge cases

  • If target artifact is already closed, no update is done (neither artifact change nor comment) but something is logged for admin troubleshooting.

Security implication

As always cross boundaries features that involve permissions are tricky to get right. Esp. with git that allows arbitrary email and user name. Closing an artifact is a very sensitive action hence it should not be open wild.

At the integration level (repository), there is a checkbox (disabled by default) [] allows commit on GitLab to close Tuleap artifacts in this project.

  • By default, existing integrations will have the feature disabled (but they can edit the integration to activate)
  • It's limited to artifacts within the associated project.
  • but it applies to all artifacts of the project.
Empty
Empty
Status
Empty
Done
Development
  • [ ] Does it involves User Interface? 
  • [ ] Are there any mockups?
  • [ ] Are permissions checked?
  • [ ] Does it need Javascript development?
  • [ ] Does it need a forge upgrade bucket?
  • [ ] Does it need to execute things in system events?
  • [ ] Does it impact project creation (templates)?
  • [ ] Is it exploratory?
Empty
Details
#17183
Manuel Vacelet (vaceletm)
2021-05-27 17:17
2020-10-07 13:15
3760

References
Referencing story #17183

Git commit

tuleap/tuleap/stable

Fix bug where both GitLab and Gerrit logos are displayed d6880f066d
Introduce the 'Resolve' close artifact keyword 1892ff157b
Closes artifact with 'resolve' keyword 38076422b5
Add artifact closure action enabled in database c690b9f0da
Allow artifact closure at GitLab repository integration 9d534c18d7
Deal with closes artifact closure keyword 59948f2ab6
Deal with fixes artifact closure keyword 0b6f020e0b
Each GitLab integration is unique 03ea1a0104
Rename GitLabRepository into GitLabRepositoryIntegration 3c5f6ed557
Gitlab access token cannot be edited anymore. 0655c79056
Rename GitLabRepositoryFactory into GitLabRepositoryIntegrationFactory 1d94ff820f
Rename GitlabBotApi* classes to IntegrationApi* c33230c24b
Add the possibility to enable/disable the artfiact closure via REST bc8f00129e
Move REST patch gitlab_repositories/ endpoint to gitlab_repositories/:id 19fd0f720d
Allow user to update the artifact closure value 8c1bff5012

Follow-ups

User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • I want to
    -trigger artifact changes based on pull requests status 
    +close artifacts from commit messages 
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes