Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ members = [
"obs-gitlab-runner"
]

[workspace.package]
version = "0.2.0"
edition = "2024"
license = "MIT OR Apache-2.0"

[workspace.dependencies]
async-trait = "0.1"
camino = "1.2"
Expand All @@ -16,9 +21,9 @@ clap = { version = "4.6", features = ["default", "derive", "env"] }
color-eyre = "0.6"
derivative = "2.2"
futures-util = "0.3"
open-build-service-api = "0.1.0"
open-build-service-api = { git = "https://github.com/collabora/open-build-service-rs" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a new release instead, don't use git versions

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned in the PR body

If collabora/open-build-service-rs#65 is merged first then I can change this to point to the new version instead of git.

# open-build-service-api = { path = "../open-build-service-rs/open-build-service-api" }
open-build-service-mock = "0.1.0"
open-build-service-mock = { git = "https://github.com/collabora/open-build-service-rs" }
# open-build-service-mock = { path = "../open-build-service-rs/open-build-service-mock" }
rstest = "0.26"
serde = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions obo-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "obo-cli"
description = "OBS Build Orchestrator — command-line frontend"
version = "0.1.8"
edition = "2024"
license = "MIT OR Apache-2.0"
version.workspace = true
edition.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
17 changes: 17 additions & 0 deletions obo-cli/tests/test_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ impl RunBuilder<'_> for CliRunBuilder {
self
}

fn saves<I: IntoIterator>(self, _patterns: I) -> Self
where
I::Item: AsRef<str>,
{
self
}

fn artifacts(mut self, artifacts: Self::ArtifactsHandle) -> Self {
self.dependencies.push(artifacts.0);
self
Expand Down Expand Up @@ -102,6 +109,14 @@ impl RunBuilder<'_> for CliRunBuilder {
.env("OBS_SERVER", self.obs_server)
.env("OBS_USER", TEST_USER)
.env("OBS_PASSWORD", TEST_PASS)
.env(
"OBO_LOG",
if should_enable_trace_logging() {
"obo_core=trace,obo_cli=trace"
} else {
""
},
)
.env("OBO_TEST_LOG_TAIL", MONITOR_TEST_LOG_TAIL.to_string())
.env("OBO_TEST_SLEEP_ON_BUILDING_MS", "0")
.env(
Expand Down Expand Up @@ -241,6 +256,7 @@ async fn test_monitor_table(
let generate = context
.run()
.command(generate_command)
.saves(&[DEFAULT_MONITOR_TABLE])
.artifacts(dput.clone())
.go()
.await;
Expand Down Expand Up @@ -271,6 +287,7 @@ async fn test_monitor_table(
build_info,
&enabled.repo_arch,
&script,
&[],
success,
dput_test,
log_test,
Expand Down
4 changes: 2 additions & 2 deletions obo-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "obo-core"
description = "OBS Build Orchestrator — core"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
edition.workspace = true
license.workspace = true

[dependencies]
async-trait.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions obo-test-support/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "obo-test-support"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
edition.workspace = true
license.workspace = true

[dependencies]
open-build-service-api.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions obo-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "obo-tests"
description = "OBS Build Orchestrator — shared tests for different frontends"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
edition.workspace = true
license.workspace = true

[dependencies]
async-trait.workspace = true
Expand Down
31 changes: 30 additions & 1 deletion obo-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ use obo_test_support::*;
use open_build_service_api as obs;
use open_build_service_mock::*;

pub fn should_enable_trace_logging() -> bool {
std::env::var_os("OBO_TEST_TRACE").is_some()
}

#[derive(Clone)]
pub struct ObsContext {
pub client: obs::Client,
Expand Down Expand Up @@ -51,6 +55,13 @@ pub trait RunBuilder<'context>: Send + Sync + Sized {
self.script(&[cmd.into()])
}

// Sets the patterns of files that will be saved by the given commands, so
// that implementations that need to list out saved artifacts like the
// gitlab runner can verify those lists are correct.
fn saves<I: IntoIterator>(self, _patterns: I) -> Self
Comment thread
refi64 marked this conversation as resolved.
where
I::Item: AsRef<str>;

fn script(self, cmd: &[String]) -> Self;
fn artifacts(self, artifacts: Self::ArtifactsHandle) -> Self;
fn timeout(self, timeout: Duration) -> Self;
Expand Down Expand Up @@ -179,6 +190,7 @@ pub async fn test_dput<C: TestContext>(
let dput = context
.run()
.command(dput_command.replace(dsc1_file, dsc1_bad_file))
.saves(&[DEFAULT_BUILD_INFO])
.artifacts(artifacts.clone())
.go()
.await;
Expand All @@ -197,6 +209,7 @@ pub async fn test_dput<C: TestContext>(
let mut dput = context
.run()
.command(&dput_command)
.saves(&[DEFAULT_BUILD_INFO])
.artifacts(artifacts.clone())
.go()
.await;
Expand Down Expand Up @@ -273,6 +286,7 @@ pub async fn test_dput<C: TestContext>(
dput = context
.run()
.command(&dput_command)
.saves(&[DEFAULT_BUILD_INFO])
.artifacts(artifacts.clone())
.go()
.await;
Expand All @@ -295,6 +309,7 @@ pub async fn test_dput<C: TestContext>(
dput = context
.run()
.command(format!("{dput_command} --rebuild-if-unchanged"))
.saves(&[DEFAULT_BUILD_INFO])
.artifacts(artifacts.clone())
.go()
.await;
Expand Down Expand Up @@ -399,6 +414,7 @@ pub async fn test_monitoring<C: TestContext>(
build_info: &ObsBuildInfo,
repo: &RepoArch,
script: &[String],
artifact_paths: &[String],
success: bool,
dput_test: DputTest,
log_test: MonitorLogTest,
Expand Down Expand Up @@ -504,6 +520,7 @@ pub async fn test_monitoring<C: TestContext>(
let monitor = context
.run()
.script(script)
.saves(artifact_paths)
.artifacts(dput.clone())
.timeout(MONITOR_TEST_OLD_STATUS_SLEEP_DURATION * 20)
.go()
Expand All @@ -529,7 +546,19 @@ pub async fn test_monitoring<C: TestContext>(
);

assert_eq!(
log.contains(&log_contents),
// If trace-level logging is enabled, and the implementation mixes
// together script output with the trace logs (i.e. the CLI), then our
// rather short test log *probably* ended up in the log output at some
// point. In that case, make sure to require a leading newline, so it
// should only match if the logs were explicitly printed on its own
// line(s) vs the debug/trace-level logs that have a header. (This is
// very janky, but it *only* applies in an explicitly opt-in case, so if
// anything actually breaks it's not a huge deal.)
if should_enable_trace_logging() {
log.contains(&format!("\n{log_contents}"))
} else {
log.contains(&log_contents)
},
!success && log_test == MonitorLogTest::Short
);

Expand Down
12 changes: 6 additions & 6 deletions obs-gitlab-runner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "obs-gitlab-runner"
version = "0.1.8"
edition = "2024"
license = "MIT OR Apache-2.0"
version.workspace = true
edition.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -13,7 +13,7 @@ clap.workspace = true
color-eyre.workspace = true
derivative.workspace = true
futures-util.workspace = true
gitlab-runner = "0.3.0"
gitlab-runner = "0.3.1"
Comment thread
refi64 marked this conversation as resolved.
# gitlab-runner = { path = "../../gitlab-runner-rs/gitlab-runner" }
obo-core = { path = "../obo-core" }
obo-test-support = { path = "../obo-test-support" }
Expand All @@ -35,8 +35,8 @@ url = "2.5"

[dev-dependencies]
claims.workspace = true
gitlab-runner-mock = "0.3.0"
# gitlab-runner-mock = { path = "../gitlab-runner-rs/gitlab-runner-mock" }
gitlab-runner-mock = "0.3.1"
# gitlab-runner-mock = { path = "../../gitlab-runner-rs/gitlab-runner-mock" }
obo-tests = { path = "../obo-tests" }
open-build-service-mock.workspace = true
rstest.workspace = true
Expand Down
Loading