Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge new&old secrets in deployer #1407

Merged
merged 1 commit into from Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions deployer/src/deployment/run.rs
Expand Up @@ -15,7 +15,7 @@ use shuttle_common::{
DEPLOYER_END_MSG_COMPLETED, DEPLOYER_END_MSG_CRASHED, DEPLOYER_END_MSG_STARTUP_ERR,
DEPLOYER_END_MSG_STOPPED, DEPLOYER_RUNTIME_START_RESPONSE,
},
resource,
resource, SecretStore,
};
use shuttle_proto::{
resource_recorder::record_request,
Expand Down Expand Up @@ -315,7 +315,7 @@ async fn load(
mut resource_manager: impl ResourceManager,
mut runtime_client: RuntimeClient<ClaimService<InjectPropagation<Channel>>>,
claim: Claim,
secrets: HashMap<String, String>,
mut secrets: HashMap<String, String>,
) -> Result<()> {
info!("Loading resources");

Expand All @@ -336,6 +336,19 @@ async fn load(
})
.ok()
})
// inject old secrets into the secrets added in this deployment
.inspect(|r| {
if r.r#type == shuttle_common::resource::Type::Secrets {
match serde_json::from_value::<SecretStore>(r.data.clone()) {
Ok(ss) => {
secrets.extend(ss.into_iter());
}
Err(err) => {
error!(error = ?err, "failed to parse old secrets data");
}
}
}
})
.map(resource::Response::into_bytes)
.collect();

Expand Down
2 changes: 2 additions & 0 deletions runtime/src/alpha/mod.rs
Expand Up @@ -218,6 +218,8 @@ where

let provisioner_client = ProvisionerClient::new(channel);

// TODO: merge new & old secrets

let past_resources = resources
.into_iter()
.map(resource::Response::from_bytes)
Expand Down