Skip to content

Commit 4315e53

Browse files
authored
feat(customize): expand CSV import functionality for issues-related tables (#804)
- Add support for importing data into `issue_repo_commits`, `sprints`, `issue_worklogs`, and `issue_changelogs` tables - Enhance `issues` table import to include `sprint_ids` field and automatic account record creation - Update documentation to reflect new import capabilities and provide sample CSV formats
1 parent 5c9a93a commit 4315e53

File tree

1 file changed

+90
-7
lines changed

1 file changed

+90
-7
lines changed

docs/Plugins/customize.md

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: >
1111
This plugin provides users the ability to:
1212
- Add/delete columns in domain layer tables
1313
- Insert values to certain columns with data extracted from some raw layer tables
14-
- Import data from CSV files(only `issues`, `issue_commits`, `qa_apis`, `qa_test_cases` and `qa_test_case_executions` tables are supported)
14+
- Import data from CSV files(only `issues`, `issue_commits`, `issue_repo_commits`, `sprints`, `issue_worklogs`, `issue_changelogs`, `qa_apis`, `qa_test_cases` and `qa_test_case_executions` tables are supported)
1515

1616
**NOTE:** The names of columns added via this plugin must start with the prefix `x_`
1717

@@ -175,20 +175,25 @@ Drop the column `x_text` of the table `issues`
175175

176176
> POST /plugins/customize/csvfiles/issues.csv
177177
178-
The HTTP `Content-Type` must be `multipart/form-data`, and the form should have three fields:
178+
The HTTP `Content-Type` must be `multipart/form-data`, and the form should have four fields:
179179

180-
- `file`: The CSV file
180+
- `file`: The CSV file to upload
181181
- `boardId`: It will be written to the `id` field of the `boards` table, the `board_id` field of `board_issues`, and the `_raw_data_params` field of `issues`
182182
- `boardName`: It will be written to the `name` field of the `boards` table
183+
- `incremental`: Whether to import incrementally (default: false)
184+
185+
Upload a CSV file and import it to the `issues` table via this API. There should be no extra fields in the file except the `labels` and `sprint_ids` fields, and if the field value is `NULL`, it should be `NULL` in the CSV instead of the empty string.
183186

184-
Upload a CSV file and import it to the `issues` table via this API. There should be no extra fields in the file except the `labels` field, and if the field value is `NULL`, it should be `NULL` in the CSV instead of the empty string.
187+
**Note:**
188+
- The `sprint_ids` field should contain comma-separated sprint IDs (e.g. "sprint1,sprint2")
189+
- These values will be automatically written to the `sprint_issues` table during import
185190
DevLake will parse the CSV file and store it in the `issues` table, where the `labels` are stored in the `issue_labels` table.
186191
If the `boardId` does not appear, a new record will be created in the boards table. The `board_issues` table will be updated at the same time as the import.
187192
The following is an issues.CSV file sample:
188193

189-
|id |_raw_data_params |url |icon_url|issue_key|title |description |epic_key|type |status|original_status|story_point|resolution_date|created_date |updated_date |parent_issue_id|priority|original_estimate_minutes|time_spent_minutes|time_remaining_minutes|creator_id |creator_name|assignee_id |assignee_name|severity|component|lead_time_minutes|original_project|original_type|x_int |x_time |x_varchar|x_float|labels |
190-
|-----------------------------|---------------------|--------------------------------------------------------------------|--------|---------|-------------|---------------------------------|--------|-----|------|---------------|-----------|---------------|-----------------------------|-----------------------------|---------------|--------|-------------------------|------------------|----------------------|-----------------------------------------------------|------------|-----------------------------------------------------|-------------|--------|---------|-----------------|----------------|-------------|--------------|-------------------|---------|-------|--------------------|
191-
|bitbucket:BitbucketIssue:1:1 |board789 |https://api.bitbucket.org/2.0/repositories/thenicetgp/lake/issues/1 | |1 |issue test |bitbucket issues test for devlake| |issue|TODO |new |0 |NULL |2022-07-17 07:15:55.959+00:00|2022-07-17 09:11:42.656+00:00| |major |0 |0 |0 |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp | | |NULL |NULL |NULL |10 |2022-09-15 15:27:56|world |8 |NULL |
194+
|id |_raw_data_params |url |icon_url|issue_key|title |description |epic_key|type |status|original_status|story_point|resolution_date|created_date |updated_date |parent_issue_id|priority|original_estimate_minutes|time_spent_minutes|time_remaining_minutes|creator_id |creator_name|assignee_id |assignee_name|severity|component|lead_time_minutes|original_project|original_type|x_int |x_time |x_varchar|x_float|labels |sprint_ids |
195+
|-----------------------------|---------------------|--------------------------------------------------------------------|--------|---------|-------------|---------------------------------|--------|-----|------|---------------|-----------|---------------|-----------------------------|-----------------------------|---------------|--------|-------------------------|------------------|----------------------|-----------------------------------------------------|------------|-----------------------------------------------------|-------------|--------|---------|-----------------|----------------|-------------|--------------|-------------------|---------|-------|--------------------|-----------------|
196+
|bitbucket:BitbucketIssue:1:1 |board789 |https://api.bitbucket.org/2.0/repositories/thenicetgp/lake/issues/1 | |1 |issue test |bitbucket issues test for devlake| |issue|TODO |new |0 |NULL |2022-07-17 07:15:55.959+00:00|2022-07-17 09:11:42.656+00:00| |major |0 |0 |0 |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp | | |NULL |NULL |NULL |10 |2022-09-15 15:27:56|world |8 |NULL |sprint1,sprint2 |
192197
|bitbucket:BitbucketIssue:1:10|board789 |https://api.bitbucket.org/2.0/repositories/thenicetgp/lake/issues/10| |10 |issue test007|issue test007 | |issue|TODO |new |0 |NULL |2022-08-12 13:43:00.783+00:00|2022-08-12 13:43:00.783+00:00| |trivial |0 |0 |0 |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp | | |NULL |NULL |NULL |30 |2022-09-15 15:27:56|abc |2456790|hello worlds |
193198
|bitbucket:BitbucketIssue:1:13|board789 |https://api.bitbucket.org/2.0/repositories/thenicetgp/lake/issues/13| |13 |issue test010|issue test010 | |issue|TODO |new |0 |NULL |2022-08-12 13:44:46.508+00:00|2022-08-12 13:44:46.508+00:00| |critical|0 |0 |0 |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp | | | | |NULL |NULL |NULL |1 |2022-09-15 15:27:56|NULL |0.00014|NULL |
194199
|bitbucket:BitbucketIssue:1:14|board789 |https://api.bitbucket.org/2.0/repositories/thenicetgp/lake/issues/14| |14 |issue test011|issue test011 | |issue|TODO |new |0 |NULL |2022-08-12 13:45:12.810+00:00|2022-08-12 13:45:12.810+00:00| |blocker |0 |0 |0 |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp |bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf|tgp | | |NULL |NULL |NULL |41534568464351|2022-09-15 15:27:56|NULL |NULL |label1,label2,label3|
@@ -217,6 +222,84 @@ The following is an issue_commits.CSV file sample:
217222
|jira:JiraIssue:1:10202|0ab12c4d4064003602edceed900d1456b6209894|
218223
|jira:JiraIssue:1:10203|980e9fe7bc3e22a0409f7241a024eaf9c53680dd|
219224

225+
### Upload `issue_repo_commits.csv` file
226+
227+
> POST /plugins/customize/csvfiles/issue_repo_commits.csv
228+
229+
#### API Description
230+
Upload issue_repo_commits.csv file to import issue-repo commit relationships into DevLake.
231+
232+
#### Request
233+
- **Content-Type**: multipart/form-data
234+
- **Parameters**:
235+
- `boardId` (required): The ID of the board
236+
- `incremental` (optional): Whether to import incrementally (default: false)
237+
- `file` (required): The CSV file to upload
238+
239+
#### Responses
240+
- **200**: Success
241+
- **400**: Bad Request
242+
- **500**: Internal Server Error
243+
244+
#### CSV Format
245+
The CSV file should contain the following columns:
246+
247+
|issue_id |repo_url |commit_sha |host |namespace |repo_name|
248+
|----------------------|------------------------------------------|----------------------------------------|------------|----------|---------|
249+
|jira:JiraIssue:1:10063|https://github.com/apache/devlake.git |8748a066cbaf67b15e86f2c636f9931347e987cf|github.com |apache |devlake |
250+
|jira:JiraIssue:1:10064|https://github.com/apache/devlake.git |e6bde456807818c5c78d7b265964d6d48b653af6|github.com |apache |devlake |
251+
252+
### Upload `sprints.csv` file
253+
254+
> POST /plugins/customize/csvfiles/sprints.csv
255+
256+
The `Content-Type` should be `multipart/form-data`, and the form should have three fields:
257+
258+
- `file`: The CSV file to upload
259+
- `boardId`: The ID of the board
260+
- `incremental`: Whether to import incrementally (default: false)
261+
262+
The following is a sprints.CSV file sample:
263+
264+
|id |url |status |name |start_date |ended_date |completed_date |
265+
|------|-------------------------------------|----------|-----------|--------------------|----------------------|----------------------|
266+
|sprint1|https://jira.example.com/sprint/1 |ACTIVE |Sprint 1 |2022-01-01 00:00:00 |2022-01-14 00:00:00 |NULL |
267+
|sprint2|https://jira.example.com/sprint/2 |CLOSED |Sprint 2 |2022-01-15 00:00:00 |2022-01-28 00:00:00 |2022-01-28 12:00:00 |
268+
269+
### Upload `issue_worklogs.csv` file
270+
271+
> POST /plugins/customize/csvfiles/issue_worklogs.csv
272+
273+
The `Content-Type` should be `multipart/form-data`, and the form should have three fields:
274+
275+
- `file`: The CSV file to upload
276+
- `boardId`: The ID of the board
277+
- `incremental`: Whether to import incrementally (default: false)
278+
279+
The following is an issue_worklogs.CSV file sample:
280+
281+
|id |issue_id |author_name (will create account record)|time_spent_minutes|started_date |logged_date |comment |
282+
|------|----------------------|------------|------------------|---------------------|---------------------|----------------------|
283+
|1 |jira:JiraIssue:1:10063|John Doe |120 |2022-01-01 09:30:00 |2022-01-01 10:00:00 |Initial investigation |
284+
|2 |jira:JiraIssue:1:10064|Jane Smith |60 |2022-01-02 14:00:00 |2022-01-02 14:30:00 |Bug fixing |
285+
286+
### Upload `issue_changelogs.csv` file
287+
288+
> POST /plugins/customize/csvfiles/issue_changelogs.csv
289+
290+
The `Content-Type` should be `multipart/form-data`, and the form should have three fields:
291+
292+
- `file`: The CSV file to upload
293+
- `boardId`: The ID of the board
294+
- `incremental`: Whether to import incrementally (default: false)
295+
296+
The following is an issue_changelogs.CSV file sample:
297+
298+
|id |issue_id |author_name (will create account record)|field_name |original_from_value|original_to_value|created_date |
299+
|------|----------------------|------------|-----------|-------------------|-----------------|----------------------|
300+
|1 |jira:JiraIssue:1:10063|John Doe |status |Open |In Progress |2022-01-01 09:00:00 |
301+
|2 |jira:JiraIssue:1:10063|John Doe |status |In Progress |Done |2022-01-03 17:00:00 |
302+
220303
### Upload `qa_apis.csv` file
221304

222305
> POST /plugins/customize/csvfiles/qa_apis.csv

0 commit comments

Comments
 (0)