Skip to content

Commit

Permalink
Remove bramblescript (#11)
Browse files Browse the repository at this point in the history
* more cli commands, lock file, bramble metadata file

* sort env vars

* better starlark parse cache storage strategy, actually copy and hash source files

* fix depedency detection, add file methods, prep for gc implementation

* gc

* run tests twice, check for determinism

* building some packages and the resulting fixes

* start work on std

* more cleanup

* fix printf

* run all functions as part of a test, urls are in lockfile

* wip rewrite of derivation computation and building

* continued wip derivation refactor

* wip refsactor continues

* derivation refactor turned into a native function builder refactor

* more restructuring

* fix cmd tests and other bramble tests

* race fixes

* progressui

* fix test

* strings lint fix

* print hash content

* make null arrays consistent in json output

* handful of fixes, actually close files

* remove race

* add race detector back for most tests

* more general improvements

* fix cmd tests

* output rewriting complete

* make bramble test recursive

* update derivation hash

* wip

* sessions exist, get simple to work with imported functions

* docker

* tests running locally

* copy linux binary into tests

* cleanup logs

* docker for regular builder

* fix hash rewrite error, don't rewrite paths for docker context

* update simple test to actually run the command

* docs, use starlark fork, lint fix

* beginning of import fixes

* more import fixes

* reorg notes folder

* git patchelf bug with go

* wip

* more docker permissions fiddling

* messy but working

* cmd permissions

* remove lchown

* hash volume name

* remove bramblescripts until we can support them better

* remove autoconf

* don't try and use autoconf during the build

* add tracing

* cleanup, no more file writing in the os module

* more examples, more session removal

* remove global session

* clear_env no longer exists

* fix build time

* immutable sessions

* more fixes

* autoconf fix

* add more bramble tests

* wip git, start of tutorial

* replace cli with ffcli

* just merge

* sandboxing

* better sandbox abstractions, bramble compiles again

* simple running in sandbox

* final before fork

* removing bramblescript

* fix tests

* remove relative dependency, more cleanup

* pass username to sandbox

* log username in github action

Former-commit-id: 61ce8e9
  • Loading branch information
maxmcd authored Mar 1, 2021
1 parent f4a269a commit 06e4adb
Show file tree
Hide file tree
Showing 105 changed files with 7,007 additions and 2,425 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ignore = F821 # ignore all unused variables becuase of load() function
max-line-length = 100 # black's default
builtins =
derivation,
load
load,
files
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bramble linguist-language=python
8 changes: 7 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Run all tests
run: make test
run: |
id -u
id -u -n
echo $USER
make test
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ brambles
*.gz
.vscode
.idea
*.prof
trace.out
85 changes: 70 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,89 @@


seed_run:
go run . run seed:seed

simple_run:
go run . run tests/simple/simple:simple

seed/linux-x86_64-seed.tar.gz:
./seed/build.sh

test: go_test bramblescripts_to_test seed_run simple_run drv_test
test: seed go_test \
simple drv_test bramble_tests \
test_integration

go_test:
go test -v ./...
go_test: install
go test -race -v ./...
go test -run="(TestIntegration|TestRunAlmostAllPublicFunctions)"unique -v ./...

install:
# just use LICENSE as a file we can harmlessly "touch" and use as a cache marker
LICENSE: main.go pkg/*/*.go
go install
touch LICENSE

install: LICENSE build_setuid

bramble_tests: install
bramble test ./tests
bramble test

docker_reptar: ## Used to compare reptar output to gnutar
cd pkg/reptar && docker build -t reptar . \
&& docker run -it reptar sh

bramblescripts_to_test: install
bramble run pkg/bramble/cmd-examples:main

drv_test: install
bramble test tests/derivation_test.bramble

starlark_builder: install
bramble run tests/starlark-builder:run_busybox
touch_file: install
bramble run lib/busybox:touch_file

simple: install
bramble run tests/simple/simple:simple

simple2: install
bramble run tests/simple/simple:simple2

nested: install
bramble run tests/nested-sources/another-folder/nested:nested

ldd: install
bramble run lib/seed:ldd

bramble: install
bramble

repl: install
bramble repl

gc: install
bramble gc

go: install
bramble run lib/go:go

delete_store:
rm -rf ~/bramble

test_integration: install
go test -v -run=TestIntegration ./pkg/bramble/

nix_seed: install
bramble run lib/nix-seed:stdenv

seed: install
bramble run lib/seed:seed

all_bramble: install
bramble run all:all

install_reptar:
cd pkg/reptar/reptar && go install

busybox_sh: install
bramble run ./tests/busybox:busybox

build_setuid:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -tags netgo -ldflags '-w' ./pkg/cmd/bramble-setuid
sudo chown root:root ./bramble-setuid
sudo chmod u+s,g+s ./bramble-setuid
rm -f $$(go env GOPATH)/bin/bramble-setuid || true
mv ./bramble-setuid $$(go env GOPATH)/bin

run_thorn: build_thorn
go run ./pkg/cmd/thorn
Binary file removed __pycache__/__init__.cpython-37.pyc
Binary file not shown.
17 changes: 17 additions & 0 deletions all.bramble
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Run a handful of functions
"""

load("github.com/maxmcd/bramble/lib/seed")
load("github.com/maxmcd/bramble/tests/simple/simple")
load("github.com/maxmcd/bramble/lib")
load("github.com/maxmcd/bramble/tests/nested-sources/another-folder/nested")


def all():
return [
seed.seed(),
lib.busybox(),
nested.nested(),
simple.simple(),
]
12 changes: 12 additions & 0 deletions bramble.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[URLHashes]
"http://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz" = "d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb"
"http://tarballs.nixos.org/stdenv-linux/x86_64/c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31/bootstrap-tools.tar.xz" = "a5ce9c155ed09397614646c9717fc7cd94b1023d7b76b618d409e4fefd6e9d39"
"https://brmbl.s3.amazonaws.com/autoconf.tar.gz" = "1fed660ab8588418d8a2bf8fa86ab9b51f6323dd3870cb07452b8099696259db"
"https://brmbl.s3.amazonaws.com/busybox-x86_64.tar.gz" = "2ae410370b8e9113968ffa6e52f38eea7f17df5f436bd6a69cc41c6ca01541a1"
"https://brmbl.s3.amazonaws.com/file-links.tar.gz" = "22fadd82e935b2f081ba07ab9a9c7ce174d10c237cc95182c4ed14c8c276e06a"
"https://brmbl.s3.amazonaws.com/patchelf.tar.gz" = "67ee6623207754a18d81624d630d9addbf6234ab1e6c44ddba9179621720f960"
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz" = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
"https://ftp.gnu.org/gnu/make/make-4.2.tar.gz" = "e968ce3c57ad39a593a92339e23eb148af6296b9f40aa453a9a9202c99d34436"
"https://github.com/maxmcd/bramble/releases/download/v0.0.1/linux-x86_64-seed.tar.gz" = "111005a76fa66c148799a8fb67fb784ac47944fcba791efe7599128bbd5884ac"
"https://github.com/ziglang/zig/releases/download/0.6.0/zig-linux-x86_64-0.6.0.tar.xz" = "08fd3c757963630645441c2772362e9c2294020c44f14fce1b89f45de0dc1253"
"https://golang.org/dl/go1.15.3.linux-amd64.tar.gz" = "010a88df924a81ec21b293b5da8f9b11c176d27c0ee3962dc1738d2352d3c02d"
34 changes: 25 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
module github.com/maxmcd/bramble

go 1.14
go 1.15

require (
github.com/BurntSushi/toml v0.3.1
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
github.com/alecthomas/colour v0.1.0 // indirect
github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c // indirect
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054
github.com/containerd/console v1.0.0
github.com/davecgh/go-spew v1.1.1
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/fsouza/go-dockerclient v1.6.5
github.com/go-git/go-git/v5 v5.2.0
github.com/hashicorp/terraform v0.14.4
github.com/imdario/mergo v0.3.11 // indirect
github.com/jaguilar/vt100 v0.0.0-20201024211400-81de19cb81a4
github.com/maxmcd/gosh v0.2.1-0.20210228220323-59420ac4567a
github.com/mholt/archiver/v3 v3.3.1-0.20200626164424-d44471c49aa7
github.com/mitchellh/cli v1.1.1
github.com/moby/moby v1.13.1
github.com/morikuni/aec v1.0.0
github.com/peterbourgon/ff/v3 v3.0.0
github.com/pkg/errors v0.9.1
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.6.0
github.com/posener/complete/v2 v2.0.1-alpha.13
github.com/stretchr/testify v1.6.1
go.starlark.net v0.0.0-20200821142938-949cc6f4b097
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
go.starlark.net v0.0.0-20200901195727-6e684ef5eeee
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/sys v0.0.0-20201029080932-201ba4db2418
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
google.golang.org/grpc v1.34.0 // indirect
)

replace (
github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305
github.com/mholt/archiver/v3 => github.com/maxmcd/archiver/v3 v3.3.2-0.20200926140316-5fd9d38b8b8b
go.starlark.net => github.com/maxmcd/starlark-go v0.0.0-20201021154825-b2f805d0d122
)
Loading

0 comments on commit 06e4adb

Please sign in to comment.