fix: Update containerfile to check for presence of cosign.pub (#46)

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
This commit is contained in:
Hikari 2024-02-04 20:25:26 -06:00 committed by GitHub
parent d7885ded63
commit 59c3cf55bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 11 deletions

View file

@ -20,13 +20,13 @@ colorized = "1"
derive_builder = "0.13"
directories = "5"
env_logger = "0.11"
format_serde_error = "0.3.0"
futures-util = { version = "0.3", optional = true }
fuzzy-matcher = "0.3"
indexmap = { version = "2", features = ["serde"] }
log = "0.4"
open = "5"
# update os module config and tests when upgrading os_info
shadow-rs = { version = "0.26" }
os_info = "3.7"
podman-api = { version = "0.10.0", optional = true }
process_control = { version = "4.0.3", features = ["crossbeam-channel"] }
@ -34,13 +34,13 @@ requestty = { version = "0.5", features = ["macros", "termion"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9.30"
shadow-rs = { version = "0.26" }
sigstore = { version = "0.8.0", optional = true }
tokio = { version = "1", features = ["full"], optional = true }
typed-builder = "0.18.1"
urlencoding = "2.1.3"
users = "0.11.0"
which = "6"
format_serde_error = "0.3.0"
[features]
default = []

View file

@ -1,5 +1,5 @@
use std::{
env, fs,
fs,
path::{Path, PathBuf},
process,
};
@ -11,7 +11,7 @@ use log::{debug, error, info, trace};
use typed_builder::TypedBuilder;
use crate::{
constants::RECIPE_PATH,
constants::{self},
module_recipe::{Module, ModuleExt, Recipe},
};
@ -58,7 +58,7 @@ impl BlueBuildCommand for TemplateCommand {
"Templating for recipe at {}",
self.recipe
.clone()
.unwrap_or_else(|| PathBuf::from(RECIPE_PATH))
.unwrap_or_else(|| PathBuf::from(constants::RECIPE_PATH))
.display()
);
@ -73,7 +73,7 @@ impl TemplateCommand {
let recipe_path = self
.recipe
.clone()
.unwrap_or_else(|| PathBuf::from(RECIPE_PATH));
.unwrap_or_else(|| PathBuf::from(constants::RECIPE_PATH));
debug!("Deserializing recipe");
let recipe_de = Recipe::parse(&recipe_path)?;
@ -126,9 +126,11 @@ fn print_script(script_contents: &ExportsTemplate) -> String {
)
}
fn running_gitlab_actions() -> bool {
trace!(" running_gitlab_actions()");
env::var("GITHUB_ACTIONS").is_ok_and(|e| e == "true")
fn has_cosign_file() -> bool {
trace!("has_cosign_file()");
std::env::current_dir()
.map(|p| p.join(constants::COSIGN_PATH).exists())
.unwrap_or(false)
}
#[must_use]

View file

@ -46,6 +46,7 @@ pub struct Recipe<'a> {
}
impl<'a> Recipe<'a> {
#[must_use]
pub fn generate_tags(&self) -> Vec<String> {
trace!("Recipe::generate_tags()");
trace!("Generating image tags for {}", &self.name);
@ -231,7 +232,7 @@ impl ImageInspection {
self.labels
.get("org.opencontainers.image.version")?
.as_str()
.map(|v| v.to_string())?
.map(std::string::ToString::to_string)?
.split('.')
.take(1)
.collect(),

View file

@ -6,7 +6,7 @@ LABEL io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-
LABEL io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4
ARG RECIPE={{ recipe_path.display() }}
{%- if self::running_gitlab_actions() %}
{%- if self::has_cosign_file() %}
ARG IMAGE_REGISTRY=ghcr.io/ublue-os
COPY cosign.pub /usr/share/ublue-os/cosign.pub
{%- endif %}