mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 06:26:27 +00:00
added custom instance URLs to databricks
This commit is contained in:
@@ -15,6 +15,7 @@ export enum Integrations {
|
|||||||
FLYIO = "flyio",
|
FLYIO = "flyio",
|
||||||
LARAVELFORGE = "laravel-forge",
|
LARAVELFORGE = "laravel-forge",
|
||||||
CIRCLECI = "circleci",
|
CIRCLECI = "circleci",
|
||||||
|
DATABRICKS = "databricks",
|
||||||
TRAVISCI = "travisci",
|
TRAVISCI = "travisci",
|
||||||
TEAMCITY = "teamcity",
|
TEAMCITY = "teamcity",
|
||||||
SUPABASE = "supabase",
|
SUPABASE = "supabase",
|
||||||
@@ -73,6 +74,7 @@ export enum IntegrationUrls {
|
|||||||
RAILWAY_API_URL = "https://backboard.railway.app/graphql/v2",
|
RAILWAY_API_URL = "https://backboard.railway.app/graphql/v2",
|
||||||
FLYIO_API_URL = "https://api.fly.io/graphql",
|
FLYIO_API_URL = "https://api.fly.io/graphql",
|
||||||
CIRCLECI_API_URL = "https://circleci.com/api",
|
CIRCLECI_API_URL = "https://circleci.com/api",
|
||||||
|
DATABRICKS_API_URL = "https:/dbc-5e0185c0-20ac.cloud.databricks.com/api",
|
||||||
TRAVISCI_API_URL = "https://api.travis-ci.com",
|
TRAVISCI_API_URL = "https://api.travis-ci.com",
|
||||||
SUPABASE_API_URL = "https://api.supabase.com",
|
SUPABASE_API_URL = "https://api.supabase.com",
|
||||||
LARAVELFORGE_API_URL = "https://forge.laravel.com",
|
LARAVELFORGE_API_URL = "https://forge.laravel.com",
|
||||||
@@ -210,6 +212,15 @@ export const getIntegrationOptions = async () => {
|
|||||||
clientId: "",
|
clientId: "",
|
||||||
docsLink: ""
|
docsLink: ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Databricks",
|
||||||
|
slug: "databricks",
|
||||||
|
image: "Databricks.png",
|
||||||
|
isAvailable: true,
|
||||||
|
type: "pat",
|
||||||
|
clientId: "",
|
||||||
|
docsLink: ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "GitLab",
|
name: "GitLab",
|
||||||
slug: "gitlab",
|
slug: "gitlab",
|
||||||
|
|||||||
@@ -2090,18 +2090,22 @@ const syncSecretsCircleCI = async ({
|
|||||||
*/
|
*/
|
||||||
const syncSecretsDatabricks = async ({
|
const syncSecretsDatabricks = async ({
|
||||||
integration,
|
integration,
|
||||||
|
integrationAuth,
|
||||||
secrets,
|
secrets,
|
||||||
accessToken
|
accessToken
|
||||||
}: {
|
}: {
|
||||||
integration: TIntegrations;
|
integration: TIntegrations;
|
||||||
|
integrationAuth: TIntegrationAuths;
|
||||||
secrets: Record<string, { value: string; comment?: string }>;
|
secrets: Record<string, { value: string; comment?: string }>;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const databricksApiUrl = `${integrationAuth.url}/api`;
|
||||||
|
|
||||||
// sync secrets to Databricks
|
// sync secrets to Databricks
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.keys(secrets).map(async (key) =>
|
Object.keys(secrets).map(async (key) =>
|
||||||
request.post(
|
request.post(
|
||||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/put`,
|
`${databricksApiUrl}/2.0/secrets/put`,
|
||||||
{
|
{
|
||||||
scope: integration.app,
|
scope: integration.app,
|
||||||
key,
|
key,
|
||||||
@@ -2120,7 +2124,7 @@ const syncSecretsDatabricks = async ({
|
|||||||
// get secrets from Databricks
|
// get secrets from Databricks
|
||||||
const getSecretsRes = (
|
const getSecretsRes = (
|
||||||
await request.get<{ secrets: { key: string; last_updated_timestamp: number }[] }>(
|
await request.get<{ secrets: { key: string; last_updated_timestamp: number }[] }>(
|
||||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/list`,
|
`${databricksApiUrl}/2.0/secrets/list`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
@@ -2138,7 +2142,7 @@ const syncSecretsDatabricks = async ({
|
|||||||
getSecretsRes.map(async (sec) => {
|
getSecretsRes.map(async (sec) => {
|
||||||
if (!(sec.key in secrets)) {
|
if (!(sec.key in secrets)) {
|
||||||
return request.post(
|
return request.post(
|
||||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/delete`,
|
`${databricksApiUrl}/2.0/secrets/delete`,
|
||||||
{
|
{
|
||||||
scope: integration.app,
|
scope: integration.app,
|
||||||
key: sec.key
|
key: sec.key
|
||||||
@@ -4094,6 +4098,7 @@ export const syncIntegrationSecrets = async ({
|
|||||||
case Integrations.DATABRICKS:
|
case Integrations.DATABRICKS:
|
||||||
await syncSecretsDatabricks({
|
await syncSecretsDatabricks({
|
||||||
integration,
|
integration,
|
||||||
|
integrationAuth,
|
||||||
secrets,
|
secrets,
|
||||||
accessToken
|
accessToken
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Prerequisites:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Press on the Databricks tile and input your Databricks Access Token to grant Infisical the necessary permissions in your Databricks account.
|
Press on the Databricks tile and enter your Databricks instance URL in the followung format: `https://xxx.cloud.databricks.com`. Then, input your Databricks Access Token to grant Infisical the necessary permissions in your Databricks account.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -15,22 +15,30 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
const { mutateAsync } = useSaveIntegrationAccessToken();
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
|
const [instanceURL, setInstanceURL] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
|
const [instanceURLErrorText, setInstanceURLErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const handleButtonClick = async () => {
|
const handleButtonClick = async () => {
|
||||||
try {
|
try {
|
||||||
setApiKeyErrorText("");
|
setApiKeyErrorText("");
|
||||||
|
setInstanceURLErrorText("");
|
||||||
if (apiKey.length === 0) {
|
if (apiKey.length === 0) {
|
||||||
setApiKeyErrorText("API Key cannot be blank");
|
setApiKeyErrorText("API Key cannot be blank");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (instanceURL.length === 0) {
|
||||||
|
setInstanceURLErrorText("Instance URL cannot be blank");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await mutateAsync({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "databricks",
|
integration: "databricks",
|
||||||
|
url: instanceURL,
|
||||||
accessToken: apiKey
|
accessToken: apiKey
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -78,12 +86,20 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
</div>
|
</div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Databricks Access Token"
|
label="Databricks Instance URL"
|
||||||
|
errorText={instanceURLErrorText}
|
||||||
|
isError={instanceURLErrorText !== "" ?? false}
|
||||||
|
className="px-6"
|
||||||
|
>
|
||||||
|
<Input value={instanceURL} onChange={(e) => setInstanceURL(e.target.value)} placeholder="https://xxxx.cloud.databricks.com" />
|
||||||
|
</FormControl>
|
||||||
|
<FormControl
|
||||||
|
label="Access Token"
|
||||||
errorText={apiKeyErrorText}
|
errorText={apiKeyErrorText}
|
||||||
isError={apiKeyErrorText !== "" ?? false}
|
isError={apiKeyErrorText !== "" ?? false}
|
||||||
className="px-6"
|
className="px-6"
|
||||||
>
|
>
|
||||||
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user