Skip to content

Commit b0af9e9

Browse files
committed
refactor: make source identifiers consistent
1 parent b557c17 commit b0af9e9

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

core/src/artifact/source/artifacthub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use serde::Deserialize;
66

77
#[derive(Deserialize, Debug, Clone)]
88
pub struct ArtifactHubSource {
9-
pub package: String,
9+
pub identifier: String,
1010
}
1111

1212
#[derive(Deserialize, Debug)]
@@ -18,7 +18,7 @@ const ARTIFACTHUB_API: &str = "https://artifacthub.io/api/v1/packages";
1818

1919
impl SourceChecker for ArtifactHubSource {
2020
async fn is_version_behind(&self, current_version: &str) -> Result<Option<String>> {
21-
let source = format!("{}/{}", ARTIFACTHUB_API, &self.package);
21+
let source = format!("{}/{}", ARTIFACTHUB_API, &self.identifier);
2222

2323
let response = get(&source)
2424
.await

core/src/artifact/source/dockerhub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
66

77
#[derive(Deserialize, Debug, Clone)]
88
pub struct DockerHubSource {
9-
pub repo: String,
9+
pub identifier: String,
1010
}
1111

1212
#[derive(Serialize, Deserialize, Debug)]
@@ -28,7 +28,7 @@ const PAGE_SIZE_QUERY_PARAM: &str = "page_size=200";
2828

2929
impl SourceChecker for DockerHubSource {
3030
async fn is_version_behind(&self, current_version: &str) -> Result<Option<String>> {
31-
let source = build_dockerhub_url(&self.repo);
31+
let source = build_dockerhub_url(&self.identifier);
3232
let response = fetch_dockerhub_tags(&source).await?;
3333

3434
// TODO: we need to fetch the next results of the paginated response

core/src/artifact/source/github.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::Deserialize;
55

66
#[derive(Deserialize, Debug, Clone)]
77
pub struct GitHubSource {
8-
pub repo: String,
8+
pub identifier: String,
99
}
1010

1111
#[derive(Deserialize)]
@@ -17,7 +17,7 @@ const GITHUB_API: &str = "https://api.github.com/repos";
1717

1818
impl SourceChecker for GitHubSource {
1919
async fn is_version_behind(&self, current_version: &str) -> Result<Option<String>> {
20-
let source = format!("{}/{}/releases/latest", GITHUB_API, self.repo);
20+
let source = format!("{}/{}/releases/latest", GITHUB_API, self.identifier);
2121

2222
// Send the HTTP request
2323
let response = get(&source)

core/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ mod tests {
120120
message_prefix: None,
121121
notifier: vec!["notifier1".to_string(), "notifier2".to_string()],
122122
source: Source::GitHub(crate::artifact::source::github::GitHubSource {
123-
repo: "repo".to_string(),
123+
identifier: "repo".to_string(),
124124
}),
125125
current_version: "1.0.0".to_string(),
126126
sink: vec![],
@@ -160,7 +160,7 @@ mod tests {
160160
message_prefix: None,
161161
notifier: vec![],
162162
source: Source::GitHub(crate::artifact::source::github::GitHubSource {
163-
repo: "repo".to_string(),
163+
identifier: "repo".to_string(),
164164
}),
165165
current_version: "1.0.0".to_string(),
166166
sink: vec![],
@@ -184,7 +184,7 @@ mod tests {
184184
message_prefix: None,
185185
notifier: vec!["notifier1".to_string(), "notifier2".to_string()],
186186
source: Source::GitHub(crate::artifact::source::github::GitHubSource {
187-
repo: "repo".to_string(),
187+
identifier: "repo".to_string(),
188188
}),
189189
current_version: "1.0.0".to_string(),
190190
sink: vec![],

examples/CONFIG.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
### GitHub
1212

13-
For the repo value you just take the part of the url with the `username/reponame`
13+
For the identifier value you just take the part of the url with the `username/reponame`
1414

1515
```
1616
{
1717
"name": "Rust",
1818
"message_prefix": "There is a new version of:", // optional
1919
"source": {
2020
"type": "github",
21-
"repo": "rust-lang/rust"
21+
"identifier": "rust-lang/rust"
2222
},
2323
"current_version": "",
2424
"notifier": ["team_slack", "private_email"]
@@ -27,7 +27,7 @@ For the repo value you just take the part of the url with the `username/reponame
2727

2828
### Artifacthub
2929

30-
For the package value you just take the part of the url with the `kind/organization/packagename`
30+
For the identifier value you just take the part of the url with the `kind/organization/packagename`
3131

3232
```
3333
{
@@ -36,15 +36,15 @@ For the package value you just take the part of the url with the `kind/organizat
3636
"current_version": "24.3.1",
3737
"source": {
3838
"type": "artifacthub",
39-
"package": "helm/bitnami/keycloak"
39+
"identifier": "helm/bitnami/keycloak"
4040
},
4141
"notifier": ["generic_webhook", "team_google_chat"]
4242
},
4343
```
4444

4545
### Dockerhub
4646

47-
For the repo you just take the part of the url with the `username/imagename`.
47+
For the identifier value you just take the part of the url with the `username/imagename`.
4848
Official images have a special syntax `_/nginx` for example. For these you just use the image name `nginx`.
4949

5050
```
@@ -54,7 +54,7 @@ Official images have a special syntax `_/nginx` for example. For these you just
5454
"current_version": "1.25.2-alpine3.20-perl",
5555
"source": {
5656
"type": "dockerhub",
57-
"repo": "nginx"
57+
"identifier": "nginx"
5858
},
5959
"notifier": ["private_email"]
6060
}

0 commit comments

Comments
 (0)