added databricks integration

This commit is contained in:
Vladyslav Matsiiako
2024-10-02 22:49:02 -07:00
parent fd254fbeec
commit 25b55087cf
39 changed files with 496 additions and 163 deletions
@@ -2085,6 +2085,76 @@ const syncSecretsCircleCI = async ({
);
};
/**
* Sync/push [secrets] to Databricks project
*/
const syncSecretsDatabricks = async ({
integration,
secrets,
accessToken
}: {
integration: TIntegrations;
secrets: Record<string, { value: string; comment?: string }>;
accessToken: string;
}) => {
// sync secrets to Databricks
await Promise.all(
Object.keys(secrets).map(async (key) =>
request.post(
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/put`,
{
scope: integration.app,
key,
string_value: secrets[key].value
},
{
headers: {
Authorization: `Bearer ${accessToken}`,
"Accept-Encoding": "application/json"
}
}
)
)
);
// get secrets from Databricks
const getSecretsRes = (
await request.get<{ secrets: { key: string; last_updated_timestamp: number }[] }>(
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/list`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json"
},
params: {
scope: integration.app
}
}
)
).data.secrets;
// delete secrets from Databricks
await Promise.all(
getSecretsRes.map(async (sec) => {
if (!(sec.key in secrets)) {
return request.post(
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/delete`,
{
scope: integration.app,
key: sec.key
},
{
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json"
}
}
);
}
})
);
};
/**
* Sync/push [secrets] to TravisCI project
*/
@@ -4021,6 +4091,13 @@ export const syncIntegrationSecrets = async ({
accessToken
});
break;
case Integrations.DATABRICKS:
await syncSecretsDatabricks({
integration,
secrets,
accessToken
});
break;
case Integrations.LARAVELFORGE:
await syncSecretsLaravelForge({
integration,