mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-08 13:13:49 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
def2efa0d1 | ||
|
|
21c110011f |
@@ -27,7 +27,7 @@ Take a look at https://sergi0g.github.io/cup/docs!
|
|||||||
Cup is a work in progress. It might not have as many features as What's up Docker. If one of these features is really important for you, please consider using another tool.
|
Cup is a work in progress. It might not have as many features as What's up Docker. If one of these features is really important for you, please consider using another tool.
|
||||||
|
|
||||||
- ~~Cup currently doesn't support registries which use repositories without slashes. This includes Azure. This problem may sound a bit weird, but it's due to the regex that's used at the moment. This will (hopefully) be fixed in the future.~~
|
- ~~Cup currently doesn't support registries which use repositories without slashes. This includes Azure. This problem may sound a bit weird, but it's due to the regex that's used at the moment. This will (hopefully) be fixed in the future.~~
|
||||||
- Cup doesn't support private images. This is on the roadmap. Currently, it just returns unknown for those images.
|
- ~~Cup doesn't support private images. This is on the roadmap. Currently, it just returns unknown for those images.~~
|
||||||
- Cup cannot trigger your integrations. If you want that to happen automatically, please use What's up docker instead. Cup was created to be simple. The data is there, and it's up to you to retrieve it (e.g. by running `cup check -r` with a cronjob or periodically requesting the `/json` url from the server)
|
- Cup cannot trigger your integrations. If you want that to happen automatically, please use What's up docker instead. Cup was created to be simple. The data is there, and it's up to you to retrieve it (e.g. by running `cup check -r` with a cronjob or periodically requesting the `/json` url from the server)
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::sync::Mutex;
|
|||||||
|
|
||||||
use json::JsonValue;
|
use json::JsonValue;
|
||||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||||
use ureq::Error;
|
use ureq::{Error, ErrorKind};
|
||||||
|
|
||||||
use http_auth::parse_challenges;
|
use http_auth::parse_challenges;
|
||||||
|
|
||||||
@@ -56,8 +56,20 @@ pub fn get_latest_digest(image: &Image, token: Option<&String>, config: &JsonVal
|
|||||||
digest: None,
|
digest: None,
|
||||||
..image.clone()
|
..image.clone()
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Err(ureq::Error::Transport(e)) => error!("Failed to send request!\n{}", e),
|
Err(Error::Transport(error)) => {
|
||||||
|
match error.kind() {
|
||||||
|
ErrorKind::Dns => {
|
||||||
|
warn!("Failed to lookup the IP of the registry, retrying.");
|
||||||
|
return get_latest_digest(image, token, config)
|
||||||
|
}, // If something goes really wrong, this can get stuck in a loop
|
||||||
|
ErrorKind::ConnectionFailed => {
|
||||||
|
warn!("Connection probably timed out, retrying.");
|
||||||
|
return get_latest_digest(image, token, config)
|
||||||
|
}, // Same here
|
||||||
|
_ => error!("Failed to retrieve image digest\n{}!", error)
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
match raw_response.header("docker-content-digest") {
|
match raw_response.header("docker-content-digest") {
|
||||||
Some(digest) => Image {
|
Some(digest) => Image {
|
||||||
@@ -83,7 +95,7 @@ pub fn get_latest_digests(images: Vec<&Image>, token: Option<&String>, config: &
|
|||||||
|
|
||||||
pub fn get_token(images: Vec<&Image>, auth_url: &str, credentials: &Option<String>) -> String {
|
pub fn get_token(images: Vec<&Image>, auth_url: &str, credentials: &Option<String>) -> String {
|
||||||
let mut final_url = auth_url.to_owned();
|
let mut final_url = auth_url.to_owned();
|
||||||
for image in images {
|
for image in &images {
|
||||||
final_url = format!("{}&scope=repository:{}:pull", final_url, image.repository);
|
final_url = format!("{}&scope=repository:{}:pull", final_url, image.repository);
|
||||||
}
|
}
|
||||||
let mut base_request = ureq::get(&final_url).set("Accept", "application/vnd.oci.image.index.v1+json"); // Seems to be unnecesarry. Will probably remove in the future
|
let mut base_request = ureq::get(&final_url).set("Accept", "application/vnd.oci.image.index.v1+json"); // Seems to be unnecesarry. Will probably remove in the future
|
||||||
@@ -99,6 +111,19 @@ pub fn get_token(images: Vec<&Image>, auth_url: &str, credentials: &Option<Strin
|
|||||||
error!("Failed to parse response into string!\n{}", e)
|
error!("Failed to parse response into string!\n{}", e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Err(Error::Transport(error)) => {
|
||||||
|
match error.kind() {
|
||||||
|
ErrorKind::Dns => {
|
||||||
|
warn!("Failed to lookup the IP of the registry, retrying.");
|
||||||
|
return get_token(images, auth_url, credentials)
|
||||||
|
}, // If something goes really wrong, this can get stuck in a loop
|
||||||
|
ErrorKind::ConnectionFailed => {
|
||||||
|
warn!("Connection probably timed out, retrying.");
|
||||||
|
return get_token(images, auth_url, credentials)
|
||||||
|
}, // Same here
|
||||||
|
_ => error!("Token request failed\n{}!", error)
|
||||||
|
}
|
||||||
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Token request failed!\n{}", e)
|
error!("Token request failed!\n{}", e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user