fix docker credential helper when credentials are not found
This commit is contained in:
parent
0cfa9fc07a
commit
4c18de8b7a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "creddy",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@ -1217,7 +1217,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "creddy"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"auto-launch",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "creddy"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
description = "A friendly AWS credentials manager"
|
||||
authors = ["Joseph Montanaro"]
|
||||
license = ""
|
||||
|
@ -29,11 +29,20 @@ pub fn docker_get(global_args: GlobalArgs) -> anyhow::Result<()> {
|
||||
server_url: server_url.trim().to_owned()
|
||||
};
|
||||
|
||||
match super::make_request(global_args.server_addr, &req)?? {
|
||||
CliResponse::Credential(CliCredential::Docker(d)) => {
|
||||
let server_resp = super::make_request(global_args.server_addr, &req)?;
|
||||
match server_resp {
|
||||
Ok(CliResponse::Credential(CliCredential::Docker(d))) => {
|
||||
println!("{}", serde_json::to_string(&d)?);
|
||||
},
|
||||
r => bail!("Unexpected response from server: {r}"),
|
||||
Err(e) if e.code == "NoCredentials" => {
|
||||
// To indicate credentials are not found, a credential helper *must* print
|
||||
// this message to stdout, then exit 1. Any other message/status will cause
|
||||
// some builds to fail. This is, of course, not documented anywhere.
|
||||
println!("credentials not found in native keychain");
|
||||
std::process::exit(1);
|
||||
},
|
||||
Err(e) => Err(e)?,
|
||||
Ok(r) => bail!("Unexpected response from server: {r}"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ mod platform {
|
||||
use tokio::net::UnixStream;
|
||||
|
||||
pub async fn connect(addr: Option<PathBuf>) -> Result<UnixStream, std::io::Error> {
|
||||
let default = if cfg!(debug_assertions) { "creddy-server-dev" } else { "creddy-server" };
|
||||
let path = addr.unwrap_or_else(|| server_addr(default));
|
||||
let path = addr.unwrap_or_else(|| server_addr("creddy-server"));
|
||||
UnixStream::connect(&path).await
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ pub struct DockerCredential {
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ServerError {
|
||||
code: String,
|
||||
msg: String,
|
||||
pub code: String,
|
||||
pub msg: String,
|
||||
}
|
||||
|
||||
impl Display for ServerError {
|
||||
|
@ -50,7 +50,7 @@
|
||||
}
|
||||
},
|
||||
"productName": "creddy",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"identifier": "creddy",
|
||||
"plugins": {},
|
||||
"app": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user