matrix-org / matrix-org/matrix-hookshot
Add Support for GitLab Pipeline
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 450
- Forks
- 95
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 23
Description
It looks like you are not supporting the 'pipeline' trigger for Gitlab in your events [https://github.com/matrix-org/matrix-hookshot/blob/main/src/Gitlab/WebhookTypes.ts](url) this would be super helpful for me, I am adding a sample code of what to add to fix it.
WebhookTypes add:
```
export interface IGitLabWebhookPipelineEvent {
object_kind: "pipeline";
object_atributes:
id: int //for referencing the pipeline
ref: string
source: string
status: string
detailed_status: string // Idk if this is helpful but might be for saying what went wrong
user_id: number;
user_name: string;
user_email: string;
project: IGitlabProject;
repository: IGitlabRepository;
commits: { // you could leave but I would say remove it
id: string,
message: string,
title: string,
timestamp: string,
url: string,
author: {
"name": string,
"email": string
},
added: string[],
modified: string[],
removed: string[],
},
builds: [
{
stage: string
name: string
duration: float?? // not sure here
}
]
}
```
Idk how you you want to handle the pipelines for the GitLabRepo but I would either ignore all status other than 'failure' and 'success' as its easier to just post the results that posting for all the 4 statuses you might see i.e. running, pending, failed, and success. On failure you should use the builds field to state where and why it failed, you can see more about the gitlab pipeline api here [https://docs.gitlab.com/ee/api/pipelines.html](url). not sure how you handle the actual post message to hookshot but this seems like the harder part.
It would be cool it you could also add the support for when and why the pipeline was triggered and use matrix threads to refer back to the message for when the pipeline started.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Gitlab/WebhookTypes.ts and compare the proposed pipeline event with GitLab's pipeline API documentation. Then trace how existing GitLab events are posted to Matrix, including status and failure details. Done means pipeline triggers are accepted and their intended statuses and messages are handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100