Skip to content

Commit 539723f

Browse files
authored
Merge pull request coreos#107 from jbtrystram/oci_only_release
scraper: support releases without ostree commits
2 parents 734527a + d49df37 commit 539723f

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

commons/src/graph.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,26 @@ impl Graph {
5656
return None;
5757
}
5858
} else {
59-
for commit in entry.commits {
60-
if commit.architecture != scope.basearch || commit.checksum.is_empty() {
61-
continue;
59+
match entry.commits {
60+
Some(commits) if !commits.is_empty() => {
61+
for commit in commits {
62+
if commit.architecture != scope.basearch
63+
|| commit.checksum.is_empty()
64+
{
65+
continue;
66+
}
67+
has_basearch = true;
68+
current.payload = commit.checksum;
69+
current
70+
.metadata
71+
.insert(metadata::SCHEME.to_string(), "checksum".to_string());
72+
}
73+
}
74+
_ => {
75+
// catch-all arm for both `None` and `Some(empty_vec)`,
76+
// both cases should result in skipping the release.
77+
return None;
6278
}
63-
has_basearch = true;
64-
current.payload = commit.checksum;
65-
current
66-
.metadata
67-
.insert(metadata::SCHEME.to_string(), "checksum".to_string());
6879
}
6980
}
7081

commons/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct ReleasesJSON {
3131

3232
#[derive(Clone, Debug, Deserialize)]
3333
pub struct Release {
34-
pub commits: Vec<ReleaseCommit>,
34+
pub commits: Option<Vec<ReleaseCommit>>,
3535
#[serde(rename = "oci-images")]
3636
pub oci_images: Option<Vec<ReleaseOciImage>>,
3737
pub version: String,

0 commit comments

Comments
 (0)