This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 497fc5b54 fix: ignore 404 when collecting gitlab mr detail (#5521)
497fc5b54 is described below
commit 497fc5b541412ed3c30215b925a583dc7e94d0b7
Author: Klesh Wong <[email protected]>
AuthorDate: Mon Jun 19 15:45:18 2023 +0800
fix: ignore 404 when collecting gitlab mr detail (#5521)
* fix: ignore 404 when collecting mr detail
* fix: ci commit msg linter
---
.github/workflows/commit-msg.yml | 4 ++--
backend/plugins/gitlab/tasks/api_client.go | 7 +++++++
backend/plugins/gitlab/tasks/mr_commit_collector.go | 1 +
backend/plugins/gitlab/tasks/mr_detail_collector.go | 1 +
backend/plugins/gitlab/tasks/mr_note_collector.go | 1 +
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/commit-msg.yml b/.github/workflows/commit-msg.yml
index b5898a30a..2c8c664ac 100644
--- a/.github/workflows/commit-msg.yml
+++ b/.github/workflows/commit-msg.yml
@@ -35,5 +35,5 @@ jobs:
- name: Lint commit message
run: |
! git log --oneline ${{ github.event.pull_request.base.sha }}... \
- | grep -vP '^\w{8} Merge ' \
- | grep -vP '^\w{8}
(feat|fix|build|chore|docs|style|refactor|perf|test|ci)(\(\w+(-\w+)?\))?:(\s*).*'
+ | grep -vP '^\w{8,40} Merge ' \
+ | grep -vP '^\w{8,40}
(feat|fix|build|chore|docs|style|refactor|perf|test|ci)(\(\w+(-\w+)?\))?:(\s*).*'
diff --git a/backend/plugins/gitlab/tasks/api_client.go
b/backend/plugins/gitlab/tasks/api_client.go
index 5010f8733..0d6a84c7e 100644
--- a/backend/plugins/gitlab/tasks/api_client.go
+++ b/backend/plugins/gitlab/tasks/api_client.go
@@ -75,3 +75,10 @@ func ignoreHTTPStatus403(res *http.Response) errors.Error {
}
return nil
}
+
+func ignoreHTTPStatus404(res *http.Response) errors.Error {
+ if res.StatusCode == http.StatusNotFound {
+ return api.ErrIgnoreAndContinue
+ }
+ return nil
+}
diff --git a/backend/plugins/gitlab/tasks/mr_commit_collector.go
b/backend/plugins/gitlab/tasks/mr_commit_collector.go
index 91bfe0b2e..f84a58f1d 100644
--- a/backend/plugins/gitlab/tasks/mr_commit_collector.go
+++ b/backend/plugins/gitlab/tasks/mr_commit_collector.go
@@ -60,6 +60,7 @@ func CollectApiMergeRequestsCommits(taskCtx
plugin.SubTaskContext) errors.Error
Query: GetQuery,
GetTotalPages: GetTotalPagesFromResponse,
ResponseParser: GetRawMessageFromResponse,
+ AfterResponse: ignoreHTTPStatus404,
})
if err != nil {
return err
diff --git a/backend/plugins/gitlab/tasks/mr_detail_collector.go
b/backend/plugins/gitlab/tasks/mr_detail_collector.go
index 451a9391d..0b3971d3f 100644
--- a/backend/plugins/gitlab/tasks/mr_detail_collector.go
+++ b/backend/plugins/gitlab/tasks/mr_detail_collector.go
@@ -65,6 +65,7 @@ func CollectApiMergeRequestDetails(taskCtx
plugin.SubTaskContext) errors.Error {
return query, nil
},
ResponseParser: GetOneRawMessageFromResponse,
+ AfterResponse: ignoreHTTPStatus404,
})
if err != nil {
return err
diff --git a/backend/plugins/gitlab/tasks/mr_note_collector.go
b/backend/plugins/gitlab/tasks/mr_note_collector.go
index 817232708..a4d5f40ff 100644
--- a/backend/plugins/gitlab/tasks/mr_note_collector.go
+++ b/backend/plugins/gitlab/tasks/mr_note_collector.go
@@ -62,6 +62,7 @@ func CollectApiMergeRequestsNotes(taskCtx
plugin.SubTaskContext) errors.Error {
Query: GetQuery,
GetTotalPages: GetTotalPagesFromResponse,
ResponseParser: GetRawMessageFromResponse,
+ AfterResponse: ignoreHTTPStatus404,
})
if err != nil {
return err