Handle errors when repository is empty
What does this MR do and why?
Catches an error in the Security configuration workflow, caused when the repository is empty i.e. it has not been initialized.
Relevant issue: #387492 (closed)
Error Response
Container Scanning/Dependency Scanning/Secret Detection
[
{
"data": {
"configureDependencyScanning": null
},
"errors": [
{
"message": "You must \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"http://172.16.123.1:3000/help/user/project/repository/index.md#add-files-to-a-repository\"\u003eadd at least one file to the repository\u003c/a\u003e before using Security features",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"configureDependencyScanning"
]
}
]
}
]
SAST
[
{
"data": {
"project": {
"id": "gid://gitlab/Project/20",
"sastCiConfiguration": null,
"__typename": "Project"
}
},
"errors": [
{
"message": "You must \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"http://172.16.123.1:3000/help/user/project/repository/index.md#add-files-to-a-repository\"\u003eadd at least one file to the repository\u003c/a\u003e before using Security features",
"locations": [
{
"line": 4,
"column": 5
}
],
"path": [
"project",
"sastCiConfiguration"
]
}
]
}
]
Screenshots or screen recordings
How to set up and validate locally
- Create a new blank project
- Go to "Security & Compliance" -> "Configuration"
- Try to configure one of the above security features using an MR ("Configure with merge request" button)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Arpit Gogia