Skip to content

Commit

Permalink
chore: revert "improve artifacts generation reproducibility"
Browse files Browse the repository at this point in the history
GCP does not consider generated .tar file to be valid.

This reverts commit b2507b4.
Refs #4023.

Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@talos-systems.com>
  • Loading branch information
AlekSi authored and talos-bot committed Aug 10, 2021
1 parent b68ed1e commit fdf6b24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ RUN apk add --no-cache --update \
efibootmgr \
mtools \
qemu-img \
tar \
util-linux \
xfsprogs \
xorriso \
Expand Down
13 changes: 1 addition & 12 deletions cmd/installer/cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,7 @@ func finalize(platform runtime.Platform, img, arch string) (err error) {
}

func tar(filename, src, dir string) error {
if _, err := cmd.Run("tar",
"--sort=name",
"--mtime=1970-01-01 00:00Z",
"--owner=0",
"--group=0",
"--numeric-owner",
"--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime",
"-C", dir,
"-czvf",
filepath.Join(outputArg, filename),
src,
); err != nil {
if _, err := cmd.Run("tar", "-czvf", filepath.Join(outputArg, filename), src, "-C", dir); err != nil {
return err
}

Expand Down
16 changes: 5 additions & 11 deletions cmd/installer/pkg/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ package pkg

import (
"fmt"
"os"

"github.com/talos-systems/go-cmd/pkg/cmd"
)

const (
Expand All @@ -18,18 +19,11 @@ const (
func CreateRawDisk() (img string, err error) {
img = "/tmp/disk.raw"

var f *os.File
seek := fmt.Sprintf("seek=%d", RAWDiskSize)

f, err = os.Create(img)
if err != nil {
if _, err = cmd.Run("dd", "if=/dev/zero", "of="+img, "bs=1M", "count=0", seek); err != nil {
return "", fmt.Errorf("failed to create RAW disk: %w", err)
}

if err = f.Truncate(RAWDiskSize * 1048576); err != nil {
return "", fmt.Errorf("failed to truncate RAW disk: %w", err)
}

err = f.Close()

return img, err
return img, nil
}

0 comments on commit fdf6b24

Please sign in to comment.