Skip to content

Commit

Permalink
chore: Switch to using my new proc_macro comlexr
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpinder committed Jan 12, 2025
1 parent 796ff48 commit c513d69
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 347 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,6 @@ jobs:

- uses: sigstore/cosign-installer@v3.3.0

- name: Setup Podman
shell: bash
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt-get update
sudo apt-get install -y podman
- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions/checkout@v4
Expand Down Expand Up @@ -446,18 +434,6 @@ jobs:

- uses: sigstore/cosign-installer@v3.3.0

- name: Setup Buildah
shell: bash
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt-get update
sudo apt-get install -y buildah
- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions/checkout@v4
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,18 +507,6 @@ jobs:

- uses: sigstore/cosign-installer@v3.3.0

- name: Setup Podman
shell: bash
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt-get update
sudo apt-get install -y podman
- uses: actions-rust-lang/setup-rust-toolchain@v1

# Setup repo and add caching
Expand Down Expand Up @@ -554,18 +542,6 @@ jobs:

- uses: sigstore/cosign-installer@v3.3.0

- name: Setup Podman
shell: bash
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt-get update
sudo apt-get install -y buildah
- uses: actions-rust-lang/setup-rust-toolchain@v1

# Setup repo and add caching
Expand Down
24 changes: 20 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ categories = ["command-line-utilities"]
version = "0.9.2"

[workspace.dependencies]
bon = "2"
bon = "3"
cached = "0.53"
chrono = "0.4"
clap = "4"
colored = "2"
comlexr = "1"
indexmap = { version = "2", features = ["serde"] }
indicatif = { version = "0.17", features = ["improved_unicode"] }
log = "0.4"
Expand Down Expand Up @@ -84,6 +85,7 @@ yaml-rust2 = { version = "0.9", optional = true }
cached.workspace = true
clap = { workspace = true, features = ["derive", "cargo", "unicode", "env"] }
colored.workspace = true
comlexr.workspace = true
indexmap.workspace = true
indicatif.workspace = true
log.workspace = true
Expand Down
1 change: 1 addition & 0 deletions process/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cached.workspace = true
chrono.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
colored.workspace = true
comlexr.workspace = true
indicatif.workspace = true
indexmap.workspace = true
log.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion process/drivers/buildah_driver.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::{io::Write, process::Stdio};

use blue_build_utils::{cmd, credentials::Credentials};
use blue_build_utils::credentials::Credentials;
use colored::Colorize;
use comlexr::cmd;
use log::{debug, error, info, trace};
use miette::{bail, miette, IntoDiagnostic, Result};
use semver::Version;
Expand Down
47 changes: 25 additions & 22 deletions process/drivers/cosign_driver.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{fmt::Debug, fs, io::Write, path::Path, process::Stdio};

use blue_build_utils::{
cmd,
constants::{COSIGN_PASSWORD, COSIGN_PUB_PATH, COSIGN_YES},
credentials::Credentials,
};
use colored::Colorize;
use comlexr::cmd;
use log::{debug, trace};
use miette::{bail, miette, Context, IntoDiagnostic, Result};

Expand All @@ -27,10 +27,13 @@ impl SigningDriver for CosignDriver {
let mut command = cmd!(
"cosign",
"generate-key-pair",
COSIGN_PASSWORD => "",
COSIGN_YES => "true",
// COSIGN_PASSWORD => "",
// COSIGN_YES => "true",
);
command.current_dir(path);
command
.current_dir(path)
.env(COSIGN_PASSWORD, "")
.env(COSIGN_YES, "true");

let status = command.status().into_diagnostic()?;

Expand All @@ -49,9 +52,10 @@ impl SigningDriver for CosignDriver {
"cosign",
"public-key",
format!("--key={priv_key}"),
COSIGN_PASSWORD => "",
COSIGN_YES => "true",
// COSIGN_PASSWORD => "",
// COSIGN_YES => "true",
);
command.env(COSIGN_PASSWORD, "").env(COSIGN_YES, "true");

trace!("{command:?}");
let output = command.output().into_diagnostic()?;
Expand Down Expand Up @@ -93,10 +97,11 @@ impl SigningDriver for CosignDriver {
username,
"--password-stdin",
registry,
stdin = Stdio::piped(),
stdout = Stdio::piped(),
stderr = Stdio::piped(),
);
command
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());

trace!("{command:?}");
let mut child = command.spawn().into_diagnostic()?;
Expand Down Expand Up @@ -135,9 +140,10 @@ impl SigningDriver for CosignDriver {
if let Some(ref key) = opts.key => format!("--key={key}"),
"--recursive",
opts.image.to_string(),
COSIGN_PASSWORD => "",
COSIGN_YES => "true",
// COSIGN_PASSWORD => "",
// COSIGN_YES => "true",
);
command.env(COSIGN_PASSWORD, "").env(COSIGN_YES, "true");

trace!("{command:?}");
if !command.status().into_diagnostic()?.success() {
Expand All @@ -151,17 +157,14 @@ impl SigningDriver for CosignDriver {
let mut command = cmd!(
"cosign",
"verify",
|c| {
match &opts.verify_type {
VerifyType::File(path) => cmd!(c, format!("--key={}", path.display())),
VerifyType::Keyless { issuer, identity } => cmd!(
c,
"--certificate-identity-regexp",
identity as &str,
"--certificate-oidc-issuer",
issuer as &str,
),
};
match &opts.verify_type {
VerifyType::File(path) => format!("--key={}", path.display()),
VerifyType::Keyless { issuer, identity } => [
"--certificate-identity-regexp",
&**identity,
"--certificate-oidc-issuer",
&**issuer,
],
},
opts.image.to_string(),
);
Expand Down
Loading

0 comments on commit c513d69

Please sign in to comment.