Skip to content

Commit

Permalink
Fix/goreleaser error (#80)
Browse files Browse the repository at this point in the history
* compress the rootfs before upload
* update blob pattern
  • Loading branch information
jordan-rash authored Jan 22, 2024
1 parent cb92482 commit a0f486e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 4 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ archives:
format: binary
name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
allow_different_binary_count: true
- id: rootfs
format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Version }}"
files:
- rootfs.ext4
allow_different_binary_count: true

release:
extra_files:
- glob: ./rootfs.ext4.gz

changelog:
sort: asc
Expand Down
13 changes: 12 additions & 1 deletion agent/fc-image/rootfs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"compress/gzip"
"context"
"fmt"
"os"
Expand Down Expand Up @@ -162,7 +163,17 @@ func build(ctx context.Context, tempdir string, mountPoint string) error {
if err != nil {
return err
}
err = os.WriteFile("rootfs.ext4", input, 0644)

rfs, err := os.Create("rootfs.ext4.gz")
if err != nil {
return err
}
defer rfs.Close()

gw := gzip.NewWriter(rfs)
defer gw.Close()

_, err = gw.Write(input)
if err != nil {
return err
}
Expand Down

0 comments on commit a0f486e

Please sign in to comment.