Skip to content
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
24 changes: 10 additions & 14 deletions eng/_util/cmd/sign/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"archive/zip"
"cmp"
"context"
"errors"
"fmt"
"io"
"io/fs"
Expand Down Expand Up @@ -464,27 +465,25 @@ func (a *archive) copyToDestination(ctx context.Context) error {
}

func consolidateDiagnosticFiles() error {
// Do as much as possible, accumulating errors to report to the user.
var err error
// Signing process logs.
if err := copyGlobFilesToDir(
err = errors.Join(err, copyGlobFilesToDir(
*consolidateDiagDir,
filepath.Join(*signingCsprojDir, "*.log"),
filepath.Join(*tempDir, "*.binlog"),
filepath.Join(*tempDir, "*.props"),
); err != nil {
return err
}
))
// .NET diag data, for package versions etc.
if err := copyGlobFilesToDir(
err = errors.Join(err, copyGlobFilesToDir(
filepath.Join(*consolidateDiagDir, "obj"),
filepath.Join(*signingCsprojDir, "obj", "*"),
); err != nil {
return err
}
))

// Signing working dirs. These contain the files actually sent to sign. Make
// it clear that they're not production-ready files through the filename.
cleanTempDir := filepath.Clean(*tempDir)
if err := withTarGzCreate(
err = errors.Join(err, withTarGzCreate(
filepath.Join(*consolidateDiagDir, "sign-work-archives.nonproduction.tar.gz"),
func(tw *tar.Writer) error {
if err := filepath.WalkDir(cleanTempDir, func(path string, d fs.DirEntry, err error) error {
Expand Down Expand Up @@ -531,9 +530,6 @@ func consolidateDiagnosticFiles() error {
}
return nil
},
); err != nil {
return err
}

return nil
))
return err
}
18 changes: 10 additions & 8 deletions eng/_util/cmd/sign/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"context"
"crypto/sha256"
"errors"
"flag"
"fmt"
"io"
Expand Down Expand Up @@ -74,7 +75,7 @@ func main() {
}
}

func run() error {
func run() (err error) {
// A context for timeout. This timeout is mainly here to make sure child MSBuild processes are
// terminated. There are some ctx.Err() checks sprinkled into the Go code, but canceling
// quickly during the packaging/repackaging work in Go is not currently important: the Go work
Expand All @@ -88,6 +89,14 @@ func run() error {
defer cancel()
}

defer func() {
log.Println("Consolidating diagnostic files")
log.Printf("Consolidated diagnostic directory: %q", *consolidateDiagDir)

consolidateErr := consolidateDiagnosticFiles()
err = errors.Join(err, consolidateErr)
}()

archives, err := findArchives(ctx, *filesGlob)
if err != nil {
return err
Expand Down Expand Up @@ -174,13 +183,6 @@ func run() error {
}
}

log.Println("Consolidating diagnostic files")
log.Printf("Consolidated diagnostic directory: %q", *consolidateDiagDir)

if err := consolidateDiagnosticFiles(); err != nil {
return err
}

return nil
}

Expand Down
Loading