From 33cb402ffaade4d9fa986cc4be137f90c7d4bd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Ma=C5=82achowski?= <38684517+KacperMalachowski@users.noreply.github.com> Date: Fri, 31 Jan 2025 08:44:19 +0100 Subject: [PATCH] Add status of pushing images to registry (#12615) * Add status of pushing images to registry * Fix whitespaces --- pkg/imagebuilder/report.go | 14 ++++++++++---- pkg/imagebuilder/report_test.go | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/imagebuilder/report.go b/pkg/imagebuilder/report.go index 2b20102d8f0e..c251e8dba591 100644 --- a/pkg/imagebuilder/report.go +++ b/pkg/imagebuilder/report.go @@ -11,10 +11,16 @@ import ( var reportRegex = regexp.MustCompile(`(?s)---IMAGE BUILD REPORT---\n(.*)\n---END OF IMAGE BUILD REPORT---`) type BuildReport struct { - Status string `json:"status"` - IsSigned bool `json:"signed"` - IsProduction bool `json:"is_production"` - ImageSpec ImageSpec `json:"image_spec"` + // Status is the overall status of the build including signing and pushing + Status string `json:"status"` + // IsPushed indicates whether the image was pushed to a registry + IsPushed bool `json:"pushed"` + // IsSigned indicates whether the image was signed + IsSigned bool `json:"signed"` + // IsProduction indicates whether the image is a production image + IsProduction bool `json:"is_production"` + // ImageSpec contains the image name, tags, and repository path + ImageSpec ImageSpec `json:"image_spec"` } type ImageSpec struct { diff --git a/pkg/imagebuilder/report_test.go b/pkg/imagebuilder/report_test.go index 076a8e0edb07..7aaeefa36b69 100644 --- a/pkg/imagebuilder/report_test.go +++ b/pkg/imagebuilder/report_test.go @@ -19,6 +19,7 @@ Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/p ---IMAGE BUILD REPORT--- { "status": "Succeeded", + "pushed": true, "signed": true, "is_production": true, "image_spec": { @@ -38,6 +39,7 @@ Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/p Finishing: prepare_image_build_report` expectedReport := &BuildReport{ Status: "Succeeded", + IsPushed: true, IsSigned: true, IsProduction: true, ImageSpec: ImageSpec{