Skip to content

Commit 763a75a

Browse files
committed
add gitlab_work_items
1 parent 38f91f3 commit 763a75a

File tree

8 files changed

+143
-3
lines changed

8 files changed

+143
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"object_kind":"pipeline","object_attributes":{"id":31,"iid":3,"name":"Pipeline for branch: master","ref":"master","tag":false,"sha":"bcbb5ec396a2c0f828686f14fac9b80b780504f2","before_sha":"bcbb5ec396a2c0f828686f14fac9b80b780504f2","source":"merge_request_event","status":"success","stages":["build","test","deploy"],"created_at":"2016-08-12 15:23:28 UTC","finished_at":"2016-08-12 15:26:29 UTC","duration":63,"variables":[{"key":"NESTOR_PROD_ENVIRONMENT","value":"us-west-1"}],"url":"http://example.com/gitlab-org/gitlab-test/-/pipelines/31"},"merge_request":{"id":1,"iid":1,"title":"Test","source_branch":"test","source_project_id":1,"target_branch":"master","target_project_id":1,"state":"opened","merge_status":"can_be_merged","detailed_merge_status":"mergeable","url":"http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1"},"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"project":{"id":1,"name":"Gitlab Test","description":"Atque in sunt eos similique dolores voluptatem.","web_url":"http://192.168.64.1:3005/gitlab-org/gitlab-test","avatar_url":null,"git_ssh_url":"[email protected]:gitlab-org/gitlab-test.git","git_http_url":"http://192.168.64.1:3005/gitlab-org/gitlab-test.git","namespace":"Gitlab Org","visibility_level":20,"path_with_namespace":"gitlab-org/gitlab-test","default_branch":"master"},"commit":{"id":"bcbb5ec396a2c0f828686f14fac9b80b780504f2","message":"test\n","timestamp":"2016-08-12T17:23:21+02:00","url":"http://example.com/gitlab-org/gitlab-test/commit/bcbb5ec396a2c0f828686f14fac9b80b780504f2","author":{"name":"User","email":"[email protected]"}},"source_pipeline":{"project":{"id":41,"web_url":"https://gitlab.example.com/gitlab-org/upstream-project","path_with_namespace":"gitlab-org/upstream-project"},"pipeline_id":30,"job_id":3401},"builds":[{"id":380,"stage":"deploy","name":"production","status":"skipped","created_at":"2016-08-12 15:23:28 UTC","started_at":null,"finished_at":null,"duration":null,"queued_duration":null,"failure_reason":null,"when":"manual","manual":true,"allow_failure":false,"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"runner":null,"artifacts_file":{"filename":null,"size":null},"environment":{"name":"production","action":"start","deployment_tier":"production"}},{"id":377,"stage":"test","name":"test-image","status":"success","created_at":"2016-08-12 15:23:28 UTC","started_at":"2016-08-12 15:26:12 UTC","finished_at":"2016-08-12 15:26:29 UTC","duration":17.0,"queued_duration":196.0,"failure_reason":null,"when":"on_success","manual":false,"allow_failure":false,"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"runner":{"id":380987,"description":"shared-runners-manager-6.gitlab.com","active":true,"runner_type":"instance_type","is_shared":true,"tags":["linux","docker","shared-runner"]},"artifacts_file":{"filename":null,"size":null},"environment":null},{"id":378,"stage":"test","name":"test-build","status":"failed","created_at":"2016-08-12 15:23:28 UTC","started_at":"2016-08-12 15:26:12 UTC","finished_at":"2016-08-12 15:26:29 UTC","duration":17.0,"queued_duration":196.0,"failure_reason":"script_failure","when":"on_success","manual":false,"allow_failure":false,"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"runner":{"id":380987,"description":"shared-runners-manager-6.gitlab.com","active":true,"runner_type":"instance_type","is_shared":true,"tags":["linux","docker"]},"artifacts_file":{"filename":null,"size":null},"environment":null},{"id":376,"stage":"build","name":"build-image","status":"success","created_at":"2016-08-12 15:23:28 UTC","started_at":"2016-08-12 15:24:56 UTC","finished_at":"2016-08-12 15:25:26 UTC","duration":17.0,"queued_duration":196.0,"failure_reason":null,"when":"on_success","manual":false,"allow_failure":false,"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"runner":{"id":380987,"description":"shared-runners-manager-6.gitlab.com","active":true,"runner_type":"instance_type","is_shared":true,"tags":["linux","docker"]},"artifacts_file":{"filename":null,"size":null},"environment":null},{"id":379,"stage":"deploy","name":"staging","status":"created","created_at":"2016-08-12 15:23:28 UTC","started_at":null,"finished_at":null,"duration":null,"queued_duration":null,"failure_reason":null,"when":"on_success","manual":false,"allow_failure":false,"user":{"id":1,"name":"Administrator","username":"root","avatar_url":"http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80&d=identicon","email":"[email protected]"},"runner":null,"artifacts_file":{"filename":null,"size":null},"environment":{"name":"staging","action":"start","deployment_tier":"staging"}}]}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#emoji-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`event_type` String `json:$.event_type`,
10+
`user_id` UInt32 `json:$.user.id`,
11+
`user` JSON `json:$.user`,
12+
`project_id` UInt32 `json:$.project.id`,
13+
`project` JSON `json:$.project`,
14+
`object_attributes` JSON `json:$.object_attributes`,
15+
`note` JSON `json:$.note` DEFAULT '{}',
16+
`issue` JSON `json:$.issue` DEFAULT '{}'
17+
18+
ENGINE "MergeTree"
19+
ENGINE_SORTING_KEY "project_id, user_id"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#job-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`ref` String `json:$.ref`,
10+
`tag` Boolean `json:$.tag` DEFAULT 'false',
11+
`before_sha` String `json:$.before_sha` DEFAULT '',
12+
`sha` String `json:$.sha` DEFAULT '',
13+
`build_id` String `json:$.build_id` DEFAULT '',
14+
`build_name` String `json:$.build_name` DEFAULT '',
15+
`build_stage` String `json:$.build_stage` DEFAULT '',
16+
`build_status` String `json:$.build_status` DEFAULT '',
17+
`build_created_at` DateTime `json:$.build_created_at` DEFAULT now(),
18+
`build_started_at` DateTime `json:$.build_started_at` DEFAULT now(),
19+
`build_finished_at` DateTime `json:$.build_finished_at` DEFAULT now(),
20+
`build_duration` Float32 `json:$.build_duration` DEFAULT 0,
21+
`build_queued_duration` Float32 `json:$.build_queued_duration` DEFAULT 0,
22+
`build_allow_failure` Boolean `json:$.build_allow_failure` DEFAULT false,
23+
`build_failure_reason` String `json:$.build_failure_reason` DEFAULT '',
24+
`retries_count` Int32 `json:$.retries_count` DEFAULT 0,
25+
`pipeline_id` UInt32 `json:$.pipeline_id` DEFAULT 0,
26+
`project_id` UInt32 `json:$.project_id`,
27+
`project_name` String `json:$.project_name`,
28+
`user_id` UInt32 `json:$.user.id`,
29+
`user` JSON `json:$.user`,
30+
`commit` JSON `json:$.commit` DEFAULT '{}',
31+
`repository_name` String `json:$.repository.name`,
32+
`repository` JSON `json:$.repository` DEFAULT '{}',
33+
`project` JSON `json:$.project` DEFAULT '{}',
34+
`runner` JSON `json:$.runner` DEFAULT '{}',
35+
`environment` JSON `json:$.environment` DEFAULT '{}',
36+
`source_pipeline` JSON `json:$.source_pipeline` DEFAULT '{}'
37+
38+
39+
ENGINE "MergeTree"
40+
ENGINE_SORTING_KEY "project_id, repository_name, pipeline_id"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#work-item-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`event_type` String `json:$.event_type`,
10+
`user_id` UInt32 `json:$.user.id`,
11+
`user` JSON `json:$.user`,
12+
`project_id` UInt32 `json:$.project.id`,
13+
`project` JSON `json:$.project`,
14+
`object_attributes` JSON `json:$.object_attributes`,
15+
`repository_name` String `json:$.repository.name`,
16+
`repository` JSON `json:$.repository`,
17+
`assignees` Array(JSON) `json:$.assignees[:]` DEFAULT '[]',
18+
`assignee` JSON `json:$.assignee` DEFAULT '{}',
19+
`labels` Array(JSON) `json:$.labels[:]` DEFAULT '[]',
20+
`changes` JSON `json:$.changes` DEFAULT '{}',
21+
`reviewers` Array(JSON) `json:$.reviewers[:]` DEFAULT '[]'
22+
23+
24+
ENGINE "MergeTree"
25+
ENGINE_SORTING_KEY "project_id, repository_name, user_id"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#pipeline-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`object_attributes` JSON `json:$.object_attributes`,
10+
`merge_request` JSON `json:$.merge_request` DEFAULT '{}',
11+
`user_id` UInt32 `json:$.user.id`,
12+
`user` JSON `json:$.user`,
13+
`project_id` UInt32 `json:$.project.id`,
14+
`project` JSON `json:$.project`,
15+
`commit` JSON `json:$.commit` DEFAULT '{}',
16+
`pipeline_id` UInt32 `json:$.source_pipeline.pipeline_id`,
17+
`source_pipeline` JSON `json:$.source_pipeline` DEFAULT '{}',
18+
`builds` Array(JSON) `json:$.builds[:]` DEFAULT '[]'
19+
20+
ENGINE "MergeTree"
21+
ENGINE_SORTING_KEY "project_id, pipeline_id, user_id"

tinybird/datasources/gitlab_push.datasource

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ SCHEMA >
1212
`ref` String `json:$.ref`,
1313
`ref_protected` Boolean `json:$.ref_protected`,
1414
`checkout_sha` String `json:$.checkout_sha`,
15-
`user_id` String `json:$.user_id`,
15+
`user_id` UInt32 `json:$.user_id`,
1616
`user_name` String `json:$.user_name`,
1717
`user_username` String `json:$.user_username`,
1818
`user_email` String `json:$.user_email`,
1919
`user_avatar` String `json:$.user_avatar`,
20-
`project_id` String `json:$.project_id`,
20+
`project_id` UInt32 `json:$.project_id`,
2121
`project` JSON `json:$.project` DEFAULT '{}',
2222
`repository_name` String `json:$.repository.name`,
2323
`repository` JSON `json:$.repository` DEFAULT '{}',
24-
`commits` Array(JSON) `json:$.commits` DEFAULT '[]',
24+
`commits` Array(JSON) `json:$.commits[:]` DEFAULT '[]',
2525
`total_commits_count` Int64 `json:$.total_commits_count`
2626

2727
ENGINE "MergeTree"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#vulnerability-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`object_attributes` JSON `json:$.object_attributes`
10+
11+
ENGINE "MergeTree"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
TOKEN "append" APPEND
2+
3+
# Refer to https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#work-item-events
4+
5+
TAGS "gitlab"
6+
7+
SCHEMA >
8+
`object_kind` String `json:$.object_kind`,
9+
`event_type` String `json:$.event_type`,
10+
`user_id` UInt32 `json:$.user.id`,
11+
`user` JSON `json:$.user`,
12+
`project_id` UInt32 `json:$.project.id`,
13+
`project` JSON `json:$.project`,
14+
`object_attributes` JSON `json:$.object_attributes`,
15+
`repository_name` String `json:$.repository.name`,
16+
`repository` JSON `json:$.repository`,
17+
`assignees` Array(JSON) `json:$.assignees[:]` DEFAULT '[]',
18+
`assignee` JSON `json:$.assignee` DEFAULT '{}',
19+
`labels` Array(JSON) `json:$.labels[:]` DEFAULT '[]',
20+
`changes` JSON `json:$.changes` DEFAULT '{}'
21+
22+
ENGINE "MergeTree"
23+
ENGINE_SORTING_KEY "project_id, repository_name, user_id"

0 commit comments

Comments
 (0)