@@ -17,6 +17,7 @@ limitations under the License.
17
17
package cluster
18
18
19
19
import (
20
+ "bytes"
20
21
"context"
21
22
"fmt"
22
23
"io"
@@ -95,10 +96,15 @@ func (b *Builder) copyKanikoBuildContext(ctx context.Context, workspace string,
95
96
buildCtxWriter .Close ()
96
97
}()
97
98
98
- if err := b .kubectlcli .Run (ctx , buildCtx , nil , "exec" , "-i" , podName , "-c" , initContainer , "-n" , b .Namespace , "--" , "tar" , "-xf" , "-" , "-C" , constants .DefaultKanikoEmptyDirMountPath ); err != nil {
99
- return fmt .Errorf ("uploading build context: %w" , err )
99
+ var out bytes.Buffer
100
+ if err := b .kubectlcli .Run (ctx , buildCtx , & out , "exec" , "-i" , podName , "-c" , initContainer , "-n" , b .Namespace , "--" , "tar" , "-xf" , "-" , "-C" , constants .DefaultKanikoEmptyDirMountPath ); err != nil {
101
+ return fmt .Errorf ("uploading build context: %s" , out .String ())
100
102
}
101
103
102
104
// Generate a file to successfully terminate the init container
103
- return b .kubectlcli .Run (ctx , nil , nil , "exec" , podName , "-c" , initContainer , "-n" , b .Namespace , "--" , "touch" , "/tmp/complete" )
105
+ if out , err := b .kubectlcli .RunOut (ctx , "exec" , podName , "-c" , initContainer , "-n" , b .Namespace , "--" , "touch" , "/tmp/complete" ); err != nil {
106
+ return fmt .Errorf ("finishing upload of the build context: %s" , out )
107
+ }
108
+
109
+ return nil
104
110
}
0 commit comments