Notify Worksection tasks about related GitLab events (e.g commits)
628
Worksection is a simple, lightweight task tracking system that provides:
Check it out.
Use commit-msg file to force your developers to have worksection task id during commits. Just copy this file to your git repo as
cp commit-msg <your-git-repo>/.git/hook/commit-msg # on Git server directly (server-side commit)
Since this moment all commit messages should have the following format #WS-0000: The commit message, where 0000 is worksection task id.
Run it and all endpoints details will be available here: http://localhost:8080/docs
> python g2w
...
INFO: Started server process [86248]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
Please note, that GitLab commit messages must have the following format: #WS-0000: The commit message, where 0000 is worksection task id.
version: "3.9"
services:
g2ws:
image: dgroup/g2w:0.1.0
container_name: g2w
environment:
# Mandatory environment variables (docker, podman, etc.)
WS_URL_ALL_USERS: "https://xxx.worksection.com/xxxx" # https://worksection.com/faq/api-user.html#q1572
WS_URL_POST_COMMENT: "https://xxx.worksection.com/xxxx" # https://worksection.com/faq/api-comments.html#q1575
WS_EMAIL: "[email protected]" # plain worksection user email
WS_ADMIN_USER_ID: "370080" # plain worksection user id
build:
dockerfile: Containerfile
context: .
ports:
- "8080:8080"
restart: always
Push events in Gitlab:
project > Settings > Webhook223728 is your worksection project idPush events option is selectedAdd webhook]project > Settings > Integrations > Custom issue trackerProject URL like https://xxx.worksection.com/project/223728/, where 223728 is your worksection project idIssue URL like https://xxx.worksection.com/project/223728/:idNew issue URL like https://xxx.worksection.com/project/223728/new/Save changes]#WS-0000: The commit message format (0000 is worksection task id) to your Gitlab project.223728 - worksection project id (read more):
curl --request POST \
--url http://127.0.0.1:8080/gitlab/push/223728 \
--header 'Content-Type: application/json' \
--data '{
"object_kind": "push",
"event_name": "push",
"before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
"after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"ref": "refs/heads/master",
"checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"user_id": 4,
"user_name": "John Smith",
"user_username": "jsmith",
"user_email": "[email protected]",
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
"project_id": 15,
"project":{
"id": 15,
"name":"Diaspora",
"description":"",
"web_url":"http://example.com/mike/diaspora",
"avatar_url":null,
"git_ssh_url":"[email protected]:mike/diaspora.git",
"git_http_url":"https://example.com/mike/diaspora.git",
"namespace":"Mike",
"visibility_level":0,
"path_with_namespace":"mike/diaspora",
"default_branch":"master",
"homepage":"http://example.com/mike/diaspora",
"url":"[email protected]:mike/diaspora.git",
"ssh_url":"[email protected]:mike/diaspora.git",
"http_url":"https://example.com/mike/diaspora.git"
},
"repository":{
"name": "Diaspora",
"url": "[email protected]:mike/diaspora.git",
"description": "",
"homepage": "http://example.com/mike/diaspora",
"git_http_url":"https://example.com/mike/diaspora.git",
"git_ssh_url":"[email protected]:mike/diaspora.git",
"visibility_level":0
},
"commits": [
{
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"message": "Update Catalan translation to e38cb41.\n\nSee https://gitlab.com/gitlab-org/gitlab for more information",
"title": "Update Catalan translation to e38cb41.",
"timestamp": "2011-12-12T14:27:31+02:00",
"url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"author": {
"name": "Jordi Mallach",
"email": "[email protected]"
},
"added": ["CHANGELOG"],
"modified": ["app/controller/application.rb"],
"removed": []
},
{
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"message": "fixed readme",
"title": "fixed readme",
"timestamp": "2012-01-03T23:36:29+02:00",
"url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"author": {
"name": "GitLab dev user",
"email": "gitlabdev@dv6700.(none)"
},
"added": ["CHANGELOG"],
"modified": ["app/controller/application.rb"],
"removed": []
}
],
"total_commits_count": 4
}'
Content type
Image
Digest
Size
366.1 MB
Last updated
almost 4 years ago
docker pull dgroup/g2w