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
1 change: 1 addition & 0 deletions Containerfile.init
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WORKDIR /build
COPY go.mod go.sum ./
COPY cmd/policy-ebpfd ./cmd/policy-ebpfd
COPY cmd/vminit-wrapper ./cmd/vminit-wrapper
COPY internal/audit ./internal/audit
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o policy-ebpfd ./cmd/policy-ebpfd \
&& CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o vminit-wrapper ./cmd/vminit-wrapper

Expand Down
14 changes: 13 additions & 1 deletion internal/ci/images_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,26 @@ func TestPublishImagesWorkflowUsesSupportedPlatforms(t *testing.T) {
}
}

func TestStrictInitContainerfileCopiesAuditPackage(t *testing.T) {
containerfile := string(readRepoFile(t, "Containerfile.init"))
if !strings.Contains(containerfile, "COPY internal/audit ./internal/audit") {
t.Fatal("Containerfile.init must copy internal/audit for the policy-ebpfd build")
}
}

func readWorkflow(t *testing.T) []byte {
t.Helper()
return readRepoFile(t, ".github", "workflows", "images.yml")
}

func readRepoFile(t *testing.T, path ...string) []byte {
t.Helper()
_, file, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("resolve test path")
}
root := filepath.Clean(filepath.Join(filepath.Dir(file), "..", ".."))
data, err := os.ReadFile(filepath.Join(root, ".github", "workflows", "images.yml"))
data, err := os.ReadFile(filepath.Join(append([]string{root}, path...)...))
if err != nil {
t.Fatal(err)
}
Expand Down
Loading