fix docker credential helper when credentials are not found
This commit is contained in:
parent
0cfa9fc07a
commit
4c18de8b7a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "creddy",
|
"name": "creddy",
|
||||||
"version": "0.6.1",
|
"version": "0.6.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@ -1217,7 +1217,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "creddy"
|
name = "creddy"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"auto-launch",
|
"auto-launch",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "creddy"
|
name = "creddy"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
description = "A friendly AWS credentials manager"
|
description = "A friendly AWS credentials manager"
|
||||||
authors = ["Joseph Montanaro"]
|
authors = ["Joseph Montanaro"]
|
||||||
license = ""
|
license = ""
|
||||||
|
@ -29,11 +29,20 @@ pub fn docker_get(global_args: GlobalArgs) -> anyhow::Result<()> {
|
|||||||
server_url: server_url.trim().to_owned()
|
server_url: server_url.trim().to_owned()
|
||||||
};
|
};
|
||||||
|
|
||||||
match super::make_request(global_args.server_addr, &req)?? {
|
let server_resp = super::make_request(global_args.server_addr, &req)?;
|
||||||
CliResponse::Credential(CliCredential::Docker(d)) => {
|
match server_resp {
|
||||||
|
Ok(CliResponse::Credential(CliCredential::Docker(d))) => {
|
||||||
println!("{}", serde_json::to_string(&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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ mod platform {
|
|||||||
use tokio::net::UnixStream;
|
use tokio::net::UnixStream;
|
||||||
|
|
||||||
pub async fn connect(addr: Option<PathBuf>) -> Result<UnixStream, std::io::Error> {
|
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("creddy-server"));
|
||||||
let path = addr.unwrap_or_else(|| server_addr(default));
|
|
||||||
UnixStream::connect(&path).await
|
UnixStream::connect(&path).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ pub struct DockerCredential {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct ServerError {
|
pub struct ServerError {
|
||||||
code: String,
|
pub code: String,
|
||||||
msg: String,
|
pub msg: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for ServerError {
|
impl Display for ServerError {
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"productName": "creddy",
|
"productName": "creddy",
|
||||||
"version": "0.6.1",
|
"version": "0.6.2",
|
||||||
"identifier": "creddy",
|
"identifier": "creddy",
|
||||||
"plugins": {},
|
"plugins": {},
|
||||||
"app": {
|
"app": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user