Skip to content

Commit

Permalink
Added the git ls-files merged output to artifacts for troubleshooting #…
Browse files Browse the repository at this point in the history
  • Loading branch information
pazone committed Jul 17, 2023
1 parent 28019e3 commit 00c28c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ steps:
command: ".buildkite/scripts/integration_tests.sh"
artifact_paths:
- "build/TEST-**"
- "archive-files"
agents:
provider: "gcp"
16 changes: 16 additions & 0 deletions pkg/testing/runner/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -44,6 +45,12 @@ func createRepoZipArchive(ctx context.Context, dir string, dest string) error {
return fmt.Errorf("failed to run git ls-files -o: exited code %d", processDone.ExitCode())
}

// Added for troubleshooting https://github.com/elastic/elastic-agent/issues/3068
err = saveFilesList(absDir, stdout)
if err != nil {
fmt.Printf("Error writing to file: %v\n", err)

Check failure on line 51 in pkg/testing/runner/archiver.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

use of `fmt.Printf` forbidden by pattern `fmt.Print.*` (forbidigo)
}

archive, err := os.Create(dest)
if err != nil {
return fmt.Errorf("failed to create file %s: %w", dest, err)
Expand Down Expand Up @@ -111,3 +118,12 @@ func workDir(dir string) process.CmdOption {
return nil
}
}

// Added for troubleshooting https://github.com/elastic/elastic-agent/issues/3068
func saveFilesList(dir string, stdout bytes.Buffer) error {
err := ioutil.WriteFile(filepath.Join(dir, "archive-files"), stdout.Bytes(), 0644)
if err != nil {
return err
}
return nil
}

0 comments on commit 00c28c1

Please sign in to comment.