-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add (write)
, (publish)
, and (docker-build)
#270
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently this is its own special type of image, slotting in alongside OCI archive images, image refs, and thunks. So you don't 'build' a Dockerfile into a Thunk, you can just use it as an image. This will allow for far greater compatibility with the external world. Bass doesn't replace Dockerfiles; it's far too opinionated. Dockerfiles will probably exist until the end of time if not just as a language-neutral format for building images.
Bass Loop currently interprets your Bass script directly, so it doesn't have (docker-build) in its stdlib yet, but my local runtime will still understand its return value.
nevermind, still needed new changes to even be able to recognize the new ThunkImage variant. bumped bass-loop for now. This reverts commit 9a217a1.
+ add a panic for extra good measure, this is a sneaky one!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a bit of a hefty PR, since I was using these changes to refactor the Buildkit image building process, which is included in this PR.
The broad theme of these changes is to whittle away at scenarios where you have to fall back on Bash or other external tools, and to embrace compatibility with the goal of letting you use Bass for the end-to-end lifecycle of image building and publishing.
Add
(write)
for writing to diskThe first thing I noticed was I had an explosion of scripts involved in bumping Buildkit and building its image. I had Bass scripts that did "pure" things like emit a thunk or thunk path to stdout, and then Bash scripts that piped the exported to the filesystem.
The thought behind this was to keep Bass "sandboxed" so it's not able to write to the host filesystem. But dealing with these wrapper scripts is just way too painful.
Now it's possible to write to the host, with two safeguards:
HostDir
. You can't write to arbitrary paths.bass.Filesystem
abstraction. By default it uses the host filesystem, but something integrating with Bass (e.g. Bass Loop) can override it with a read-only or empty filesystem.HostPath
in the first place, but it's still nice to support sandboxing.In addition, writes are atomic. This makes it easy to pass a file to a command for processing and then
(write)
the result to the same file. Without atomic writes it would truncate the input before/while it's being processed, which is a common footgun in Bash.Add
(publish)
for pushing a thunk to a container registryAnother thing I relied on Bash wrappers for was pushing images to a container registry. Now you can just
(publish)
directly from Bass. No need to(export)
to disk and then pass toskopeo
ordocker
for pushing. Much faster!Add
(docker-build)
for building from DockerfilesYou can now build images using good old
Dockerfiles
. I needed this because I wanted to be able to use a fork of Buildkit by building from theDockerfile
in its repo.Currently this is its own special type of image, slotting in alongside OCI archive images, image refs, and thunks. So you don't 'build' a Dockerfile into a Thunk, you can just use it as an image.
This will allow for far greater compatibility with the external world. Bass doesn't replace Dockerfiles; it's far too opinionated. Dockerfiles will probably exist until the end of time if not just as a language-neutral format for building images.