Skip to content

Commit

Permalink
Add more integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Goff <[email protected]>
  • Loading branch information
cpuguy83 committed Oct 9, 2023
1 parent 08a3fb6 commit 246f7b1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ jobs:
docker buildx bake \
--set mariner2-toolchain.cache-from=type=gha,scope=dalec/mariner2-toolchain/ci \
--set mariner2-toolchain.cache-to=type=gha,scope=dalec/mariner2-toolchain/ci,mode=max \
--set runc-mariner2-*.contexts.mariner2-toolchain=target:mariner2-toolchain \
test-runc
test
28 changes: 25 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ group "default" {
targets = ["frontend"]
}

group "test" {
targets = ["test-runc", "test-fixture"]
}

target "frontend" {
target = "frontend"
tags = ["ghcr.io/azure/dalec/frontend:latest", BUILDKIT_SYNTAX]
Expand Down Expand Up @@ -66,10 +70,14 @@ target "runc" {
tags = tgt == "container" ? ["runc:${distro}"] : []
// only output non-container targets to the fs
output = tgt != "container" ? ["_output"] : []

cache-from = ["type=gha,scope=dalec/${distro}/${tgt}"]
cache-to = ["type=gha,scope=dalec/${distro}/${tgt},mode=max"]
}


target "test-runc" {
name = "test-runc-${distro}"
matrix = {
distro = ["mariner2"]
}
Expand All @@ -86,6 +94,20 @@ target "test-runc" {
EOT
}

group "test" {
targets = ["test-runc"]
}
target "test-fixture" {
name = "test-fixture-${f}"
matrix = {
f = ["http-src", "nested", "frontend"]
tgt = ["mariner2/rpm"]
}
contexts = {
"mariner2-toolchain" = "target:mariner2-toolchain"
}
dockerfile = "test/fixtures/${f}.yml"
args = {
"BUILDKIT_SYNTAX" = BUILDKIT_SYNTAX
}
target = tgt
cache-from = ["type=gha,scope=dalec/${tgt}/${f}"]
cache-to = ["type=gha,scope=dalec/${tgt}/${f},mode=max"]
}
10 changes: 5 additions & 5 deletions test/fixtures/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ vendor: Microsoft
packager: Microsoft <[email protected]>
license: Apache 2.0
sources:
golang:
ref: docker-image://golang:1.21
path: /usr/local/go

src:
ref: context://
filters:
Expand All @@ -37,17 +33,21 @@ sources:
env:
GOMODCACHE: /build/gomodcache

dependencies:
build:
golang:

build:
env:
GOPROXY: direct
CGO_ENABLED: 0
GOGC: off
GOFLAGS: -trimpath
GOPATH: /go
GOROOT: /usr/lib/golang
steps:
- command: |
export GOMODCACHE="$(pwd)/gomodcache"
GOROOT=/usr/lib/golang
cd src
go build -o ../frontend ./cmd/frontend
Expand Down
22 changes: 22 additions & 0 deletions test/fixtures/http-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# syntax=ghcr.io/azure/dalec/frontend:latest

name: dalec-test-fixutre-sources
description: A test fixture for checking build sources
website: https://www.github.com/Azure/dalec
version: 0.0.1
revision: 1
vendor: Microsoft

packager: Microsoft <[email protected]>
license: Apache 2.0
sources:
readme:
ref: https://raw.githubusercontent.com/moby/buildkit/2677a22857c917168730fe69ad617a50e0d85202/README.md
SOMEOTHERNAME.md:
ref: https://raw.githubusercontent.com/moby/buildkit/2677a22857c917168730fe69ad617a50e0d85202/README.md

build:
steps:
- command: |
[ -f readme ]
[ -f SOMEOTHERNAME.md ]
2 changes: 1 addition & 1 deletion test/fixtures/nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license: Apache 2.0
noarch: true
sources:
src:
ref: build://context://frontend/mariner2/test/fixtures/nested
ref: build://context://test/fixtures/nested
build:
inline: |
# syntax=docker/dockerfile:1.5
Expand Down

0 comments on commit 246f7b1

Please sign in to comment.