Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: return an explicit error on empty deployment (#3628)

Danny Xud0310c5c1f3f
diff --git a/.github/workflows/backend-tests-default.yml b/.github/workflows/backend-tests-default.yml
index 892cb46130..97916d28f3 100644
--- a/.github/workflows/backend-tests-default.yml
+++ b/.github/workflows/backend-tests-default.yml
@@ -13,7 +13,12 @@ on:
- "quickstart/**"
jobs:
- job-ignored:
+ golangci-lint:
+ runs-on: ubuntu-latest
+ steps:
+ - run: 'echo "Not required"'
+
+ go-tests:
runs-on: ubuntu-latest
steps:
- run: 'echo "Not required"'
diff --git a/.github/workflows/frontend-tests-default.yml b/.github/workflows/frontend-tests-default.yml
index 36b808d262..7358b04062 100644
--- a/.github/workflows/frontend-tests-default.yml
+++ b/.github/workflows/frontend-tests-default.yml
@@ -10,7 +10,12 @@ on:
- "frontend/**"
jobs:
- job-ignored:
+ eslint-checks:
+ runs-on: ubuntu-latest
+ steps:
+ - run: 'echo "Not required"'
+
+ frontend-tests:
runs-on: ubuntu-latest
steps:
- run: 'echo "Not required"'
diff --git a/server/issue.go b/server/issue.go
index bd171ae71b..561f95d863 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -319,19 +319,23 @@ func (s *Server) createIssue(ctx context.Context, issueCreate *api.IssueCreate)
if err != nil {
return nil, err
}
+ if len(pipelineCreate.StageList) == 0 {
+ return nil, echo.NewHTTPError(http.StatusBadRequest, "no database matched for deployment")
+ }
+ firstEnvironmentID := pipelineCreate.StageList[0].EnvironmentID
if issueCreate.AssigneeID == api.UnknownID {
return nil, echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, assignee missing")
}
// Try to find a more appropriate assignee if the current assignee is the system bot, indicating that the caller might not be sure about who should be the assignee.
if issueCreate.AssigneeID == api.SystemBotID {
- assigneeID, err := s.getDefaultAssigneeID(ctx, pipelineCreate.StageList[0].EnvironmentID, issueCreate.ProjectID, issueCreate.Type)
+ assigneeID, err := s.getDefaultAssigneeID(ctx, firstEnvironmentID, issueCreate.ProjectID, issueCreate.Type)
if err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to find a default assignee").SetInternal(err)
}
issueCreate.AssigneeID = assigneeID
}
- ok, err := s.canPrincipalBeAssignee(ctx, issueCreate.AssigneeID, pipelineCreate.StageList[0].EnvironmentID, issueCreate.ProjectID, issueCreate.Type)
+ ok, err := s.canPrincipalBeAssignee(ctx, issueCreate.AssigneeID, firstEnvironmentID, issueCreate.ProjectID, issueCreate.Type)
if err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to check if the assignee can be set for the new issue").SetInternal(err)
}