@@ -21,6 +21,7 @@ package shared
2121
2222import (
2323 "context"
24+ "encoding/base64"
2425 "fmt"
2526 "os"
2627 "path"
@@ -204,12 +205,27 @@ func DumpMachine(ctx context.Context, e2eCtx *E2EContext, machine infrav1.AWSMac
204205 cmd : "journalctl --no-pager -u containerd.service" ,
205206 },
206207 {
207- title : "pod-logs" ,
208- cmd : "sudo tar -czf - -C /var/log pods | base64 -w0" ,
209- suffix : ".tar.gz" ,
208+ title : "pod-logs" ,
209+ cmd : "sudo tar -czf - -C /var/log pods | base64" ,
210210 },
211211 },
212212 )
213+
214+ // post-process pod-logs to have a tar.gz file instead of a base64 txt.
215+ sourcePodLogsFile := path .Join (filepath .Dir (f .Name ()), "pod-logs.txt" )
216+ targetPodLogsFile := path .Join (filepath .Dir (f .Name ()), "pod-logs.tar.gz" )
217+ inputData , err := os .ReadFile (sourcePodLogsFile )
218+ if err != nil {
219+ fmt .Fprintf (GinkgoWriter , "Couldn't read pod-logs command output: path=%q, err=%s\n " , sourcePodLogsFile , err )
220+ return
221+ }
222+ outputData := []byte {}
223+ if _ , err := base64 .RawStdEncoding .Decode (outputData , inputData ); err != nil {
224+ fmt .Fprintf (GinkgoWriter , "Couldn't base64 decode pod-logs: path=%q, err=%s\n " , sourcePodLogsFile , err )
225+ return
226+ }
227+ os .WriteFile (targetPodLogsFile , outputData , 0600 )
228+ os .Remove (sourcePodLogsFile )
213229}
214230
215231func DumpSpecResources (ctx context.Context , e2eCtx * E2EContext , namespace * corev1.Namespace ) {
0 commit comments