Skip to content
Merged
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
3 changes: 2 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ open-build-service-mock = { git = "https://github.com/collabora/open-build-servi
# open-build-service-mock = { path = "../open-build-service-rs/open-build-service-api" }
rstest = "0.26"
serde = "1.0"
serde_json = "1.0.140"
serde_yaml = "0.9"
shell-words = "1.1"
tempfile = "3.20"
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ In order to connect to OBS, three variables must be set (generally within the
```bash
dput PROJECT DSC_FILE
[--branch-to BRANCHED_PROJECT]
[--build-info-out BUILD_INFO_FILE=build-info.yml]
[--build-info-out BUILD_INFO_FILE=build-info.json]
[--rebuild-if-unchanged]
```

Expand All @@ -92,7 +92,7 @@ within, will be removed.

Metadata information on the uploaded revision, such as the revision number,
project name, and package name, will be saved into the file specified by
`--build-info-out` (default is `build-info.yml`). This file is **required** by
`--build-info-out` (default is `build-info.json`). This file is **required** by
the `generate-monitor` and `prune` steps. Do note that, if `--branch-to` is
given, the file will be written *immediately* after the branch takes place (i.e.
before the upload); that way, if the upload fails, the branched project can still
Expand All @@ -109,7 +109,7 @@ testing builds on MRs; you can create an OBS branch named after the MR's Git
branch, and then builds can take place there without interfering with your main
projects.

##### `--build-info-out BUILD_INFO_FILE=build-info.yml`
##### `--build-info-out BUILD_INFO_FILE=build-info.json`

Changes the filename that the build info will be written to.

Expand All @@ -130,7 +130,7 @@ operation, there will *always* be a change to upload.
generate-monitor RUNNER_TAG
[--rules RULES]
[--download-build-results-to BUILD_RESULTS_DIR]
[--build-info BUILD_INFO_FILE=build-info.yml]
[--build-info BUILD_INFO_FILE=build-info.json]
[--pipeline-out PIPELINE_FILE=obs.yml]
[--job-prefix MONITOR_JOB_PREFIX=obs]
[--job-timeout MONITOR_JOB_TIMEOUT]
Expand Down Expand Up @@ -199,7 +199,7 @@ dput-and-generate:
After a monitoring job completes, download the build results from OBS to the
given `BUILD_RESULTS_DIR`, and upload it as a GitLab build artifact..

##### `--build-info BUILD_INFO_FILE=build-info.yml`
##### `--build-info BUILD_INFO_FILE=build-info.json`

Specifies the name of the build info file to read. In particular, if a different
build info filename was used with `dput` via
Expand Down Expand Up @@ -233,7 +233,7 @@ Changes the filename each monitoring job will save the build log into.

```bash
prune
[--build-info BUILD_INFO_FILE=build-info.yml]
[--build-info BUILD_INFO_FILE=build-info.json]
[--ignore-missing-build-info]
[--only-if-job-unsuccessful]
```
Expand All @@ -242,7 +242,7 @@ If a branch occurred, deletes the branched package and, if now empty, project,
using the information from the build info file. (If no branching occurred, this
does nothing.)

##### `--build-info BUILD_INFO_FILE=build-info.yml`
##### `--build-info BUILD_INFO_FILE=build-info.json`

Specifies the name of the build info file to read. In particular, if a different
build info filename was used with `dput` via
Expand Down
2 changes: 1 addition & 1 deletion obo-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open-build-service-api.workspace = true
reqwest = "0.12"
rfc822-like = "0.2"
serde.workspace = true
serde_yaml.workspace = true
serde_json.workspace = true
shell-words.workspace = true
tempfile.workspace = true
thiserror.workspace = true
Expand Down
17 changes: 7 additions & 10 deletions obo-core/src/actions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, io::SeekFrom};
use std::io::SeekFrom;

use camino::{Utf8Path, Utf8PathBuf};
use clap::{ArgAction, Parser};
Expand All @@ -11,18 +11,15 @@ use tracing::{debug, instrument};
use crate::{
artifacts::{ArtifactDirectory, ArtifactReader, ArtifactWriter, MissingArtifactToNone},
binaries::download_binaries,
build_meta::{
BuildHistoryRetrieval, BuildMeta, BuildMetaOptions, CommitBuildInfo, DisabledRepos,
RepoArch,
},
build_meta::{BuildHistoryRetrieval, BuildMeta, BuildMetaOptions, DisabledRepos, EnabledRepo},
monitor::{MonitoredPackage, ObsMonitor, PackageCompletion, PackageMonitoringOptions},
outputln,
prune::prune_branch,
retry_request,
upload::ObsDscUploader,
};

pub const DEFAULT_BUILD_INFO: &str = "build-info.yml";
pub const DEFAULT_BUILD_INFO: &str = "build-info.json";
pub const DEFAULT_BUILD_LOG: &str = "build.log";

// Our flags can all take explicit values, because it makes it easier to
Expand Down Expand Up @@ -155,7 +152,7 @@ pub struct ObsBuildInfo {
pub rev: Option<String>,
pub srcmd5: Option<String>,
pub is_branched: bool,
pub enabled_repos: HashMap<RepoArch, CommitBuildInfo>,
pub enabled_repos: Vec<EnabledRepo>,
}

impl ObsBuildInfo {
Expand All @@ -164,7 +161,7 @@ impl ObsBuildInfo {
artifacts
.save_with(path, async |file: &mut ArtifactWriter| {
let data =
serde_yaml::to_string(&self).wrap_err("Failed to serialize build info")?;
serde_json::to_string(&self).wrap_err("Failed to serialize build info")?;
file.write_all(data.as_bytes())
.await
.wrap_err("Failed to write build info file")?;
Expand Down Expand Up @@ -217,7 +214,7 @@ impl Actions {
rev: None,
srcmd5: None,
is_branched,
enabled_repos: HashMap::new(),
enabled_repos: vec![],
};
debug!("Saving initial build info: {:?}", build_info);
build_info
Expand Down Expand Up @@ -414,7 +411,7 @@ impl Actions {
artifacts.read_string(&args.build_info).await?
};

let build_info: ObsBuildInfo = serde_yaml::from_str(&build_info_data)
let build_info: ObsBuildInfo = serde_json::from_str(&build_info_data)
.wrap_err("Failed to parse provided build info file")?;

if build_info.is_branched {
Expand Down
51 changes: 23 additions & 28 deletions obo-core/src/build_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct CommitBuildInfo {
pub struct EnabledRepo {
#[serde(flatten)]
pub repo_arch: RepoArch,
pub prev_endtime_for_commit: Option<u64>,
}

Expand Down Expand Up @@ -121,13 +123,13 @@
Ok(result) => Ok(Some(result)),
Err(e) => {
for cause in e.chain() {
if let Some(obs::Error::ApiError(obs::ApiError { code, .. })) =
cause.downcast_ref::<obs::Error>()
{
if code == "unknown_package" {
return Ok(None);
}
}

Check warning on line 132 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obo-core/src/build_meta.rs:126:21 | 126 | / if let Some(obs::Error::ApiError(obs::ApiError { code, .. })) = 127 | | cause.downcast_ref::<obs::Error>() 128 | | { 129 | | if code == "unknown_package" { ... | 132 | | } | |_____________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 127 ~ cause.downcast_ref::<obs::Error>() 128 ~ && code == "unknown_package" { 129 | return Ok(None); 130 ~ } |

Check warning on line 132 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obo-core/src/build_meta.rs:126:21 | 126 | / if let Some(obs::Error::ApiError(obs::ApiError { code, .. })) = 127 | | cause.downcast_ref::<obs::Error>() 128 | | { 129 | | if code == "unknown_package" { ... | 132 | | } | |_____________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 127 ~ cause.downcast_ref::<obs::Error>() 128 ~ && code == "unknown_package" { 129 | return Ok(None); 130 ~ } |

Check warning on line 132 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obo-core/src/build_meta.rs:126:21 | 126 | / if let Some(obs::Error::ApiError(obs::ApiError { code, .. })) = 127 | | cause.downcast_ref::<obs::Error>() 128 | | { 129 | | if code == "unknown_package" { ... | 132 | | } | |_____________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 127 ~ cause.downcast_ref::<obs::Error>() 128 ~ && code == "unknown_package" { 129 | return Ok(None); 130 ~ } |

Check warning on line 132 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obo-core/src/build_meta.rs:126:21 | 126 | / if let Some(obs::Error::ApiError(obs::ApiError { code, .. })) = 127 | | cause.downcast_ref::<obs::Error>() 128 | | { 129 | | if code == "unknown_package" { ... | 132 | | } | |_____________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 127 ~ cause.downcast_ref::<obs::Error>() 128 ~ && code == "unknown_package" { 129 | return Ok(None); 130 ~ } |
}

Err(e)
Expand Down Expand Up @@ -237,26 +239,19 @@
Ok(())
}

pub fn get_commit_build_info(&self, srcmd5: &str) -> HashMap<RepoArch, CommitBuildInfo> {
let mut repos = HashMap::new();

for (repo, jobhist) in &self.repos {
let prev_endtime_for_commit = jobhist
.jobhist
.iter()
.filter(|e| e.srcmd5 == srcmd5)
.next_back()
.map(|e| e.endtime);

repos.insert(
repo.clone(),
CommitBuildInfo {
prev_endtime_for_commit,
},
);
}

repos
pub fn get_commit_build_info(&self, srcmd5: &str) -> Vec<EnabledRepo> {
self.repos
.iter()
.map(|(repo, jobhist)| EnabledRepo {
repo_arch: repo.clone(),
prev_endtime_for_commit: jobhist
.jobhist
.iter()
.filter(|e| e.srcmd5 == srcmd5)
.next_back()

Check warning on line 251 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead

warning: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead --> obo-core/src/build_meta.rs:247:42 | 247 | prev_endtime_for_commit: jobhist | __________________________________________^ 248 | | .jobhist 249 | | .iter() 250 | | .filter(|e| e.srcmd5 == srcmd5) 251 | | .next_back() | |________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#filter_next = note: `#[warn(clippy::filter_next)]` on by default help: try | 247 ~ prev_endtime_for_commit: jobhist 248 + .jobhist 249 + .iter().rfind(|e| e.srcmd5 == srcmd5) |

Check warning on line 251 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead

warning: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead --> obo-core/src/build_meta.rs:247:42 | 247 | prev_endtime_for_commit: jobhist | __________________________________________^ 248 | | .jobhist 249 | | .iter() 250 | | .filter(|e| e.srcmd5 == srcmd5) 251 | | .next_back() | |________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#filter_next = note: `#[warn(clippy::filter_next)]` on by default help: try | 247 ~ prev_endtime_for_commit: jobhist 248 + .jobhist 249 + .iter().rfind(|e| e.srcmd5 == srcmd5) |

Check warning on line 251 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead

warning: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead --> obo-core/src/build_meta.rs:247:42 | 247 | prev_endtime_for_commit: jobhist | __________________________________________^ 248 | | .jobhist 249 | | .iter() 250 | | .filter(|e| e.srcmd5 == srcmd5) 251 | | .next_back() | |________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#filter_next = note: `#[warn(clippy::filter_next)]` on by default help: try | 247 ~ prev_endtime_for_commit: jobhist 248 + .jobhist 249 + .iter().rfind(|e| e.srcmd5 == srcmd5) |

Check warning on line 251 in obo-core/src/build_meta.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead

warning: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead --> obo-core/src/build_meta.rs:247:42 | 247 | prev_endtime_for_commit: jobhist | __________________________________________^ 248 | | .jobhist 249 | | .iter() 250 | | .filter(|e| e.srcmd5 == srcmd5) 251 | | .next_back() | |________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#filter_next = note: `#[warn(clippy::filter_next)]` on by default help: try | 247 ~ prev_endtime_for_commit: jobhist 248 + .jobhist 249 + .iter().rfind(|e| e.srcmd5 == srcmd5) |
.map(|e| e.endtime),
})
.collect()
}
}

Expand Down Expand Up @@ -360,10 +355,10 @@

let build_info = meta.get_commit_build_info(&srcmd5_1);

let arch_1 = assert_some!(build_info.get(&repo_arch_1));
let arch_1 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_1));
assert_some_eq!(arch_1.prev_endtime_for_commit, endtime_1);

let arch_2 = assert_some!(build_info.get(&repo_arch_2));
let arch_2 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_none!(arch_2.prev_endtime_for_commit);

let meta = assert_ok!(
Expand All @@ -385,9 +380,9 @@

let build_info = meta.get_commit_build_info(&srcmd5_1);

let arch_1 = assert_some!(build_info.get(&repo_arch_1));
let arch_1 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_1));
assert_none!(arch_1.prev_endtime_for_commit);
let arch_2 = assert_some!(build_info.get(&repo_arch_2));
let arch_2 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_none!(arch_2.prev_endtime_for_commit);

assert!(meta.repos.contains_key(&repo_arch_2));
Expand Down Expand Up @@ -431,7 +426,7 @@

let build_info = meta.get_commit_build_info(&srcmd5_2);

let arch_1 = assert_some!(build_info.get(&repo_arch_2));
let arch_1 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_some_eq!(arch_1.prev_endtime_for_commit, endtime_2);

mock.add_job_history(
Expand Down Expand Up @@ -465,13 +460,13 @@

let build_info = meta.get_commit_build_info(&srcmd5_1);

let arch_2 = assert_some!(build_info.get(&repo_arch_2));
let arch_2 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_some_eq!(arch_2.prev_endtime_for_commit, endtime_1);

meta.clear_stored_history();

let build_info = meta.get_commit_build_info(&srcmd5_1);
let arch_2 = assert_some!(build_info.get(&repo_arch_2));
let arch_2 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_none!(arch_2.prev_endtime_for_commit);

mock.set_package_build_status(
Expand Down
12 changes: 4 additions & 8 deletions obo-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,8 @@ pub async fn test_dput<C: TestContext>(

let arch_1 = build_info
.enabled_repos
.get(&RepoArch {
repo: TEST_REPO.to_owned(),
arch: TEST_ARCH_1.to_owned(),
})
.iter()
.find(|e| e.repo_arch.repo == TEST_REPO && e.repo_arch.arch == TEST_ARCH_1)
.unwrap();

if test == DputTest::Rebuild {
Expand All @@ -336,10 +334,8 @@ pub async fn test_dput<C: TestContext>(

let arch_2 = build_info
.enabled_repos
.get(&RepoArch {
repo: TEST_REPO.to_owned(),
arch: TEST_ARCH_2.to_owned(),
})
.iter()
.find(|e| e.repo_arch.repo == TEST_REPO && e.repo_arch.arch == TEST_ARCH_2)
.unwrap();
assert_none!(arch_2.prev_endtime_for_commit);
}
Expand Down
1 change: 1 addition & 0 deletions obs-gitlab-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ obo-core = { path = "../obo-core" }
obo-test-support = { path = "../obo-test-support" }
open-build-service-api.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
shellexpand = "3.1"
shell-words.workspace = true
Expand Down
24 changes: 11 additions & 13 deletions obs-gitlab-runner/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
};

let build_info_data = artifacts.read_string(&args.build_info).await?;
let build_info: ObsBuildInfo = serde_yaml::from_str(&build_info_data)
let build_info: ObsBuildInfo = serde_json::from_str(&build_info_data)
.wrap_err("Failed to parse provided build info file")?;

let pipeline = generate_monitor_pipeline(
Expand Down Expand Up @@ -413,25 +413,25 @@
let path = path.components().collect::<Utf8PathBuf>();

// TODO: not spawn a sync environment for *every single artifact*
if let Some(mut artifact) = dep.download().await? {
if let Some(file) = tokio::task::spawn_blocking(move || {
artifact
.file(path.as_str())
.map(|mut file| {
let mut temp = tempfile::tempfile()?;
std::io::copy(&mut file, &mut temp)?;
temp.rewind()?;
Ok::<_, Report>(temp)
})
.transpose()
})
.await??
{
return Ok(Some(
ArtifactReader::from_async_file(&AsyncFile::from_std(file)).await?,
));
}
}

Check warning on line 434 in obs-gitlab-runner/src/handler.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obs-gitlab-runner/src/handler.rs:416:5 | 416 | / if let Some(mut artifact) = dep.download().await? { 417 | | if let Some(file) = tokio::task::spawn_blocking(move || { 418 | | artifact 419 | | .file(path.as_str()) ... | 434 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 416 ~ if let Some(mut artifact) = dep.download().await? 417 ~ && let Some(file) = tokio::task::spawn_blocking(move || { 418 | artifact ... 432 | )); 433 ~ } |

Check warning on line 434 in obs-gitlab-runner/src/handler.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obs-gitlab-runner/src/handler.rs:416:5 | 416 | / if let Some(mut artifact) = dep.download().await? { 417 | | if let Some(file) = tokio::task::spawn_blocking(move || { 418 | | artifact 419 | | .file(path.as_str()) ... | 434 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 416 ~ if let Some(mut artifact) = dep.download().await? 417 ~ && let Some(file) = tokio::task::spawn_blocking(move || { 418 | artifact ... 432 | )); 433 ~ } |

Check warning on line 434 in obs-gitlab-runner/src/handler.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obs-gitlab-runner/src/handler.rs:416:5 | 416 | / if let Some(mut artifact) = dep.download().await? { 417 | | if let Some(file) = tokio::task::spawn_blocking(move || { 418 | | artifact 419 | | .file(path.as_str()) ... | 434 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 416 ~ if let Some(mut artifact) = dep.download().await? 417 ~ && let Some(file) = tokio::task::spawn_blocking(move || { 418 | artifact ... 432 | )); 433 ~ } |

Check warning on line 434 in obs-gitlab-runner/src/handler.rs

View workflow job for this annotation

GitHub Actions / cargo clippy latest

this `if` statement can be collapsed

warning: this `if` statement can be collapsed --> obs-gitlab-runner/src/handler.rs:416:5 | 416 | / if let Some(mut artifact) = dep.download().await? { 417 | | if let Some(file) = tokio::task::spawn_blocking(move || { 418 | | artifact 419 | | .file(path.as_str()) ... | 434 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_if = note: `#[warn(clippy::collapsible_if)]` on by default help: collapse nested if block | 416 ~ if let Some(mut artifact) = dep.download().await? 417 ~ && let Some(file) = tokio::task::spawn_blocking(move || { 418 | artifact ... 432 | )); 433 ~ } |

Ok(None)
}
Expand All @@ -448,7 +448,7 @@
use claims::*;
use gitlab_runner::{GitlabLayer, Runner, RunnerBuilder};
use gitlab_runner_mock::*;
use obo_core::build_meta::{CommitBuildInfo, RepoArch};
use obo_core::build_meta::{EnabledRepo, RepoArch};
use obo_test_support::*;
use obo_tests::*;
use rstest::rstest;
Expand Down Expand Up @@ -868,10 +868,10 @@

assert_eq!(pipeline_map.len(), build_info.enabled_repos.len());

for repo in build_info.enabled_repos.keys() {
for enabled in &build_info.enabled_repos {
let monitor_job_name = format!(
"{}-{}-{}",
DEFAULT_PIPELINE_JOB_PREFIX, TEST_REPO, &repo.arch
DEFAULT_PIPELINE_JOB_PREFIX, TEST_REPO, &enabled.repo_arch.arch
);

let monitor_map = pipeline_yaml
Expand Down Expand Up @@ -945,7 +945,7 @@
context,
dput.clone(),
build_info,
repo,
&enabled.repo_arch,
&script,
success,
dput_test,
Expand Down Expand Up @@ -1130,23 +1130,21 @@
rev: Some("1".to_owned()),
srcmd5: Some("abc".to_owned()),
is_branched: false,
enabled_repos: [(
RepoArch {
enabled_repos: vec![EnabledRepo {
repo_arch: RepoArch {
repo: TEST_REPO.to_owned(),
arch: TEST_ARCH_1.to_owned(),
},
CommitBuildInfo {
prev_endtime_for_commit: None,
},
)]
.into(),

prev_endtime_for_commit: None,
}],
};

let build_info = context
.inject_artifacts(
[(
DEFAULT_BUILD_INFO.to_owned(),
serde_yaml::to_string(&build_info).unwrap().into_bytes(),
serde_json::to_string(&build_info).unwrap().into_bytes(),
)]
.into(),
)
Expand Down
Loading
Loading