Skip to content

Commit

Permalink
attest: remove flavors (#64)
Browse files Browse the repository at this point in the history
* ci: Removed flavors from artifacts, we will only use runtime detection.

* Removed prod feature from orb-attest
  • Loading branch information
TheButlah committed Apr 5, 2024
1 parent 46cb086 commit c3d2ccd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 47 deletions.
4 changes: 0 additions & 4 deletions orb-attest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ serial_test = "2.0"
tempfile = "3.3"
wiremock = "0.5"

[features]
default = []
prod = [] # use prod backend

[package.metadata.deb]
maintainer-scripts = "debian/"
systemd-units = [
Expand Down
12 changes: 2 additions & 10 deletions orb-attest/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::env;

use eyre;
use tracing::warn;
use eyre::{self, bail};

const ORB_BACKEND_ENV_VAR_NAME: &str = "ORB_BACKEND";

Expand Down Expand Up @@ -38,10 +37,7 @@ pub enum Backend {
Staging,
}

#[cfg(feature = "prod")]
const DEFAULT_BACKEND: Backend = Backend::Prod;
#[cfg(not(feature = "prod"))]
const DEFAULT_BACKEND: Backend = Backend::Staging;

impl Default for Backend {
fn default() -> Self {
Expand All @@ -63,11 +59,7 @@ impl Backend {
"prod" => Ok(Backend::Prod),
"stage" | "dev" => Ok(Backend::Staging),
_ => {
warn!(
"{ORB_BACKEND_ENV_VAR_NAME} is set to an unexpected value {v}, falling back \
to default {DEFAULT_BACKEND:?}"
);
eyre::bail!("invalid backend");
bail!("unknown value for backend");
}
}
}
Expand Down
55 changes: 22 additions & 33 deletions scripts/build_rust_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,34 @@ def main():

args = parser.parse_args()

flavors = ["prod", "stage"]
targets = ["aarch64", "x86_64"]

targets_option = " ".join([f"--target {t}-unknown-linux-gnu" for t in targets])
print(f"TARGETS={targets_option}")

for f in flavors:
if f == "prod":
features = ""
elif f == "stage":
features = "--features stage"
else:
print("Unexpected flavor")
sys.exit(1)

print(f"Building flavor={f}")
cmd(
f"cargo zigbuild --all "
f"--profile {args.cargo_profile} "
f"{targets_option} "
f"--no-default-features {features}"
)
cmd(
f"cargo zigbuild --all "
f"--profile {args.cargo_profile} "
f"{targets_option} "
f"--no-default-features"
)

for b in args.crates:
os.makedirs(os.path.join(args.out_dir, b), exist_ok=True)
print(f"Creating .deb package for {b}:")
for t in targets:
cmd(
f"cargo deb --no-build --no-strip "
f"--profile {args.cargo_profile} "
f"-p {b} "
f"--target {t}-unknown-linux-gnu "
f"-o {args.out_dir}/{b}/{b}_{f}_{t}.deb"
)
cmd(
f"cp -L "
f"target/{t}-unknown-linux-gnu/{args.cargo_profile}/{b} "
f"{args.out_dir}/{b}/{b}_{f}_{t}"
)
for b in args.crates:
os.makedirs(os.path.join(args.out_dir, b), exist_ok=True)
print(f"Creating .deb package for {b}:")
for t in targets:
cmd(
f"cargo deb --no-build --no-strip "
f"--profile {args.cargo_profile} "
f"-p {b} "
f"--target {t}-unknown-linux-gnu "
f"-o {args.out_dir}/{b}/{b}_{t}.deb"
)
cmd(
f"cp -L "
f"target/{t}-unknown-linux-gnu/{args.cargo_profile}/{b} "
f"{args.out_dir}/{b}/{b}_{t}"
)


if __name__ == "__main__":
Expand Down

0 comments on commit c3d2ccd

Please sign in to comment.