Skip to content

Commit

Permalink
Revert "move the verify-libraries CI check into releng (#5779)"
Browse files Browse the repository at this point in the history
This reverts commit e0a1184.
  • Loading branch information
iliana committed Jun 28, 2024
1 parent 6850aa2 commit 028e2f9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 36 deletions.
13 changes: 13 additions & 0 deletions .github/buildomat/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ export RUSTC_BOOTSTRAP=1
# We report build progress to stderr, and the "--timings=json" output goes to stdout.
ptime -m cargo build -Z unstable-options --timings=json --workspace --tests --locked --verbose 1> "$OUTPUT_DIR/crate-build-timings.json"

# If we are running on illumos we want to verify that we are not requiring
# system libraries outside of specific binaries. If we encounter this situation
# we bail.
# NB: `cargo xtask verify-libraries` runs `cargo build --bins` to ensure it can
# check the final executables.
if [[ $target_os == "illumos" ]]; then
banner verify-libraries
# This has a separate timeout from `cargo nextest` since `timeout` expects
# to run an external command and therefore we cannot run bash functions or
# subshells.
ptime -m timeout 10m cargo xtask verify-libraries
fi

#
# We apply our own timeout to ensure that we get a normal failure on timeout
# rather than a buildomat timeout. See oxidecomputer/buildomat#8.
Expand Down
13 changes: 1 addition & 12 deletions dev-tools/releng/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,7 @@ async fn main() -> Result<()> {
jobs.select("host-image").after("host-profile");

stamp_packages!("tuf-stamp", Target::Host, TUF_PACKAGES)
.after("host-stamp")
.after("recovery-stamp");

// Run `cargo xtask verify-libraries --release`. (This was formerly run in
// the build-and-test Buildomat job, but this fits better here where we've
// already built most of the binaries.)
jobs.push_command(
"verify-libraries",
Command::new(&cargo).args(["xtask", "verify-libraries", "--release"]),
)
.after("host-package")
.after("recovery-package");
.after("host-stamp");

for (name, base_url) in [
("staging", "https://permslip-staging.corp.oxide.computer"),
Expand Down
4 changes: 2 additions & 2 deletions dev-tools/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum Cmds {
/// Verify we are not leaking library bindings outside of intended
/// crates
#[cfg(target_os = "illumos")]
VerifyLibraries(verify_libraries::Args),
VerifyLibraries,
/// Manage virtual hardware
#[cfg(target_os = "illumos")]
VirtualHardware(virtual_hardware::Args),
Expand Down Expand Up @@ -93,7 +93,7 @@ async fn main() -> Result<()> {
external.cargo_args(["--release"]).exec_bin("omicron-releng")
}
#[cfg(target_os = "illumos")]
Cmds::VerifyLibraries(args) => verify_libraries::run_cmd(args),
Cmds::VerifyLibraries => verify_libraries::run_cmd(),
#[cfg(target_os = "illumos")]
Cmds::VirtualHardware(args) => virtual_hardware::run_cmd(args),

Expand Down
27 changes: 5 additions & 22 deletions dev-tools/xtask/src/verify_libraries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use anyhow::{bail, Context, Result};
use camino::Utf8Path;
use cargo_metadata::Message;
use clap::Parser;
use fs_err as fs;
use serde::Deserialize;
use std::{
Expand All @@ -17,13 +16,6 @@ use swrite::{swriteln, SWrite};

use crate::load_workspace;

#[derive(Parser)]
pub struct Args {
/// Build in release mode
#[clap(long)]
release: bool,
}

#[derive(Deserialize, Debug)]
struct LibraryConfig {
binary_allow_list: Option<BTreeSet<String>>,
Expand Down Expand Up @@ -91,29 +83,20 @@ fn verify_executable(

Ok(())
}

pub fn run_cmd(args: Args) -> Result<()> {
pub fn run_cmd() -> Result<()> {
let metadata = load_workspace()?;
let mut config_path = metadata.workspace_root;
config_path.push(".cargo/xtask.toml");
let config = read_xtask_toml(&config_path)?;

let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());
let mut command = Command::new(cargo);
command.args([
"build",
"--bins",
"--message-format=json-render-diagnostics",
]);
if args.release {
command.arg("--release");
}
let mut child = command
let mut command = Command::new(cargo)
.args(["build", "--bins", "--message-format=json-render-diagnostics"])
.stdout(Stdio::piped())
.spawn()
.context("failed to spawn cargo build")?;

let reader = BufReader::new(child.stdout.take().context("take stdout")?);
let reader = BufReader::new(command.stdout.take().context("take stdout")?);

let mut errors = Default::default();
for message in cargo_metadata::Message::parse_stream(reader) {
Expand All @@ -125,7 +108,7 @@ pub fn run_cmd(args: Args) -> Result<()> {
}
}

let status = child.wait()?;
let status = command.wait()?;
if !status.success() {
bail!("Failed to execute cargo build successfully {}", status);
}
Expand Down

0 comments on commit 028e2f9

Please sign in to comment.