Commit graph

118 commits

Author SHA1 Message Date
dependabot[bot]
6e164eefd3 chore(deps): bump rinja from 0.3.4 to 0.3.5
Bumps [rinja](https://github.com/rinja-rs/rinja) from 0.3.4 to 0.3.5.
- [Release notes](https://github.com/rinja-rs/rinja/releases)
- [Commits](https://github.com/rinja-rs/rinja/compare/v0.3.4...v0.3.5)

---
updated-dependencies:
- dependency-name: rinja
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 16:33:36 -04:00
Gerald Pinder
9a3ad0ae17 feat: Add validation command 2024-10-30 18:08:50 -04:00
Gerald Pinder
ba5d6696f5 fix: Update copy Typespec to expect proper type 2024-10-13 19:06:50 -04:00
Gerald Pinder
32092195d3
chore: Cleanup workflows to be run from just (#238) 2024-10-07 16:34:36 -04:00
Gerald Pinder
7c5578994e chore: Release 2024-10-06 13:21:50 -04:00
Gerald Pinder
d2f3f6f756 chore: Release 2024-10-04 16:49:06 -04:00
Gerald Pinder
566380a82a chore: Release 2024-10-03 14:48:15 -04:00
Gerald Pinder
0c52cf6a54 refactor: Swtich to using bon for builder pattern 2024-09-21 18:42:28 -04:00
Gerald Pinder
de45aeb015 fix: Add post build script to prepare image for ISO creation 2024-09-16 16:19:00 -04:00
Gerald Pinder
fbf57e5c83 fix: Properly escape module json 2024-09-14 00:59:44 -04:00
Gerald Pinder
ce717118ce chore: Release 2024-09-11 19:05:44 -04:00
Gerald Pinder
199d975305 chore: Release 2024-09-08 10:26:17 -04:00
Gerald Pinder
d4b511ebdb chore: Release 2024-09-07 18:59:56 -04:00
Gerald Pinder
74d99f2b17 feat: Color output in terminal if running in TTY 2024-08-30 23:40:53 -04:00
Gerald Pinder
43dd4ef842 chore: Release 2024-08-25 14:10:13 -04:00
Gerald Pinder
e4ad31c047 chore: Release 2024-08-20 09:04:17 -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
7be5e00a31 chore: Release 2024-08-11 11:09:54 -04:00
Gerald Pinder
82606cc144 fix: allow copying keys to both /etc and /usr/etc 2024-08-10 22:11:52 -04:00
fiftydinar
bd75880a03
chore: Move files from /usr/etc/ to /etc/ in build-time (#214)
Take a look at this issue for more details:

https://github.com/blue-build/modules/issues/314

Idk if anything else needs to be done, please tell

Should be tested for regressions too
2024-08-08 17:11:27 +00:00
Gerald Pinder
6a97a52da4 chore: Switch from askama to rinja 2024-08-03 11:21:45 -04:00
xyny
f89fa3f159
fix: add typespec schemas for cli modules, remove modules.json (not needed anymore) (#209)
The website build process now uses the GitHub API to generate a global
`modules.json`. If you decide to move the directory containing all the
modules, please tell me, or make a PR changing [this
line](9eb198c4e5/astro.config.mjs (L102)).
If you don't, I'll find out anyways, because the website builds will
break.

Also, whenever updating the modules, make sure the schema is updated too
to match the current state of the module. If you need help with writing
[TypeSpec](https://typespec.io/), consult me, but you probably wont,
since it's just a type system kind of like TypeScript's or Rust's .
2024-07-27 10:31:52 -04:00
Gerald Pinder
d0d51d5aa0 chore: Capitalize AS 2024-06-21 21:08:43 -04:00
Gerald Pinder
4f235be4f7 chore: Release 2024-06-03 09:54:28 -04:00
Gerald Pinder
0b29929e93
fix: Fail if cosign private/public key can't be verified (#190) 2024-06-01 19:05:14 -04:00
Gerald Pinder
b2aff68741 chore: Release 2024-05-28 22:59:17 -04:00
Gerald Pinder
5dfae14c32
fix: Allow both files or config directory to not exist (#185) 2024-05-18 14:34:54 +00: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
8308e5b285 chore: Release 2024-05-16 20:39:06 -04:00
Gerald Pinder
eddbcb48f7 chore: Release 2024-05-14 10:14:54 -04:00
Gerald Pinder
5786ce40bf chore: Release 2024-05-05 01:18:08 -04:00
Gerald Pinder
cfc39817fc chore: Release 2024-04-28 21:56:24 -04:00
Gerald Pinder
fbbd2d220a chore: Release 2024-04-27 15:21:48 -04:00
Gerald Pinder
0c7033ccd2
feat: Move module run logic into its own script (#168)
This will help make the Containerfile just a little bit easier to read
(ignoring all the mounts lol). This would also allow us to add logic
later to support modules that run executables other than `*.sh`.
2024-04-27 15:19:58 -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
a7503d561e chore: Make more /var dirs 2024-04-24 23:35:33 -04:00
Gerald Pinder
2bf7c99aaf chore: Use Semver to grab OS version from image 2024-04-24 22:42:44 -04:00
Gerald Pinder
8f811200aa chore: Release 2024-04-22 16:50:07 -04:00
Gerald Pinder
c599138982 chore: Prepare justfile for release 2024-04-22 16:49:47 -04:00
Gerald Pinder
2c1d1b9473 fix: Remove /var tmpfs 2024-04-16 13:13:37 -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
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
0f76b16369 chore: Remove unused files module 2024-04-05 16:43:49 -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
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