Commit graph

394 commits

Author SHA1 Message Date
Gerald Pinder
e66e880857
chore: Cleanup images and use hash for exports tag (#158)
I noticed that making changes to the exports script before a release
could cause modules to not build properly if breaking changes got pushed
out. To prevent this, I'm making it so that the hash of the commit is
put in the tag for the exports script image and that the CLI tool will
use that hash when building the `Containerfile`.
2024-04-13 05:55:50 +00:00
Gerald Pinder
b5cca98676 chore: Put LABELS last since they cause cache miss with buildah 2024-04-11 17:21:22 -04:00
Gerald Pinder
6e3a193e92
feat: Squash builds (#155)
### Buildah/Podman support

Buildah and podman can make heavy use of the squash feature. Something
that I've noticed when trying to build from inside of a container,
requiring intermediate layers with mounts causes build times to
skyrocket. Build times are much faster when using the `--squash`
functionality (seen as `--layers=false`).

Here are the following results from my personal build using both squash
and non-squash functionality.

#### Squash upgrade:

```
$> rpm-ostree upgrade
Pulling manifest: ostree-image-signed:docker://registry.gitlab.com/wunker-bunker/wunker-os/jp-laptop
Importing: ostree-image-signed:docker://registry.gitlab.com/wunker-bunker/wunker-os/jp-laptop (digest: sha256:60f743ba322041918d302e7e7f10438c59502e19343c294064bacb676c8eb7b7)
ostree chunk layers already present: 65
custom layers already present: 3
custom layers needed: 1 (814.0 MB)
```

All changes appear to show as a single custom layer. Any small change
even at the end of the build appears to require completely downloading
the new layer (squash only squashes additional layers on top of the base
layer). This makes sense as layers cannot currently be downloaded by
diff.

#### Non-squash upgrade:

```
$> rpm-ostree upgrade
Pulling manifest: ostree-image-signed:docker://registry.gitlab.com/wunker-bunker/wunker-os/jp-desktop-gaming:latest
Importing: ostree-image-signed:docker://registry.gitlab.com/wunker-bunker/wunker-os/jp-desktop-gaming:latest (digest: sha256:0658b51febfcbaa1722961b7a6d2b197d3823a6228e330f45dd1e1aaefd145c5)
ostree chunk layers already present: 65
custom layers already present: 4
custom layers needed: 15 (942.4 MB)
```

As expected, there are more layers when not squashing and the size is
slightly bigger. Most likely due to there being extra information stored
in the layers that is subsequently removed.

### Docker support

Docker is apparently [no longer
supporting](https://github.com/docker/buildx/issues/1287) the use of the
`--squash` arg. The use of squash will not be available for the docker
driver in this case.
2024-04-11 19:15:30 +00:00
Gerald Pinder
e9c96e204d
feat: Add driver selection args (#153)
There are 2 new args available that allow the user to specify which
program to use for building and inspecting images. If the user doesn't
provide an argument, the tool will determine which program to use like
it has been.

Help text:

```
Build an image from a recipe

Usage: bluebuild build [OPTIONS] [RECIPE]

Arguments:
  [RECIPE]
          The recipe file to build an image

Options:
  -p, --push
          Push the image with all the tags.

          Requires `--registry`, `--username`, and `--password` if not building in CI.

  -c, --compression-format <COMPRESSION_FORMAT>
          The compression format the images will be pushed in

          [default: gzip]
          [possible values: gzip, zstd]

  -n, --no-retry-push
          Block `bluebuild` from retrying to push the image

      --retry-count <RETRY_COUNT>
          The number of times to retry pushing the image

          [default: 1]

  -f, --force
          Allow `bluebuild` to overwrite an existing Containerfile without confirmation.

          This is not needed if the Containerfile is in .gitignore or has already been built by `bluebuild`.

  -a, --archive <ARCHIVE>
          Archives the built image into a tarfile in the specified directory

      --registry <REGISTRY>
          The registry's domain name

  -v, --verbose...
          Increase logging verbosity

  -q, --quiet...
          Decrease logging verbosity

      --registry-namespace <REGISTRY_NAMESPACE>
          The url path to your base project images

          [aliases: registry-path]

  -U, --username <USERNAME>
          The username to login to the container registry

  -P, --password <PASSWORD>
          The password to login to the container registry

  -B, --build-driver <BUILD_DRIVER>
          Select which driver to use to build your image

          [possible values: buildah, podman, docker]

  -I, --inspect-driver <INSPECT_DRIVER>
          Select which driver to use to inspect images

          [possible values: skopeo, podman, docker]

  -h, --help
          Print help (see a summary with '-h')
```
2024-04-07 22:15:33 -04:00
Gerald Pinder
0f76b16369 chore: Remove unused files module 2024-04-05 16:43:49 -04:00
Gerald Pinder
05980ee82d fix: Use proper image URI for local rebasing 2024-04-01 17:27:04 -04:00
Michael Haaf
d5f0332d7c
README: add alpine distrobox and shell completions (#149)
A few more tips/tricks I wrote for
https://github.com/blue-build/website/pull/45 that make more sense in
the README
2024-03-31 13:07:58 -04:00
Jordan Pryde
1074a54672
fix: Sign all images in manifest (#148)
Resolves #147

`cosign sign` only signs the provided digest by default. If that digest
is a manifest which is currently the default for images built with
Docker due to
https://docs.docker.com/build/attestations/attestation-storage/, we also
want to sign each image with `--recursive` so that they can be pulled by
any container managers which enforce that (e.g. podman).

Refer to https://github.com/sigstore/cosign/blob/main/doc/cosign_sign.md
for more details.

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-03-29 19:54:37 -04:00
Michael Haaf
47abb2bf4c
docs: add distrobox installation tips (#146)
I had initially added distrobox installation instructions to the website
(see [here](https://github.com/blue-build/website/pull/45), but it has
been suggested that the CLI readme is a more natural place for them.

I have tested the distrobox installation method and procedures on my
home machine and aside from an odd bug (see
https://github.com/blue-build/cli/issues/145) everything is working.
2024-03-29 19:10:01 -04:00
xyny
fcc012bed7
chore: add MODULE_DIRECTORY env var (#142)
This exists in the legacy template:

489ebea77b/build.sh (L13C1-L13C39)

And is also used in many modules, though with
`MODULE_DIRECTORY="${MODULE_DIRECTORY:-"/tmp/modules"}"` to not break
things.

And is documented on the website, because I assumed it existed:
https://blue-build.org/reference/module/#module_directory

I know this probably won't change much, but it's still useful for the
scripts.
2024-03-29 14:06:15 -04:00
Gerald Pinder
8050ce73ee chore: Release 2024-03-27 19:46:03 -04:00
Gerald Pinder
e3ca95dd2f fix: Pulling wrong exports image 2024-03-27 17:50:06 -04:00
Gerald Pinder
1af517e7c6 fix: Remove docker syntax marker 2024-03-27 17:06:46 -04:00
Gerald Pinder
b544fecc25 chore: Fix build.yml 2024-03-27 00:34:39 -04:00
Gerald Pinder
198886c799 chore: Use tag exports instead 2024-03-27 00:33:31 -04:00
Gerald Pinder
72e961c572 chore: Add image source label for exports 2024-03-27 00:27:58 -04:00
Gerald Pinder
19c93ce742 fix: Put export script in own image
HEREDOC support for podman doesn't work exactly 1-1 with Dockerfiles. This fix gives the export script its own image that we mount.
2024-03-27 00:08:58 -04:00
Gerald Pinder
ae9c3ef83a fix: Unable to use SHELL with podman, encapsulate commands in /bin/bash -c 2024-03-26 22:02:41 -04:00
Gerald Pinder
189141924b
feat: Improve logging output (#139) 2024-03-26 12:23:10 -04:00
Gerald Pinder
ab11362a0d
fix: Allow user supplied registry to be set in the template (#135) 2024-03-25 20:27:34 -04:00
Gerald Pinder
2c98a7abc6 fix: Create dir for keys and bins in case they don't exist 2024-03-24 17:28:21 -04:00
Gerald Pinder
399ca604aa chore: Update gitlab-ci section in README 2024-03-24 14:05:42 -04:00
Gerald Pinder
5601a27491 chore: Don't use docker driver for buildx job on main 2024-03-24 11:23:02 -04:00
Gerald Pinder
b515dccd42 fix: Set gzip to default compression format
Turns out rpm-ostree doesn't quite support the new compression format yet.
2024-03-24 11:22:05 -04:00
Gerald Pinder
d0e1b7c8d1
fix: Copy bins and keys with mounts for ostree commit (#132)
I've been investigating more into how ostree works and how it relates to
running `ostree container commit` for each layer. I've decided to move
our pre-installed bins and public keys into their own stages and then
bind mount them into a `RUN` instruction so that we can just use `cp` to
get the files into the image and then call `ostree container commit`.
Now all of our layers in the image (after the base image) will be in the
ostree commit tree.
2024-03-24 06:27:54 +00:00
Gerald Pinder
783ac2c3fb chore: Enable cache builds on main branch 2024-03-23 18:33:34 -04:00
Gerald Pinder
dcfdacc518
feat: Support zstd compression (#134)
All supported versions of podman, buildah, and docker support the zstd
compression format. This format should allow users to pull less data
when updating their computers.
2024-03-23 17:32:21 -04:00
Gerald Pinder
da628db1ee chore: Remove builtin-podman code
This was not being worked on and was becoming too much trouble for our current goals
2024-03-23 15:54:15 -04:00
Gerald Pinder
aa1de26ad9
fix: Allow special characters for export script (#128) 2024-03-21 16:01:46 -04:00
Gerald Pinder
338b9c699e chore: Separate nightly build to not run in CI for now 2024-03-19 22:39:25 -04:00
Gerald Pinder
27dfdbc8a7 chore: Don't build nightly for now 2024-03-19 19:39:24 -04:00
Gerald Pinder
7c34d0c5a8
fix: Allow docker driver to properly use cache (#126)
This fix involves creating a new function for the `BuildDriver` trait
called `build_tag_push`. In order to get the proper logic in place to
make use of `docker buildx`, I had to create a separate function that
would construct the build command to include all of the tags necessary
for pushing. A default implementation of `build_tag_push` will be used
for `podman` and `buildah` which was originally from the build command's
functions. Now that we have custom logic for docker builds, we can take
advantage of using the GitHub cache features without having the `--load`
arg which had a big negative effect on build times. We can now also use
docker for creating local `oci-archive` tarballs for local rebasing.
Making use of the `oci-archive` will require the user to create a
`docker-container` builder as it is not supported on the standard
`docker` builder.

https://docs.docker.com/build/exporters/oci-docker/
2024-03-19 16:51:09 -04:00
Gerald Pinder
5fc4096f0f
chore: Add version checks for upstream tools (#121) 2024-03-17 14:14:07 -04:00
gerblesh
0e3d6eba9e
feat: revert to bash files module (#125)
https://github.com/blue-build/cli/issues/118#issuecomment-1992536977
as mentioned here reverting to the bash files module simplifies the
build process (and allows for better usage of `ostree container
commit`). It also means there are less overall layers and (ideally) a
smaller image as a result. Tested locally and template generation seems
to work just fine
2024-03-17 05:07:52 +00:00
Gerald Pinder
90d2d52ebc
fix: Remove tmpfs for /tmp (#123) 2024-03-17 00:38:18 -04:00
Gerald Pinder
8006af3ec9 refactor: Rename strategies to drivers
This will make the terms similar to the terms of the dependent tools i.e. docker.
2024-03-16 12:47:02 -04:00
Gerald Pinder
f619c4c47c chore: Fix readme path for containerfile module in module.yml 2024-03-16 11:38:06 -04:00
Gerald Pinder
1e3e579df1 chore: Adjust readme path in files module.yml 2024-03-16 11:28:59 -04:00
Gerald Pinder
a54b78c8dc refactor: Enable pedantic clippy lints
Updated files to comply with the new lint.
2024-03-12 18:07:46 -04:00
Hikari
580c3d6ce7
fix: use container skopeo (#110)
the `os_version` is defaulting to the `image_tag` inside containers and
causing our template to use latest tag

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-03-11 23:23:42 +00:00
Gerald Pinder
c084592934 fix: Checkout proper versions when building on main vs a PR 2024-03-11 19:16:30 -04:00
Gerald Pinder
bf6ce3f650 chore: Setup build concurrency to reduce number of simultaneous builds on a PR 2024-03-09 12:29:33 -05:00
Gerald Pinder
2cbc07a33d chore: Update workspace dependency versions 2024-03-08 19:43:28 -05:00
Gerald Pinder
8753e76eeb chore: Prepare for v0.8.2 release 2024-03-08 19:37:08 -05:00
Gerald Pinder
b169dbacbb chore: Update crates to have their own versions starting at CLI version 2024-03-08 19:32:39 -05:00
Gerald Pinder
50813926ad chore: Move cargo release settings to root Cargo.toml 2024-03-08 19:15:42 -05:00
Gerald Pinder
3a2353923d chore: Update builds to use different satellites and have integration tests on their own job 2024-03-06 15:08:16 -05:00
David McCrea
e1a0e3c6a4
fix: update path in comments and README (#115)
Co-authored-by: David McCrea <git@dmccrea.me>
2024-03-06 19:35:28 +00:00
Tulili
80958f60a6
feat: add flakehub entry + nix flake (#109)
Title! This PR should add a Flakehub entry and a Nix flake for this
project :>

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-03-05 21:34:29 +00:00
Gerald Pinder
de49037330
fix: Remove check for specific branches for signing (#114) 2024-03-05 09:18:43 -05:00