fix: Slack error handler missing "slack" arg (#2546)

This commit is contained in:
Guillaume Bouvignies
2023-11-02 22:33:16 +01:00
committed by GitHub
parent 00bc1b9671
commit 7ba2a6c4f1
4 changed files with 12 additions and 3 deletions
-2
View File
@@ -56,8 +56,6 @@ use windmill_queue::PushIsolationLevel;
use std::{fs, str};
pub const WORKSPACE_SLACK_BOT_TOKEN_PATH: &str = "f/slack_bot/bot_token";
pub fn global_service() -> Router {
Router::new()
.route("/login/:client", get(login))
+1 -1
View File
@@ -21,7 +21,6 @@ use crate::{
variables::build_crypt,
webhook_util::{InstanceEvent, WebhookShared}
};
use crate::oauth2::WORKSPACE_SLACK_BOT_TOKEN_PATH;
#[cfg(feature = "enterprise")]
use axum::response::Redirect;
use axum::{
@@ -46,6 +45,7 @@ use windmill_common::{
scripts::{Schema, Script, ScriptLang},
utils::{paginate, rd_string, require_admin, Pagination},
variables::ExportableListableVariable,
oauth2::WORKSPACE_SLACK_BOT_TOKEN_PATH,
};
use windmill_queue::QueueTransaction;
+2
View File
@@ -10,3 +10,5 @@ use hmac::Hmac;
use sha2::Sha256;
pub type HmacSha256 = Hmac<Sha256>;
pub const WORKSPACE_SLACK_BOT_TOKEN_PATH: &str = "f/slack_bot/bot_token";
+9
View File
@@ -53,6 +53,7 @@ use windmill_common::{
get_payload_tag_from_prefixed_path, script_path_to_payload, CompletedJob, JobKind,
JobPayload, QueuedJob, RawCode,
},
oauth2::WORKSPACE_SLACK_BOT_TOKEN_PATH,
schedule::{schedule_to_user, Schedule},
scripts::{ScriptHash, ScriptLang},
users::{username_to_permissioned_as, SUPERADMIN_SECRET_EMAIL},
@@ -562,6 +563,14 @@ pub async fn run_error_handler<
));
}
}
if error_handler_path
.to_string()
.eq("hub/2431/slack/schedule-error-handler-slack")
{
// custom slack error handler being used -> we need to inject the slack token
let slack_resource = format!("$res:{WORKSPACE_SLACK_BOT_TOKEN_PATH}");
extra.insert("slack".to_string(), to_raw_value(&slack_resource));
}
let tx = PushIsolationLevel::IsolatedRoot(db.clone(), rsmq);