Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ name: build
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
name: build
runs-on: ${{ matrix.os }}
platform:
- linux-amd64 # ubuntu 24.04
- linux-arm64 # ubuntu 24.04-arm64
runs-on: ${{ matrix.platform == 'linux-amd64' && 'ubuntu-24.04' || matrix.platform == 'linux-arm64' && 'ubuntu-24.04-arm' }}
name: build-${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- name: Set up golang
Expand Down Expand Up @@ -63,7 +66,7 @@ jobs:
go get -v ./...
make atomfs
cp ./bin/atomfs ~/bin
cp ./bin/atomfs atomfs-${{ matrix.os }}
cp ./bin/atomfs atomfs-${{ matrix.platform }}
- name: test
run: |
make batstest
Expand All @@ -78,4 +81,4 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
atomfs-${{ matrix.os }}
atomfs-${{ matrix.platform }}
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ endif
ROOT := $(shell git rev-parse --show-toplevel)
GO_SRC_DIRS := $(shell find . -name "*.go" | xargs -n1 dirname | sort -u)
GO_SRC := $(shell find . -name "*.go")
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
VERSION_LDFLAGS=-X main.Version=$(MAIN_VERSION)
BATS = $(TOOLS_D)/bin/bats
BATS_VERSION := v1.10.0
PRE_EROFS_STACKER = $(TOOLS_D)/bin/pre-erofs-stacker
PRE_EROFS_STACKER_VERSION := v1.0.0
STACKER = $(TOOLS_D)/bin/stacker
STACKER_VERSION := v1.1.0-rc1
STACKER_VERSION := v1.1.3
TOOLS_D := $(ROOT)/tools
GOCOVERDIR ?= $(ROOT)

Expand Down Expand Up @@ -43,7 +45,7 @@ $(PRE_EROFS_STACKER):

$(STACKER):
mkdir -p $(TOOLS_D)/bin
wget --progress=dot:giga https://github.com/project-stacker/stacker/releases/download/$(STACKER_VERSION)/stacker --output-document $(TOOLS_D)/bin/stacker
wget --progress=dot:giga https://github.com/project-stacker/stacker/releases/download/$(STACKER_VERSION)/stacker-$(GOOS)-$(GOARCH) --output-document $(TOOLS_D)/bin/stacker
chmod +x $(TOOLS_D)/bin/stacker

$(BATS):
Expand Down
2 changes: 1 addition & 1 deletion pkg/verity/verity.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (verity verityDeviceType) Unmanaged() (unsafe.Pointer, func()) {
cParams.fec_device = nil
cParams.fec_roots = 0

cParams.salt_size = 32 // DEFAULT_VERITY_SALT_SIZE for x86
cParams.salt_size = 32 // DEFAULT_VERITY_SALT_SIZE
cParams.salt = nil

// these can't be larger than a page size, but we want them to be as
Expand Down
20 changes: 14 additions & 6 deletions test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ check_root(){
fi
}

ROOT_D=$(dirname $BATS_TEST_FILENAME)/..
ROOT_D=$(dirname "$BATS_TEST_FILENAME")/..
TOOLS_D=$ROOT_D/tools
export PATH="$TOOLS_D/bin:$ROOT_D/bin:$PATH"

build_image_at() {
cd $1
cd "$1" || return 1
stackerfilename=${2:-1.stacker.yaml}
sudo env "PATH=$PATH" stacker --oci-dir $1/oci --stacker-dir=$1/stacker --roots-dir=$1/roots --debug build -f $(dirname $BATS_TEST_FILENAME)/$stackerfilename --layer-type squashfs
sudo env "PATH=$PATH" stacker --oci-dir $1/oci-no-verity --stacker-dir=$1/stacker --roots-dir=$1/roots --debug build -f $(dirname $BATS_TEST_FILENAME)/$stackerfilename --layer-type squashfs --no-squashfs-verity
sudo env "PATH=$PATH" pre-erofs-stacker --oci-dir $1/oci-pre-erofs --stacker-dir=$1/stacker-pre-erofs --roots-dir=$1/roots-pre-erofs --debug build -f $(dirname $BATS_TEST_FILENAME)/$stackerfilename --layer-type squashfs
sudo chown -R $(id -un):$(id -gn) $1/oci $1/oci-no-verity $1/oci-pre-erofs $1/stacker $1/stacker-pre-erofs $1/roots $1/roots-pre-erofs
sudo env "PATH=$PATH" stacker --oci-dir "$1/oci" --stacker-dir="$1/stacker" --roots-dir="$1/roots" --debug build -f "$(dirname "$BATS_TEST_FILENAME")/$stackerfilename" --layer-type squashfs
sudo env "PATH=$PATH" stacker --oci-dir "$1/oci-no-verity" --stacker-dir="$1/stacker" --roots-dir="$1/roots" --debug build -f "$(dirname "$BATS_TEST_FILENAME")/$stackerfilename" --layer-type squashfs --no-squashfs-verity
PRE_EROFS="$1/oci-pre-erofs $1/stacker-pre-erofs $1/roots-pre-erofs"
if [ "$(uname -m)" != "x86_64" ]; then
echo "skipping pre-erofs-stacker build. no support for arch $(uname -m)"
PRE_EROFS=""
else
sudo env "PATH=$PATH" pre-erofs-stacker --oci-dir "$1/oci-pre-erofs" --stacker-dir="$1/stacker-pre-erofs" --roots-dir="$1/roots-pre-erofs" --debug build -f "$(dirname "$BATS_TEST_FILENAME")/$stackerfilename" --layer-type squashfs
fi
# we want PRE_EROFS to expand and split
# shellcheck disable=SC2086
sudo chown -R "$(id -un):$(id -gn)" "$1/oci" "$1/oci-no-verity" "$1/stacker" "$1/roots" ${PRE_EROFS}
}
6 changes: 6 additions & 0 deletions test/priv-mount.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function setup() {
mkdir -p $MP
}

function require_x86() {
[ "$(uname -m)" = "x86_64" ] || skip "test expected ARCH=x86_64 found ARCH=$(uname -m)"
}

@test "RO mount/umount and verify of good image works" {
run atomfs-cover --debug mount ${BATS_SUITE_TMPDIR}/oci:test-squashfs $MP
assert_success
Expand Down Expand Up @@ -124,6 +128,8 @@ function setup() {

@test "mount of image built with pre-erofs stacker works" {

require_x86

cp -r ${BATS_SUITE_TMPDIR}/oci-pre-erofs /tmp/1-test-preerofs

run atomfs-cover --debug mount ${BATS_SUITE_TMPDIR}/oci-pre-erofs:test-squashfs $MP
Expand Down
Loading