Commit graph

82 commits

Author SHA1 Message Date
Gerald Pinder
910e0434b6
refactor: Move templates to their own crate (#83)
This PR logically separates out parts of the code to their own crates. This will be useful for future Tauri App development.
2024-02-25 14:45:33 -06:00
Gerald Pinder
4c8a8f7aa8
refactor: Move modules into their own directory structure (#80)
This separates out the module template logic so that it is easier to
undertstand what each section does. This will also allow creating in
repo documentation for any special modules that don't use a bash base.
2024-02-24 07:16:30 +00:00
Hikari
0b4e1003a2
feat: add retry options to cli build command (#81)
An issue was filed for adding retry logic to our push_image command in
the CLI. https://github.com/blue-build/cli/issues/79.

This PR adds:
- **retry flag**
  - `-r`
  - defaults to true 
- **retry_count flag**
  - `--retry_count`
  - defaults to 1

This functionality will be extended to our other services in build
(podman api as well once that is hooked up), but this is the initial
ground work

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-24 04:53:50 +00:00
qoijjj
681aab4a85
fix: allow empty custom modules dir (#77)
Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-22 15:49:45 -05: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
Hikari
ee2a834b28
feat: block overriding (#74)
This PR helps transition users who may not realize that we override
their Containefile.

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-21 23:34:28 +00:00
Gerald Pinder
84de477635 fix: Use GH_TOKEN as GITHUB_TOKEN is a protected env var 2024-02-20 20:57:59 -05:00
Gerald Pinder
54742ecaa1
refactor: Use GITHUB_TOKEN instead of REGISTRY_TOKEN (#75)
To keep things as consistent as possible, we're switching to using the
GITHUB_TOKEN env var for login instead. Env vars were also all pulled
out into their own constants to make things more consistent.

This change also includes prioritizing public/private key signing over
OIDC keyless for GitHub for an easier transition. It would require the
user to delete their `cosign.pub` file from their repo in order to start
using the keyless method.
2024-02-19 23:30:39 -05:00
Gerald Pinder
0012eadef7 chore: Add trace log for github cosign verify 2024-02-19 15:04:13 -05:00
Gerald Pinder
16ffbb343f fix: Switch to using --certificate-identity-regexp for Github Keyless verification 2024-02-19 14:22:26 -05:00
Gerald Pinder
b087474cf2 fix: Use REGISTRY_TOKEN for GitHub OIDC signing 2024-02-19 13:48:08 -05:00
gerblesh
498deb6f37
fix: check for GITHUB_TOKEN instead of SIGSTORE_ID_TOKEN for github OIDC (#72)
the `SIGSTORE_ID_TOKEN` env var is not declared inside of github
actions, however the block that does OIDC signing requires it, this
changes it so that it matches for `GITHUB_TOKEN` in the second block
instead of `SIGSTORE_ID_TOKEN`, (hopefully) using OIDC instead of pubkey
auth
2024-02-19 02:45:34 +00:00
Gerald Pinder
93b40f8d73
feat: Allow user to use source images (#69) 2024-02-18 10:24:37 -06:00
Gerald Pinder
98398788f7
feat(podman-api): Clean up working container for SIGINT and SIGTERM (#14)
Co-authored-by: Hikaru (ひかる, ヒカル) <lecoqjacob@gmail.com>
2024-02-14 15:04:47 -06:00
Gerald Pinder
4fde628f82 fix: Make sure cosign.pub exists before trying to check key validity 2024-02-14 12:36:14 -05:00
Gerald Pinder
f22823a4c2 chore: Print out stderr from login attempts if login fails 2024-02-14 11:45:17 -05:00
Gerald Pinder
9b93713527
feat: Use GitHub's OIDC for signing images (#62)
This change will follow the patter that was established with the GitLab
pipeline. Users will be able to have their images signed by GitHub's
OIDC. This will allow users to rebase directly onto a signed image and
forego using the siging module.
2024-02-14 01:43:47 +00:00
Gerald Pinder
d973f330cb
feat: Alias update for upgrade subcommand (#60)
Co-authored-by: Hikari <lecoqjacob@gmail.com>
2024-02-13 04:40:39 +00:00
Gerald Pinder
fec33d8c98 chore: Rename registry-path arg to registry-namespace but keep previous as alias 2024-02-12 20:32:26 -05:00
Gerald Pinder
6b4c86f01f refactor: Enable clippy nursery lint 2024-02-10 15:32:20 -05:00
Hikari
0d8fd93917
feat: snippets (#51)
## Goals

This PR adds snippets which is being discussed in #41 .

It will generate snippet lines for *ONLY* our containerfile module

- [x] allow for modules to specify snippets
- [x] append snippets to module run inside Containerfile
- [ ] write supporting test

## Preview
Recipe.yml

```yml
# image will be published to ghcr.io/<user>/<name>
name: orora

description: A starting point for further customization of uBlue images. Make your own! https://ublue.it/making-your-own/

base-image: ghcr.io/ublue-os/silverblue-main
image-version: latest # latest is also supported if you want new updates ASAP

modules:
  - type: signing
    snippets:
      - COPY --from=ghcr.io/blue-build/cli:latest-installer /out/BLUEBUILD /usr/bin/BLUEBUILD
```

Generated Container File snippet

```docker
RUN chmod +x /tmp/modules/signing/signing.sh && source /tmp/exports.sh && /tmp/modules/signing/signing.sh '{"type":"signing","snippets":["COPY --from=ghcr.io/blue-build/cli:latest-installer /out/BLUEBUILD /usr/bin/BLUEBUILD"]}'
COPY --from=ghcr.io/blue-build/cli:latest-installer /out/BLUEBUILD /usr/bin/BLUEBUILD
```

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-07 18:03:26 +00:00
Hikari
2492bb0eee
refactor!: rename bb to bluebuild (#50) 2024-02-06 19:55:38 -05:00
Gerald Pinder
c47f80232b chore: Switch back to crate format_serde_error 2024-02-05 22:01:47 -05:00
Gerald Pinder
245ddf032a Merge branch '40-refactor-clean-standard-implementation-of-cli-modules' 2024-02-05 21:35:50 -05:00
Gerald Pinder
d302875020 chore: Update README to show github action use 2024-02-05 20:52:36 -05:00
Gerald Pinder
aab4c0038f
fix: Lowecase registry and update IMAGE_REGISTRY arg (#49) 2024-02-05 18:45:09 -05:00
Gerald Pinder
96b680e4e7 refactor: Separate modules into individual templates 2024-02-04 22:23:22 -05:00
Hikari
8f44bf4ea0
fix: output better serde::yaml errors (#47)
Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-04 21:50:00 -05:00
Hikari
59c3cf55bd
fix: Update containerfile to check for presence of cosign.pub (#46)
Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-02-04 20:25:26 -06:00
Gerald Pinder
d7885ded63
feat: Allow default recipe path (#45) 2024-02-04 12:45:20 -06:00
Gerald Pinder
a1751f2f94
fix: Add missing container tags (#37) 2024-02-03 14:09:36 -06:00
Gerald Pinder
7f38fb04e6
feat: Use COPY syntax for files module (#38) 2024-02-03 14:42:42 -05:00
Gerald Pinder
3d56b029af fix: Change local build dir to /etc/bluebuild 2024-02-01 09:55:27 -05:00
Hikari
e069346e15
feat: Bugreport command (#28)
Add a bug report + completions command(not complete yet) so that new
users can easily submit bugs to us, and I wanted completions for bb
(super easy with clap)

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-01-31 09:51:13 -05:00
Gerald Pinder
bdbbcea7cc
refactor: Separate module template from recipe module (#32) 2024-01-28 19:36:20 -06:00
Gerald Pinder
331b91df35
chore: Enable Clippy Pedantic lint (#19) 2024-01-27 13:03:16 -06:00
Gerald Pinder
c32a0604ce
chore: Move recipe out to its own module (#18) 2024-01-27 11:22:30 -06:00
Gerald Pinder
c832bcd1aa
fix: Rebase path not being generated properly (#8)
* fix: Rebase path not being generated properly

* consolidate logic into generate_full_image_name

* Fix nightly build
2024-01-22 17:48:14 -05:00
N16hth4wk
dbbd087b5b
feat: run clippy + BlueBuildTrait (#4)
* feat: run clippy + BlueBuildTrait

* chore: add default run impl; more clippy

* chore: remove vscode folder; not needed

* cleanups

* Move to commands.rs

* Move functions; remove run function implementation from each command

* Remove run impl from init commands

* Use error log

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2024-01-21 22:26:35 -05:00
Gerald Pinder
e325d5d3a1 fix: Allow single module from-file 2024-01-21 19:25:05 -05:00
Gerald Pinder
b547a326fd feat!: Upgrade and Rebase commands 2024-01-21 23:23:36 +00:00
Gerald Pinder
1b950b08dc nightly(podman-api): Use podman-api crate for building images 2024-01-19 18:55:26 +00:00
Gerald Pinder
754b4516e7 feat!: remove containerfile arg since we use compiled time templates 2024-01-13 22:19:50 -05:00
Gerald Pinder
150aee028b fix: conflicting short args for build subcommand 2024-01-13 22:04:35 -05:00
Gerald Pinder
eaeb79f329 feat: Local image rebasing 2024-01-14 03:02:35 +00:00
Gerald Pinder
ebd399e960 fix: removed unwrap from template to handle with proper error message 2024-01-04 00:10:01 -05:00
Gerald Pinder
d663b7574b refactor: Use askama crate for compile-time template type checking 2024-01-03 23:39:57 -05:00
Gerald Pinder
938ddae891 refactor: inefficiency in generated Containerfile 2024-01-01 18:38:39 +00:00
Gerald Pinder
7dd3a8f0f9 fix: clippy error for image_tag 2024-01-01 12:33:34 -05:00
Gerald Pinder
ca95e3296d fix: Allow image_version to be a String 2024-01-01 12:31:35 -05:00