Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex used to retrieve report #12625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ func buildInADO(o options) error {
fmt.Printf("ADO pipeline image build logs:\n%s", logs)
}

fmt.Println("Getting build report.")
// Parse the build report from the ADO pipeline run logs.
buildReport, err = imagebuilder.NewBuildReportFromLogs(logs)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/imagebuilder/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// reportRegex is a regular expression that matches the image build report
var (
reportRegex = regexp.MustCompile(`(?s)---IMAGE BUILD REPORT---\n(.*)\n---END OF IMAGE BUILD REPORT---`)
reportRegex = regexp.MustCompile(`(?s)---IMAGE BUILD REPORT---(.*)---END OF IMAGE BUILD REPORT---`)

timestampRegex = regexp.MustCompile(`\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z\s`)
)
Expand Down Expand Up @@ -50,7 +50,7 @@ func NewBuildReportFromLogs(log string) (*BuildReport, error) {
// Find the report in the log
matches := reportRegex.FindStringSubmatch(log)
if len(matches) < 2 {
return nil, fmt.Errorf("no image build report found in log")
return nil, fmt.Errorf("failed to find image build report in log")
}

// Parse the report data
Expand Down
Loading