Skip to content

Commit

Permalink
fix: rewriting tar header fields (#198)
Browse files Browse the repository at this point in the history
closes #192

Co-authored-by: DL <[email protected]>
  • Loading branch information
dlaburthe and DL authored May 21, 2021
1 parent 6c796e1 commit 588c621
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/provider/resource_docker_registry_image_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
Expand Down Expand Up @@ -297,6 +298,16 @@ func buildDockerImageContextTar(buildContext string) (string, error) {
// update the name to correctly reflect the desired destination when untaring
header.Name = strings.TrimPrefix(strings.Replace(file, buildContext, "", -1), string(filepath.Separator))

// set archive metadata non deterministic
header.Mode = 0
header.Uid = 0
header.Gid = 0
header.Uname = ""
header.Gname = ""
header.ModTime = time.Time{}
header.AccessTime = time.Time{}
header.ChangeTime = time.Time{}

// write the header
if err := tw.WriteHeader(header); err != nil {
return err
Expand Down

0 comments on commit 588c621

Please sign in to comment.