Skip to content

Commit ed7a259

Browse files
Ramkumar Chinchanirchincha
authored andcommitted
feat: add support for erofs layers
atomfs has added support for additional filesystem types such as erofs. Signed-off-by: Ramkumar Chinchani <[email protected]> Signed-off-by: Ramkumar Chinchani <[email protected]>
1 parent c34ba3a commit ed7a259

File tree

16 files changed

+230
-44
lines changed

16 files changed

+230
-44
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
- name: install dependencies
6868
run: |
6969
./install-build-deps.sh
70+
sudo apt-get install -y linux-modules-extra-$(uname -r)
7071
echo "running kernel is: $(uname -a)"
7172
- name: docker-clone
7273
run: |

.github/workflows/coverage.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ on:
3232

3333
jobs:
3434
build:
35-
runs-on: ubuntu-22.04
35+
runs-on: ubuntu-24.04
3636
services:
3737
registry:
3838
image: ghcr.io/project-stacker/registry:2
@@ -68,6 +68,7 @@ jobs:
6868
- name: install dependencies
6969
run: |
7070
./install-build-deps.sh
71+
sudo apt-get install -y linux-modules-extra-$(uname -r)
7172
echo "running kernel is: $(uname -a)"
7273
- name: docker-clone
7374
run: |

cmd/stacker/build.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55

66
cli "github.com/urfave/cli/v2"
7-
"machinerun.io/atomfs/squashfs"
7+
"machinerun.io/atomfs/pkg/verity"
88
"stackerbuild.io/stacker/pkg/stacker"
99
"stackerbuild.io/stacker/pkg/types"
1010
)
@@ -52,12 +52,12 @@ func initCommonBuildFlags() []cli.Flag {
5252
},
5353
&cli.StringSliceFlag{
5454
Name: "layer-type",
55-
Usage: "set the output layer type (supported values: tar, squashfs); can be supplied multiple times",
55+
Usage: "set the output layer type (supported values: tar, squashfs, erofs); can be supplied multiple times",
5656
Value: cli.NewStringSlice("tar"),
5757
},
5858
&cli.BoolFlag{
59-
Name: "no-squashfs-verity",
60-
Usage: "do not append dm-verity data to squashfs archives",
59+
Name: "no-verity",
60+
Usage: "do not append dm-verity data to fs archives",
6161
},
6262
&cli.BoolFlag{
6363
Name: "require-hash",
@@ -103,7 +103,7 @@ func newBuildArgs(ctx *cli.Context) (stacker.BuildArgs, error) {
103103
AnnotationsNamespace: ctx.String("annotations-namespace"),
104104
}
105105
var err error
106-
verity := squashfs.VerityMetadata(!ctx.Bool("no-squashfs-verity"))
106+
verity := verity.VerityMetadata(!ctx.Bool("no-verity"))
107107
args.LayerTypes, err = types.NewLayerTypes(ctx.StringSlice("layer-type"), verity)
108108
return args, err
109109
}

cmd/stacker/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/opencontainers/umoci/oci/casext"
1212
"github.com/pkg/errors"
1313
cli "github.com/urfave/cli/v2"
14-
stackeroci "machinerun.io/atomfs/oci"
14+
stackeroci "machinerun.io/atomfs/pkg/oci"
1515
)
1616

1717
var inspectCmd = cli.Command{

cmd/stacker/internal_go.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/pkg/errors"
1010
cli "github.com/urfave/cli/v2"
1111
"golang.org/x/sys/unix"
12-
"machinerun.io/atomfs"
12+
"machinerun.io/atomfs/pkg/molecule"
1313
"stackerbuild.io/stacker/pkg/lib"
1414
"stackerbuild.io/stacker/pkg/log"
1515
"stackerbuild.io/stacker/pkg/overlay"
@@ -176,14 +176,14 @@ func doAtomfsMount(ctx *cli.Context) error {
176176
tag := ctx.Args().Get(0)
177177
mountpoint := ctx.Args().Get(1)
178178

179-
opts := atomfs.MountOCIOpts{
179+
opts := molecule.MountOCIOpts{
180180
OCIDir: config.OCIDir,
181181
Tag: tag,
182182
Target: mountpoint,
183183
AllowMissingVerityData: true,
184184
}
185185

186-
mol, err := atomfs.BuildMoleculeFromOCI(opts)
186+
mol, err := molecule.BuildMoleculeFromOCI(opts)
187187
if err != nil {
188188
return err
189189
}
@@ -199,5 +199,5 @@ func doAtomfsUmount(ctx *cli.Context) error {
199199
}
200200

201201
mountpoint := ctx.Args().Get(0)
202-
return atomfs.Umount(mountpoint)
202+
return molecule.Umount(mountpoint)
203203
}

cmd/stacker/publish.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"github.com/pkg/errors"
55
cli "github.com/urfave/cli/v2"
6-
"machinerun.io/atomfs/squashfs"
6+
"machinerun.io/atomfs/pkg/verity"
77
"stackerbuild.io/stacker/pkg/lib"
88
"stackerbuild.io/stacker/pkg/stacker"
99
"stackerbuild.io/stacker/pkg/types"
@@ -69,7 +69,7 @@ var publishCmd = cli.Command{
6969
},
7070
&cli.StringSliceFlag{
7171
Name: "layer-type",
72-
Usage: "set the output layer type (supported values: tar, squashfs); can be supplied multiple times",
72+
Usage: "set the output layer type (supported values: tar, squashfs, erofs); can be supplied multiple times",
7373
Value: cli.NewStringSlice("tar"),
7474
},
7575
&cli.StringSliceFlag{
@@ -108,7 +108,7 @@ func beforePublish(ctx *cli.Context) error {
108108
}
109109

110110
func doPublish(ctx *cli.Context) error {
111-
verity := squashfs.VerityMetadata(!ctx.Bool("no-squashfs-verity"))
111+
verity := verity.VerityMetadata(!ctx.Bool("no-verity"))
112112
layerTypes, err := types.NewLayerTypes(ctx.StringSlice("layer-type"), verity)
113113
if err != nil {
114114
return err

cmd/stacker/validate.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func validateLayerTypeFlags(ctx *cli.Context) error {
5050
break
5151
case "squashfs":
5252
break
53+
case "erofs":
54+
break
5355
default:
5456
return errors.Errorf("unknown layer type: %s", layerType)
5557
}

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/mitchellh/hashstructure v1.1.0
2020
github.com/moby/buildkit v0.11.4
2121
github.com/opencontainers/go-digest v1.0.0
22-
github.com/opencontainers/image-spec v1.1.0-rc4
22+
github.com/opencontainers/image-spec v1.1.0
2323
github.com/opencontainers/umoci v0.4.8-0.20220412065115-12453f247749
2424
github.com/pkg/errors v0.9.1
2525
github.com/pkg/xattr v0.4.9
@@ -290,5 +290,6 @@ require (
290290

291291
replace (
292292
github.com/opencontainers/umoci => github.com/project-stacker/umoci v0.0.0-20240906174318-e9397ba4ced0
293+
machinerun.io/atomfs => github.com/rchincha/atomfs v0.0.0-20250216002037-e582f37114f4
293294
stackerbuild.io/stacker-bom => github.com/project-stacker/stacker-bom v0.0.0-20240509203427-4d685e046780
294295
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,8 @@ github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3ev
754754
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
755755
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
756756
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
757-
github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0=
758-
github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
757+
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
758+
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
759759
github.com/opencontainers/runc v1.2.3 h1:fxE7amCzfZflJO2lHXf4y/y8M1BoAqp+FVmG19oYB80=
760760
github.com/opencontainers/runc v1.2.3/go.mod h1:nSxcWUydXrsBZVYNSkTjoQ/N6rcyTtn+1SD5D4+kRIM=
761761
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=
@@ -821,6 +821,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
821821
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
822822
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
823823
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
824+
github.com/rchincha/atomfs v0.0.0-20250216002037-e582f37114f4 h1:3V1d2yzgSHqMwe5CQnFV/N6Zej1qpQV1OrQpnmTsmv4=
825+
github.com/rchincha/atomfs v0.0.0-20250216002037-e582f37114f4/go.mod h1:jrGbuGXiCPi4LFoMvcPRnqPGlxe3pW8UtLEnhUcGRmI=
824826
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
825827
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
826828
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@@ -1598,8 +1600,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
15981600
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
15991601
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
16001602
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
1601-
machinerun.io/atomfs v1.1.3 h1:oV1SH7VI2MqAks7FlirhLLKvyVcJkMB0NFevXF8EJaU=
1602-
machinerun.io/atomfs v1.1.3/go.mod h1:qXz4epm3/7vEpEyf9YaTCafp3CwbUeDa1XrYyx7qbPc=
16031603
modernc.org/libc v1.37.6 h1:orZH3c5wmhIQFTXF+Nt+eeauyd+ZIt2BX6ARe+kD+aw=
16041604
modernc.org/libc v1.37.6/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE=
16051605
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=

install-build-deps.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ installdeps_ubuntu() {
4444
squashfuse
4545
libarchive-tools
4646
shellcheck
47+
erofs-utils
48+
erofsfuse
4749
)
4850

4951
case "$VERSION_ID" in

0 commit comments

Comments
 (0)