Commit graph

50 commits

Author SHA1 Message Date
Gerald Pinder
33bebb5e29 fix: Parse Version from container and remove ostree commit 2025-05-31 00:45:23 -04:00
Gerald Pinder
0b28f40131 chore: Disable legacy integration test 2025-05-20 19:35:25 -04:00
Gerald Pinder
0896907c0b chore(tests): Add extra test recipes 2025-05-09 16:58:51 -04:00
Gerald Pinder
0f4621ca66 chore: Rework the workflows to make it easier to manage 2025-05-02 16:24:52 -04:00
Gerald Pinder
db9bf78c94 Add prompt for sudo 2025-03-23 17:25:06 -04:00
Gerald Pinder
5ba3061faf Temp comment out akmods 2025-03-23 17:25:06 -04:00
Gerald Pinder
7dc9c7e0c1 fix: Allow user to not install Nushell in their system 2025-02-25 08:08:09 -05:00
Gerald Pinder
2d150e3c93 feat: Support versioned modules 2025-01-05 13:33:11 -05:00
Gerald Pinder
74bd05643f feat: Add support for NuShell scripts 2025-01-05 13:31:29 -05:00
Gerald Pinder
2069eb513a chore: Prepare for the v0.9.0 release 2024-12-03 03:49:37 -05:00
Gerald Pinder
b4fbac2a66 feat(rechunk): Add the ability to rechunk an image 2024-12-02 02:23:22 -05:00
Gerald Pinder
2b7305c5d0 fix: Add logic for inspecting multi-manifest images 2024-11-26 21:21:26 -05:00
Gerald Pinder
816a6a5ddd fix(tests): Fix integration tests 2024-11-26 16:07:54 -05:00
Gerald Pinder
f2a4123e0b fix: Export get_json_array bash function 2024-11-25 22:18:21 -05:00
Gerald Pinder
367359e8ea
fix: Better support distrobox (#160)
We will now have a dedicated alpine based `distrobox` image. Due to
restrictions in how the `/tmp` directory in a `distrobox` image works,
it will not play nicely with generating a local tarball for rebasing a
locally built image. Going further into fixing this would required a
rootful setup and I'd rather leave the `distrobox` method as an easy way
to try out building a recipe for users who are not booted on a
`bluebuild` image.

Extra packages are installed to make the `distrobox` setup quicker and a
`distrobox.ini` file is provided to easily create the container and
export the CLI for use on the host machine. The `podman` binary is
passed into the `distrobox` container so that all images that are built
will be accessible locally and allows rootless operation without extra
setup.
2024-11-24 11:50:38 -05:00
Gerald Pinder
918da22952
feat(init): Add the new/init subcommands (#85) 2024-11-14 20:15:12 -05:00
Gerald Pinder
1481fba40a feat: Use yaml-rust2 to get line numbers for better errors 2024-11-04 07:10:09 -05:00
Gerald Pinder
9a3ad0ae17 feat: Add validation command 2024-10-30 18:08:50 -04:00
Gerald Pinder
c0414bed30 chore: Remove akmod that no longer exists in integration tests 2024-10-11 21:56:48 -04:00
Gerald Pinder
32092195d3
chore: Cleanup workflows to be run from just (#238) 2024-10-07 16:34:36 -04:00
Gerald Pinder
4ff66744c4 chore: Remove akmods module for arm64 build 2024-10-06 12:45:48 -04:00
Gerald Pinder
3d393ce18a chore: Fix akmods tests 2024-10-06 11:25:56 -04:00
Gerald Pinder
75eae89e4a feat: Add platform arg to force building a specific architecture 2024-10-03 14:47:47 -04:00
Gerald Pinder
75a00ddb90 chore: Fix legacy integration tests 2024-09-02 13:12:47 -04:00
Gerald Pinder
8ce83ba7ff
refactor: Create SigningDriver and CiDriver (#197)
This also includes a new `login` command. The signing and CI logic is now using the Driver trait system along with a new experimental sigstore signing driver. New static macros have also been created to make implementation management easier for `Command` usage and `Driver` trait implementation calls.

---------

Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
2024-08-12 23:52:07 -04:00
Gerald Pinder
7481ac1825 chore: Fix integration tests failing 2024-07-24 15:18:49 -04:00
Gerald Pinder
1d3e4e075e chore: Move files for test-repo to work with new files module update 2024-07-24 14:33:33 -04:00
Gerald Pinder
1a348f8137 chore: Stop using secureblue for integration testing
This would occasionally cause tests to fail cause SecureBlue would rightfully make changes to their code. We shouldn't be relying on this anymore as it was a crutch to lean on when we were first starting this project
2024-06-30 16:57:11 -04:00
Gerald Pinder
4ca98c1c2a
feat(experimental): Build multiple recipes in parallel (#182)
The `build` subcommand can now take in any number of recipe files and
will build them all in parallel. Along with this new ability, I've added
a way to easily distinguish which part of the build log belongs to which
recipe. Check out the `docker_build` action of this PR for an example.


![gif](https://gitlab.com/wunker-bunker/wunker-os/-/raw/main/bluebuild.gif)

## Tasks

- [x] Make build log follow same pattern as normal logs to keep things
consistent
- [x] Update color ranges based on @xynydev 's feedback
- [x] Deal with ANSI control characters in log output
- [x] Add [`indicatif`](https://crates.io/crates/indicatif) to make logs
look nicer
- [x] Add ability to print logs to a file
2024-06-07 17:52:26 -04:00
Gerald Pinder
02b2fe5434
refactor!: Rename template to generate and move rebase/upgrade under switch (#116)
This updates the `template` subcommand to be `generate`. The `template`
usage will continue to work as an alias to `generate`. A new `switch`
command is added that will manage both `rpm-ostree rebase` and
`rpm-ostree upgrade` and is fully replacing the respective subcommands
as a breaking change.

The new `switch` command is under the feature flag `switch` and will
currently only build for the `main` branch builds until it is moved as a
default feature (`v0.9.0`).

Closes #159
2024-05-26 22:47:34 -04:00
Gerald Pinder
8069006c03
feat: Stages (#173)
## Stages

A new property (`stages`) is being added to the recipe file schema. This
property will allow users to define a list of Containerfile stages each
with their own modules. Stages can be used to compile programs, perform
parallel operations, and copy the results into the final image without
contaminating the final image.

### Module Support

Currently the only modules that work out-of-the-box are `copy`,
`script`, `files`, and `containerfile`. Other modules are dependent on
the programs installed on the image. In order to better support some of
our essential modules, a setup script is ran at the start of each stage
that is not `scratch`. This script will install `curl`, `wget`, `bash`,
and `grep` and use the package manager for the detected distributions.

At this time, the following distributions are supported:

- Debian
- Ubuntu
- Fedora
- Alpine

Contributions to increase the size of this list is
[welcome](https://github.com/blue-build/cli)!

### Syntax

- **Required**
- `from` - The full image ref (image name + tag). This will be set in
the `FROM` statement of the stage.
- `name` - The name of the stage. This is used when referencing the
stage when using the `from:` property in the `copy` module.
- `modules` - The list of modules to execute. The exact same syntax used
by the main recipe `modules:` property.
- **Optional**
- `shell` - Allows a user to pass in an array of strings that are passed
directly into the [`SHELL`
instruction](https://docs.docker.com/reference/dockerfile/#shell).

#### Example

```yaml
stages:
- name: ubuntu-test
  from: ubuntu
  modules:
  - type: files
    files:
    - usr: /usr
  - type: script
    scripts:
    - example.sh
    snippets:
    - echo "test" > /test.txt
  - type: test-module
  - type: containerfile
    containerfiles:
    - labels
    snippets:
    - RUN echo "This is a snippet"
```

### Tasks
- [x] `from-file:` - Allows the user to store their stages in a separate
file so it can be included in multiple recipes
- [x] `no-cache:` - This will be useful for stages that want to pull the
latest changes from a git repo and not have to rely on the base image
getting an update for the build to be triggered again.
- [x] Add setup script to be able to install necessary programs to run
`bluebuild` modules in stages
- [x] Check for circular dependencies and error out

## `copy` module

This is a 1-1 for the [`COPY`
instruction](https://docs.docker.com/reference/dockerfile/#copy). It has
the ability to copy files between stages, making this a very important
addition to complete functionality for the stages feature. Each use of
this "module" will become its own layer.

### Decision to use `--link`

We use the `--link`
[option](https://docs.docker.com/reference/dockerfile/#benefits-of-using---link)
which allows that layer to have the same hash if the files haven't
changed regardless of if the previous instructions have changed. This
allows these layers to not have to be re-downloaded on the user's
computer if the copied files haven't changed.

### Syntax

- **Required**
- `src` - The source directory/file from the repo OR when `from:` is set
the image/stage that is specified.
  - `dest` - The destination directory/file inside the working image.
- **Optional**
  - `from` - The stage/image to copy from.

#### Example

```yaml
modules:
- type: copy
  from: ubuntu-test
  src: /test.txt
  dest: /
```

### Tasks
- [x] make `from:` optional
- [x] Add README.md and module.yml

## Feature gating

Gating this feature until we release for `v0.9.0`. The plan will be to
build all features (including this one) for main branch builds. This
means that these features will be available when using the `main` image
and consequently the `use_unstable_cli:` option on the GitHub Action.
All future `v0.9.0` features will be gated as well to allow for patches
to `v0.8`.

### Tasks
- [x] Build `--all-features` on non-tagged builds
- [x] Add stages and copy features
2024-05-18 13:23:50 +00:00
Gerald Pinder
abedf4fc6b
fix: Use leniency for semver parsing (#184) 2024-05-16 20:15:14 -04:00
Gerald Pinder
ad7a0f075e chore: Allow tests to pass due to upstream akmods issues 2024-05-05 00:09:09 -04:00
Gerald Pinder
6c940ea8cd
feat: Add alternate tags for user images (#172)
This adds the ability for the user to add alternate tags to their
images. These are designed to replace the `latest` and timestamp (e.g.
`20240429`) tags.
2024-04-30 09:51:05 -04:00
Gerald Pinder
0b5e7599f8 fix: Fix flatpak module errors 2024-04-28 18:56:11 -04:00
Gerald Pinder
3898202bc3
fix: Pull extra akmods image too (#169)
Adds the new `-extra` image from akmods image
2024-04-27 15:01:06 -04:00
Gerald Pinder
71a3bda3c3
chore: Update akmods module to account for upstream changes (#165)
This change updates the akmods module to pull the new nvidia images. The
new property will be a boolean with property name of `nvidia`. If a user
continues to use the old `nvidia-version` property, a warning will be
printed telling them to switch to the new property. The old images will
still be allowed to be used to support backwards compatibility.
2024-04-20 13:00:38 -04:00
Gerald Pinder
ff05976917
fix: Add test for rpm-ostree rebase (#161)
Adding this so that we can make sure that `rpm-ostree rebase` tests the
arguments passed in.
2024-04-14 22:59:32 -04:00
Gerald Pinder
f8b7334662
feat: Look for recipes in ./recipes/, build files in ./files/, and Containerfiles in ./containerfiles/ (#157)
Recipe files can now be put into their own directory `./recipes/`. This
directory is NEVER copied into the build so changes to a recipe will no
longer cause cache misses for builds. Here is an example of my build
changing the second to last module and only requiring the last 2 `RUN`
layers to be run again.

```
 => CACHED [stage-config 1/1] COPY ./config /config                                                                                                       0.0s
 => CACHED [stage-modules 1/2] COPY --from=ghcr.io/blue-build/modules:latest /modules /modules                                                            0.0s
 => CACHED [stage-modules 2/2] COPY ./modules /modules                                                                                                    0.0s
 => CACHED [stage-keys 1/1] COPY cosign.pub /keys/jp-desktop-gaming.pub                                                                                   0.0s
 => CACHED [stage-4  2/16] RUN --mount=type=bind,from=stage-keys,src=/keys,dst=/tmp/keys   mkdir -p /usr/etc/pki/containers/   && cp /tmp/keys/* /usr/et  0.0s
 => CACHED [stage-bins 1/3] COPY --from=gcr.io/projectsigstore/cosign /ko-app/cosign /bins/cosign                                                         0.0s
 => CACHED [stage-bins 2/3] COPY --from=docker.io/mikefarah/yq /usr/bin/yq /bins/yq                                                                       0.0s
 => CACHED [stage-bins 3/3] COPY --from=ghcr.io/blue-build/cli:main-installer /out/bluebuild /bins/bluebuild                                              0.0s
 => CACHED [stage-4  3/16] RUN --mount=type=bind,from=stage-bins,src=/bins,dst=/tmp/bins   mkdir -p /usr/bin/   && cp /tmp/bins/* /usr/bin/   && ostree   0.0s
 => CACHED [stage-4  4/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4  5/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4  6/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4  7/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4  8/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4  9/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4 10/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4 11/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4 12/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4 13/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => CACHED [stage-4 14/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind  0.0s
 => [stage-4 15/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind,from=  33.4s
 => [stage-4 16/16] RUN   --mount=type=tmpfs,target=/var   --mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw   --mount=type=bind,from=s  0.7s
```

Support was also added to put all build files into `./files/` instead of
`./config/`. This is an all or nothing operation, meaning if there
exists a directory of `files` then the `config` directory will be
completely ignored. Work will have to be done in
https://github.com/blue-build/modules to allow users to put their files
directly in `./files/` and not `./files/files` for the `files` module or
`./files/scripts` for the scripts module.

Support was also added to move the `./config/containerfiles/` directory
to the root of the project. Now the directories you can find in the root
of projects are:

```
files/
containerfiles/
recipes/
```
2024-04-13 19:08:31 +00: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
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
5fc4096f0f
chore: Add version checks for upstream tools (#121) 2024-03-17 14:14:07 -04: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
de49037330
fix: Remove check for specific branches for signing (#114) 2024-03-05 09:18:43 -05:00
Gerald Pinder
2c8776d2f2
chore: Add integration test for disableuserns.sh (#104) 2024-03-02 15:09:21 -05:00
Gerald Pinder
0ba78fab32
refactor: Update build command to use BuildStrategy (#88) 2024-03-01 11:18:02 -06:00
Gerald Pinder
5bf3dd3939
fix: Add Nvidia Version to main base case (#107) 2024-02-28 17:35:32 -06:00
Gerald Pinder
8931a22e29
feat: Allow use of akmods module (#71)
The akmods module require having the /rpms directory put into /tmp/rpms.
By default we will mount the akmods image with the `main-{{ os_version
}}` tag.

If a user supplies `base` for the akmods module in their recipe, it will
pull that image tag instead and mount the resulting /rpms.

```yaml
modules:
- type: akmods
  base: surface
  install:
  - openrazer
```

This would pull the image `ghcr.io/ublue-os/akmods:surface-39`.

A user can also supply `nvidia-version` with the numerical version of
the driver you would like to use. Doing so will mount the appropriate
`akmods-nvidia` image with the version of the driver you want in the
tag.

```yaml
modules:
- type: akmods
  nvidia-version: 545
  install:
  - nvidia
```

This would pull the image `ghcr.io/ublue-os/akmods-nvidia:main-39-545`
and `ghcr.io/ublue-os/akmods:main-39`.

This uses bind mount like all the other modules so these files will not
persist into the final image.
2024-02-22 18:41:45 +00:00
Gerald Pinder
2a85c2732b chore: Fix integration-tests for forks 2024-02-19 20:52:20 -05:00
Gerald Pinder
46700ab794
chore: Create base integration test setup (#55)
This will allow us to create a suite of tests for our new features
rather than using my personal image repo
2024-02-09 11:47:59 -05:00