Skip to content

Commit

Permalink
feat: move to atomfs v1.1.3 with new API
Browse files Browse the repository at this point in the history
atomfs 1.1.3 has a new API for mounting that changes it to store metadata
about the mounted molecules in a known location. It also cleans up the
unmount code path and added a lot of tests to atomfs.

This moves to the new atomfs version and removes an obsolete mount
option.

It also fixes a typo in the atomfs test suite - this test case is also
now run in the atomfs repo itself and the typos were fixed there, but we
leave it here for extra coverage.

Signed-off-by: Michael McCracken <[email protected]>
  • Loading branch information
mikemccracken committed Jan 10, 2025
1 parent ad9a694 commit 22a8d82
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions cmd/stacker/internal_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"os"
"path"
"runtime"
"strings"

Expand Down Expand Up @@ -177,14 +176,8 @@ func doAtomfsMount(ctx *cli.Context) error {
tag := ctx.Args().Get(0)
mountpoint := ctx.Args().Get(1)

wd, err := os.Getwd()
if err != nil {
return errors.WithStack(err)
}

opts := atomfs.MountOCIOpts{
OCIDir: config.OCIDir,
MetadataPath: path.Join(wd, "atomfs-metadata"),
Tag: tag,
Target: mountpoint,
AllowMissingVerityData: true,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ require (
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
machinerun.io/atomfs v1.1.1
machinerun.io/atomfs v1.1.3
modernc.org/libc v1.37.6 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
machinerun.io/atomfs v1.1.1 h1:EprTiYMzAlKL+3S7woe9DsCJGwO2dkHTlvmjlVNO8pY=
machinerun.io/atomfs v1.1.1/go.mod h1:cidyEmsNeeo+9f7OiHl/nA+8KS7Vj5XOslR87VkIebM=
machinerun.io/atomfs v1.1.3 h1:oV1SH7VI2MqAks7FlirhLLKvyVcJkMB0NFevXF8EJaU=
machinerun.io/atomfs v1.1.3/go.mod h1:qXz4epm3/7vEpEyf9YaTCafp3CwbUeDa1XrYyx7qbPc=
modernc.org/libc v1.37.6 h1:orZH3c5wmhIQFTXF+Nt+eeauyd+ZIt2BX6ARe+kD+aw=
modernc.org/libc v1.37.6/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
Expand Down
6 changes: 3 additions & 3 deletions test/atomfs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ EOF
# first layer should still exist since a is still mounted
manifest=$(cat oci/index.json | jq -r .manifests[0].digest | cut -f2 -d:)
first_layer_hash=$(cat oci/blobs/sha256/$manifest | jq -r .layers[0].digest | cut -f2 -d:)
[ ! -b "/dev/mapper/$last_layer_hash-verity" ]
[ -b "/dev/mapper/$first_layer_hash-verity" ]

mkdir c
stacker internal-go atomfs mount c-squashfs c
Expand All @@ -120,7 +120,7 @@ EOF
# first layer should still exist since c is still mounted
manifest=$(cat oci/index.json | jq -r .manifests[0].digest | cut -f2 -d:)
first_layer_hash=$(cat oci/blobs/sha256/$manifest | jq -r .layers[0].digest | cut -f2 -d:)
[ ! -b "/dev/mapper/$last_layer_hash-verity" ]
[ -b "/dev/mapper/$first_layer_hash-verity" ]

# c should still be ok
[ -f c/c ]
Expand All @@ -130,7 +130,7 @@ EOF
# c's last layer shouldn't exist any more, since it is unique
manifest=$(cat oci/index.json | jq -r .manifests[0].digest | cut -f2 -d:)
last_layer_num=$(($(cat oci/blobs/sha256/$manifest | jq -r '.layers | length')-1))
last_layer_hash=$(cat oci/blobs/sha256/$manifest | jq -r .layers[$last_layer].digest | cut -f2 -d:)
last_layer_hash=$(cat oci/blobs/sha256/$manifest | jq -r .layers[$last_layer_num].digest | cut -f2 -d:)
[ ! -b "/dev/mapper/$last_layer_hash-verity" ]
verity_checkusedloops
}
Expand Down

0 comments on commit 22a8d82

Please sign in to comment.