Add 422 in the swagger.yaml (#20344)

change log level with no content message
  fix time in sbom accessory
  fixes #20342 #20332 #20328

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2024-04-24 09:57:46 +08:00 committed by GitHub
parent b7d4bf0d07
commit c80e9bf477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 3 deletions

View File

@ -1192,6 +1192,8 @@ paths:
$ref: '#/responses/403' $ref: '#/responses/403'
'404': '404':
$ref: '#/responses/404' $ref: '#/responses/404'
'422':
$ref: '#/responses/422'
'500': '500':
$ref: '#/responses/500' $ref: '#/responses/500'
/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/stop: /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/stop:
@ -1223,6 +1225,8 @@ paths:
$ref: '#/responses/403' $ref: '#/responses/403'
'404': '404':
$ref: '#/responses/404' $ref: '#/responses/404'
'422':
$ref: '#/responses/422'
'500': '500':
$ref: '#/responses/500' $ref: '#/responses/500'
/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/{report_id}/log: /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/{report_id}/log:
@ -1476,6 +1480,8 @@ paths:
$ref: '#/responses/403' $ref: '#/responses/403'
'404': '404':
$ref: '#/responses/404' $ref: '#/responses/404'
'422':
$ref: '#/responses/422'
'500': '500':
$ref: '#/responses/500' $ref: '#/responses/500'
/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels: /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels:
@ -4823,6 +4829,8 @@ paths:
$ref: '#/responses/403' $ref: '#/responses/403'
'404': '404':
$ref: '#/responses/404' $ref: '#/responses/404'
'422':
$ref: '#/responses/422'
'500': '500':
$ref: '#/responses/500' $ref: '#/responses/500'
/schedules: /schedules:
@ -6456,6 +6464,14 @@ responses:
type: string type: string
schema: schema:
$ref: '#/definitions/Errors' $ref: '#/definitions/Errors'
'422':
description: Unsupported Type
headers:
X-Request-Id:
description: The ID of the corresponding request for the response
type: string
schema:
$ref: '#/definitions/Errors'
'500': '500':
description: Internal server error description: Internal server error
headers: headers:

View File

@ -751,7 +751,7 @@ func (bc *basicController) GetSBOMSummary(ctx context.Context, art *ar.Artifact,
reportContent := reports[0].Report reportContent := reports[0].Report
result := map[string]interface{}{} result := map[string]interface{}{}
if len(reportContent) == 0 { if len(reportContent) == 0 {
log.Warning("no content for current report") log.Debug("no content for current report")
return result, nil return result, nil
} }
err = json.Unmarshal([]byte(reportContent), &result) err = json.Unmarshal([]byte(reportContent), &result)

View File

@ -112,9 +112,11 @@ func (v *scanHandler) PostScan(ctx job.Context, sr *v1.ScanRequest, _ *scanModel
// annotations defines the annotations for the accessory artifact // annotations defines the annotations for the accessory artifact
func (v *scanHandler) annotations() map[string]string { func (v *scanHandler) annotations() map[string]string {
t := time.Now().Format(time.RFC3339)
return map[string]string{ return map[string]string{
"created-by": "Harbor", "created": t,
"org.opencontainers.artifact.created": time.Now().Format(time.RFC3339), "created-by": "Harbor",
"org.opencontainers.artifact.created": t,
"org.opencontainers.artifact.description": "SPDX JSON SBOM", "org.opencontainers.artifact.description": "SPDX JSON SBOM",
} }
} }