Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multiple .locks in bass --bump, + backwards compat. fixes #226

Merged
merged 8 commits into from
Aug 8, 2022
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
55 changes: 34 additions & 21 deletions bass/bass.bass
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,28 @@
($ go mod download))))

(provide [build smoke-test tests docs coverage]
(defn dist [src version os arch]
(subpath
(with-deps-and-shims
($ make
(str "VERSION=" version)
(str "GOOS=" os)
(str "GOARCH=" arch)
"DESTDIR=./dist/"
install)
src)
./dist/))

; compiles a bass binary for the given platform and puts it in an archive
(defn build [src version os arch]
(let [staged (with-shims
($ make
(str "VERSION=" version)
(str "GOOS=" os)
(str "GOARCH=" arch)
"DESTDIR=./dist/"
install)
src)]
(archive src staged/dist/ os arch)))

(defn with-shims [thunk src]
(archive src (dist src version os arch) os arch))

(defn with-deps-and-shims [thunk src]
(let [only-shim (subgit src ./pkg/runtimes/ship/ ./Makefile ./go.mod ./go.sum)
built (make-shims only-shim)]
built-shims (make-shims only-shim)]
(-> thunk
(with-mount src ./)
(with-mount built/pkg/runtimes/bin/ ./pkg/runtimes/bin/)
(with-mount built-shims/pkg/runtimes/bin/ ./pkg/runtimes/bin/)
(with-image (deps+go src)))))

; returns a thunk with the make targets built into the output directory, as
Expand Down Expand Up @@ -123,17 +127,26 @@
(map (fn [image] (check-dist dist image))
smoke-tests))

(defn with-deps [thunk src]
(-> thunk
(wrap-cmd ./hack/with-deps) ; TODO: maybe swap the order here
(with-shims src)
; runtime tests currently need elevated privileges
insecure!))
(def *buildkit-version* "v0.10.3")

(def buildkitd
(from (linux/moby/buildkit (string->symbol *buildkit-version*))
(-> ($ buildkitd --addr "tcp://0.0.0.0:6107")
(with-port :grpc 6107)
insecure!)))

(defn with-bass-and-buildkitd [thunk src]
(let [built-bass (dist src "dev" "linux" "amd64")]
(-> thunk
(with-env {:BUILDKIT_HOST (addr buildkitd :grpc "tcp://$host:$port")})
(with-mount built-bass/bass /bin/bass)
; TODO: would be nice to set this one var rather than replace them all
(with-deps-and-shims src))))

; returns a directory containing the built docs HTML
(defn docs [src]
(-> ($ ./docs/scripts/build)
(with-deps src)
(with-bass-and-buildkitd src)
(subpath ./docs/)))

; returns a thunk that runs the tests
Expand All @@ -144,7 +157,7 @@
-coverprofile ./cover.out
-covermode count
& $testflags)
(with-deps src)))
(with-bass-and-buildkitd src)))

; returns a thunk that will run the tests and return cover.html
(defn coverage [src testflags]
Expand Down
208 changes: 184 additions & 24 deletions bass/bass.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ memos: {
}
output: {
object: {
bindings: {
symbol: "repository"
value: {
string: {
value: "alpine/git"
}
}
}
bindings: {
symbol: "platform"
value: {
Expand All @@ -65,14 +73,6 @@ memos: {
}
}
}
bindings: {
symbol: "repository"
value: {
string: {
value: "alpine/git"
}
}
}
bindings: {
symbol: "tag"
value: {
Expand All @@ -85,7 +85,7 @@ memos: {
symbol: "digest"
value: {
string: {
value: "sha256:23dcd3edfd1d9c7cbb14f7823d07a4934716cfa4d4dbc402d37ee011c440a685"
value: "sha256:760aaf0d59c93f87572ec40dee1efd10a7ea13a78dff1f59a904e908449329ae"
}
}
}
Expand Down Expand Up @@ -134,6 +134,14 @@ memos: {
}
output: {
object: {
bindings: {
symbol: "repository"
value: {
string: {
value: "ubuntu"
}
}
}
bindings: {
symbol: "platform"
value: {
Expand All @@ -149,14 +157,6 @@ memos: {
}
}
}
bindings: {
symbol: "repository"
value: {
string: {
value: "ubuntu"
}
}
}
bindings: {
symbol: "tag"
value: {
Expand All @@ -169,7 +169,7 @@ memos: {
symbol: "digest"
value: {
string: {
value: "sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac"
value: "sha256:34fea4f31bf187bc915536831fd0afc9d214755bf700b5cdb1336c82516d154e"
}
}
}
Expand Down Expand Up @@ -218,6 +218,14 @@ memos: {
}
output: {
object: {
bindings: {
symbol: "repository"
value: {
string: {
value: "alpine"
}
}
}
bindings: {
symbol: "platform"
value: {
Expand All @@ -233,27 +241,103 @@ memos: {
}
}
}
bindings: {
symbol: "tag"
value: {
string: {
value: "latest"
}
}
}
bindings: {
symbol: "digest"
value: {
string: {
value: "sha256:7580ece7963bfa863801466c0a488f11c86f85d9988051a9f9c68cb27f6b7872"
}
}
}
}
}
}
results: {
input: {
array: {
values: {
object: {
bindings: {
symbol: "platform"
value: {
object: {
bindings: {
symbol: "os"
value: {
string: {
value: "linux"
}
}
}
}
}
}
bindings: {
symbol: "repository"
value: {
string: {
value: "moby/buildkit"
}
}
}
bindings: {
symbol: "tag"
value: {
string: {
value: "v0.10.3"
}
}
}
}
}
}
}
output: {
object: {
bindings: {
symbol: "repository"
value: {
string: {
value: "alpine"
value: "moby/buildkit"
}
}
}
bindings: {
symbol: "platform"
value: {
object: {
bindings: {
symbol: "os"
value: {
string: {
value: "linux"
}
}
}
}
}
}
bindings: {
symbol: "tag"
value: {
string: {
value: "latest"
value: "v0.10.3"
}
}
}
bindings: {
symbol: "digest"
value: {
string: {
value: "sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c"
value: "sha256:0dc312b04eac1b44cd2cad566deb1e886c753109208affbbec8384f381ff7f38"
}
}
}
Expand Down Expand Up @@ -332,7 +416,7 @@ memos: {
}
output: {
string: {
value: "b3109bfbd35fd036bb53872e5d96efbe4e70d63c"
value: "d04ee56d1947e0f7b1178f98915be6cfab1f6198"
}
}
}
Expand All @@ -353,7 +437,7 @@ memos: {
}
output: {
string: {
value: "287efdc670dfa5a0b830dba24213e20cb1afe199"
value: "c6c74c982a0b14ecd50a1a35c2f7ebbb33ad4cab"
}
}
}
Expand Down Expand Up @@ -429,7 +513,83 @@ memos: {
}
output: {
string: {
value: "b3109bfbd35fd036bb53872e5d96efbe4e70d63c"
value: "d04ee56d1947e0f7b1178f98915be6cfab1f6198"
}
}
}
}
}
memos: {
module: {
cmd: {
command: {
name: "git"
}
}
stdin: {
object: {
bindings: {
symbol: "repository"
value: {
string: {
value: "alpine/git"
}
}
}
bindings: {
symbol: "platform"
value: {
object: {
bindings: {
symbol: "os"
value: {
string: {
value: "linux"
}
}
}
}
}
}
bindings: {
symbol: "tag"
value: {
string: {
value: "latest"
}
}
}
bindings: {
symbol: "digest"
value: {
string: {
value: "sha256:760aaf0d59c93f87572ec40dee1efd10a7ea13a78dff1f59a904e908449329ae"
}
}
}
}
}
}
calls: {
binding: "ls-remote"
results: {
input: {
array: {
values: {
string: {
value: "https://github.com/vito/tabs"
}
}
values: {
string: {
value: "main"
}
}
}
}
output: {
string: {
value: "d04ee56d1947e0f7b1178f98915be6cfab1f6198"
}
}
}
Expand Down
Loading