Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add app connection
Matheus Nogueirae3e117279c34
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 41ea20e6e6..7c13d86443 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -104,6 +104,10 @@ import {DopplerConnectionListItemSchema,SanitizedDopplerConnectionSchema} from "@app/services/app-connection/doppler/doppler-connection-schema";+import {+ SanitizedSpaceliftConnectionSchema,+ SpaceliftConnectionListItemSchema+} from "@app/services/app-connection/spacelift";import {ExternalInfisicalConnectionListItemSchema,SanitizedExternalInfisicalConnectionSchema@@ -335,7 +339,8 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedQoveryConnectionSchema.options,...SanitizedLiteLLMConnectionSchema.options,...SanitizedFireworksConnectionSchema.options,- ...SanitizedNutanixPrismCentralConnectionSchema.options+ ...SanitizedNutanixPrismCentralConnectionSchema.options,+ ...SanitizedSpaceliftConnectionSchema.options]);const AppConnectionOptionsSchema = z.discriminatedUnion("app", [@@ -419,7 +424,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [QoveryConnectionListItemSchema,LiteLLMConnectionListItemSchema,FireworksConnectionListItemSchema,- NutanixPrismCentralConnectionListItemSchema+ NutanixPrismCentralConnectionListItemSchema,+ SpaceliftConnectionListItemSchema]);export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex fcb7ad0404..50876d26a9 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -69,6 +69,7 @@ import { registerRundeckConnectionRouter } from "./rundeck-connection-router";import { registerSalesforceConnectionRouter } from "./salesforce-connection-router";import { registerSmbConnectionRouter } from "./smb-connection-router";import { registerSnowflakeConnectionRouter } from "./snowflake-connection-router";+import { registerSpaceliftConnectionRouter } from "./spacelift-connection-router";import { registerSshConnectionRouter } from "./ssh-connection-router";import { registerSupabaseConnectionRouter } from "./supabase-connection-router";import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";@@ -166,5 +167,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.Qovery]: registerQoveryConnectionRouter,[AppConnection.LiteLLM]: registerLiteLLMConnectionRouter,[AppConnection.Fireworks]: registerFireworksConnectionRouter,- [AppConnection.NutanixPrismCentral]: registerNutanixPrismCentralConnectionRouter+ [AppConnection.NutanixPrismCentral]: registerNutanixPrismCentralConnectionRouter,+ [AppConnection.Spacelift]: registerSpaceliftConnectionRouter};diff --git a/backend/src/server/routes/v1/app-connection-routers/spacelift-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/spacelift-connection-router.tsnew file mode 100644index 0000000000..0b2a84dd2f--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/spacelift-connection-router.ts@@ -0,0 +1,18 @@+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateSpaceliftConnectionSchema,+ SanitizedSpaceliftConnectionSchema,+ UpdateSpaceliftConnectionSchema+} from "@app/services/app-connection/spacelift";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerSpaceliftConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.Spacelift,+ server,+ sanitizedResponseSchema: SanitizedSpaceliftConnectionSchema,+ createSchema: CreateSpaceliftConnectionSchema,+ updateSchema: UpdateSpaceliftConnectionSchema+ });+};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex b470d30bfd..e318fa41e5 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -79,7 +79,8 @@ export enum AppConnection {LiteLLM = "litellm",Fireworks = "fireworks",KempLoadMaster = "kemp-loadmaster",- NutanixPrismCentral = "nutanix-prism-central"+ NutanixPrismCentral = "nutanix-prism-central",+ Spacelift = "spacelift"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex a00d67754e..ea364e9446 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -138,6 +138,11 @@ import {validateDNSMadeEasyConnectionCredentials} from "./dns-made-easy/dns-made-easy-connection-fns";import { DopplerConnectionMethod, getDopplerConnectionListItem, validateDopplerConnectionCredentials } from "./doppler";+import {+ getSpaceliftConnectionListItem,+ SpaceliftConnectionMethod,+ validateSpaceliftConnectionCredentials+} from "./spacelift";import {ExternalInfisicalConnectionMethod,getExternalInfisicalConnectionListItem,@@ -410,7 +415,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getQoveryConnectionListItem(),getLiteLLMConnectionListItem(),getFireworksConnectionListItem(),- getNutanixPrismCentralConnectionListItem()+ getNutanixPrismCentralConnectionListItem(),+ getSpaceliftConnectionListItem()].filter((option) => {switch (projectType) {@@ -663,7 +669,8 @@ export const validateAppConnectionCredentials = async ([AppConnection.LiteLLM]: validateLiteLLMConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Fireworks]: validateFireworksConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.NutanixPrismCentral]:- validateNutanixPrismCentralConnectionCredentials as TAppConnectionCredentialsValidator+ validateNutanixPrismCentralConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.Spacelift]: validateSpaceliftConnectionCredentials as TAppConnectionCredentialsValidator};return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);@@ -719,6 +726,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case DatadogConnectionMethod.Token:return "API Token";case DNSMadeEasyConnectionMethod.APIKeySecret:+ case SpaceliftConnectionMethod.ApiKeySecret:return "API Key & Secret";case AzureDnsConnectionMethod.ClientSecret:case AzureEntraIdConnectionMethod.ClientSecret:diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex 6cde1ec7bc..7eb13b3cbe 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -81,7 +81,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.Cloud66]: "Cloud 66",[AppConnection.LiteLLM]: "LiteLLM",[AppConnection.Fireworks]: "Fireworks",- [AppConnection.NutanixPrismCentral]: "Nutanix Prism Central"+ [AppConnection.NutanixPrismCentral]: "Nutanix Prism Central",+ [AppConnection.Spacelift]: "Spacelift"};export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {@@ -165,5 +166,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.Cloud66]: AppConnectionPlanType.Regular,[AppConnection.LiteLLM]: AppConnectionPlanType.Regular,[AppConnection.Fireworks]: AppConnectionPlanType.Regular,- [AppConnection.NutanixPrismCentral]: AppConnectionPlanType.Regular+ [AppConnection.NutanixPrismCentral]: AppConnectionPlanType.Regular,+ [AppConnection.Spacelift]: AppConnectionPlanType.Regular};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex 4c364a9171..f40a31b847 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -107,6 +107,7 @@ import { ValidateDNSMadeEasyConnectionCredentialsSchema } from "./dns-made-easy/import { dnsMadeEasyConnectionService } from "./dns-made-easy/dns-made-easy-connection-service";import { ValidateDopplerConnectionCredentialsSchema } from "./doppler/doppler-connection-schema";import { dopplerConnectionService } from "./doppler/doppler-connection-service";+import { ValidateSpaceliftConnectionCredentialsSchema } from "./spacelift";import { ValidateExternalInfisicalConnectionCredentialsSchema } from "./external-infisical";import { externalInfisicalConnectionService } from "./external-infisical/external-infisical-connection-service";import { ValidateF5BigIpConnectionCredentialsSchema } from "./f5-big-ip";@@ -300,7 +301,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.Qovery]: ValidateQoveryConnectionCredentialsSchema,[AppConnection.LiteLLM]: ValidateLiteLLMConnectionCredentialsSchema,[AppConnection.Fireworks]: ValidateFireworksConnectionCredentialsSchema,- [AppConnection.NutanixPrismCentral]: ValidateNutanixPrismCentralConnectionCredentialsSchema+ [AppConnection.NutanixPrismCentral]: ValidateNutanixPrismCentralConnectionCredentialsSchema,+ [AppConnection.Spacelift]: ValidateSpaceliftConnectionCredentialsSchema};export const appConnectionServiceFactory = ({diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex b2b61f930a..5f8b1477ed 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -473,6 +473,12 @@ import {TWinRMConnectionConfig,TWinRMConnectionInput} from "./winrm/winrm-connection-types";+import {+ TSpaceliftConnection,+ TSpaceliftConnectionConfig,+ TSpaceliftConnectionInput,+ TValidateSpaceliftConnectionCredentialsSchema+} from "./spacelift";import {TValidateZabbixConnectionCredentialsSchema,TZabbixConnection,@@ -564,6 +570,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu| TLiteLLMConnection| TFireworksConnection| TNutanixPrismCentralConnection+ | TSpaceliftConnection);export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;@@ -656,6 +663,7 @@ export type TAppConnectionInput = { id: string } & (| TLiteLLMConnectionInput| TFireworksConnectionInput| TNutanixPrismCentralConnectionInput+ | TSpaceliftConnectionInput);export type TSqlConnectionInput =@@ -779,7 +787,8 @@ export type TAppConnectionConfig =| TQoveryConnectionConfig| TLiteLLMConnectionConfig| TFireworksConnectionConfig- | TNutanixPrismCentralConnectionConfig;+ | TNutanixPrismCentralConnectionConfig+ | TSpaceliftConnectionConfig;export type TValidateAppConnectionCredentialsSchema =| TValidateAwsConnectionCredentialsSchema@@ -862,7 +871,8 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateQoveryConnectionCredentialsSchema| TValidateLiteLLMConnectionCredentialsSchema| TValidateFireworksConnectionCredentialsSchema- | TValidateNutanixPrismCentralConnectionCredentialsSchema;+ | TValidateNutanixPrismCentralConnectionCredentialsSchema+ | TValidateSpaceliftConnectionCredentialsSchema;export type TListAwsConnectionKmsKeys = {connectionId: string;diff --git a/backend/src/services/app-connection/spacelift/index.ts b/backend/src/services/app-connection/spacelift/index.tsnew file mode 100644index 0000000000..84fc6304cc--- /dev/null+++ b/backend/src/services/app-connection/spacelift/index.ts@@ -0,0 +1,19 @@+export { SpaceliftConnectionMethod } from "./spacelift-connection-enums";+export {+ getSpaceliftConnectionListItem,+ getSpaceliftInstanceUrl,+ validateSpaceliftConnectionCredentials+} from "./spacelift-connection-fns";+export {+ CreateSpaceliftConnectionSchema,+ SanitizedSpaceliftConnectionSchema,+ SpaceliftConnectionListItemSchema,+ UpdateSpaceliftConnectionSchema,+ ValidateSpaceliftConnectionCredentialsSchema+} from "./spacelift-connection-schemas";+export type {+ TSpaceliftConnection,+ TSpaceliftConnectionConfig,+ TSpaceliftConnectionInput,+ TValidateSpaceliftConnectionCredentialsSchema+} from "./spacelift-connection-types";diff --git a/backend/src/services/app-connection/spacelift/spacelift-connection-enums.ts b/backend/src/services/app-connection/spacelift/spacelift-connection-enums.tsnew file mode 100644index 0000000000..842f4adbca--- /dev/null+++ b/backend/src/services/app-connection/spacelift/spacelift-connection-enums.ts@@ -0,0 +1,3 @@+export enum SpaceliftConnectionMethod {+ ApiKeySecret = "api-key-secret"+}diff --git a/backend/src/services/app-connection/spacelift/spacelift-connection-fns.ts b/backend/src/services/app-connection/spacelift/spacelift-connection-fns.tsnew file mode 100644index 0000000000..80908634a1--- /dev/null+++ b/backend/src/services/app-connection/spacelift/spacelift-connection-fns.ts@@ -0,0 +1,94 @@+import { AxiosError } from "axios";++import { BadRequestError } from "@app/lib/errors";+import { removeTrailingSlash } from "@app/lib/fn";+import { safeRequest } from "@app/lib/validator";++import { AppConnection } from "../app-connection-enums";+import { SpaceliftConnectionMethod } from "./spacelift-connection-enums";+import { TSpaceliftConnectionConfig } from "./spacelift-connection-types";++const SPACELIFT_ALLOWED_DOMAIN_SUFFIXES = ["spacelift.io"];++export const getSpaceliftInstanceUrl = (config: TSpaceliftConnectionConfig) => {+ const rawUrl = removeTrailingSlash(config.credentials.apiUrl);++ let parsed: URL;+ try {+ parsed = new URL(rawUrl);+ } catch {+ throw new BadRequestError({ message: "Invalid Spacelift URL" });+ }++ if (parsed.protocol !== "https:") {+ throw new BadRequestError({ message: "Spacelift URL must use HTTPS" });+ }++ const { hostname } = parsed;+ const isAllowedHost = SPACELIFT_ALLOWED_DOMAIN_SUFFIXES.some(+ (suffix) => hostname === suffix || hostname.endsWith(`.${suffix}`)+ );+ if (!isAllowedHost) {+ throw new BadRequestError({+ message: "Spacelift URL must end with spacelift.io"+ });+ }++ return rawUrl;+};++export const getSpaceliftConnectionListItem = () => {+ return {+ name: "Spacelift" as const,+ app: AppConnection.Spacelift as const,+ methods: Object.values(SpaceliftConnectionMethod) as [SpaceliftConnectionMethod.ApiKeySecret]+ };+};++export const validateSpaceliftConnectionCredentials = async (config: TSpaceliftConnectionConfig) => {+ const instanceUrl = getSpaceliftInstanceUrl(config);+ const { apiKeyId, apiKeySecret } = config.credentials;++ try {+ const { data } = await safeRequest.post<{ data?: { apiKeyUser?: { jwt: string } }; errors?: { message: string }[] }>(+ `${instanceUrl}/graphql`,+ {+ query: `mutation GetSpaceliftToken($id: ID!, $secret: String!) { apiKeyUser(id: $id, secret: $secret) { jwt } }`,+ variables: { id: apiKeyId, secret: apiKeySecret }+ },+ {+ headers: {+ "Content-Type": "application/json"+ }+ }+ );++ if (data.errors?.length) {+ throw new BadRequestError({+ message: `Failed to validate Spacelift credentials: ${data.errors[0].message}`+ });+ }++ if (!data.data?.apiKeyUser?.jwt) {+ throw new BadRequestError({+ message: "Failed to validate Spacelift credentials: no JWT returned"+ });+ }+ } catch (error: unknown) {+ if (error instanceof BadRequestError) {+ throw error;+ }++ if (error instanceof AxiosError) {+ throw new BadRequestError({+ message: `Failed to validate Spacelift credentials: ${error.message}`+ });+ }++ throw new BadRequestError({+ message: "Failed to validate Spacelift credentials - verify the API URL and credentials are correct"+ });+ }++ return config.credentials;+};diff --git a/backend/src/services/app-connection/spacelift/spacelift-connection-schemas.ts b/backend/src/services/app-connection/spacelift/spacelift-connection-schemas.tsnew file mode 100644index 0000000000..a157cb6285--- /dev/null+++ b/backend/src/services/app-connection/spacelift/spacelift-connection-schemas.ts@@ -0,0 +1,74 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { SpaceliftConnectionMethod } from "./spacelift-connection-enums";++export const SpaceliftConnectionApiKeyCredentialsSchema = z.object({+ apiUrl: z+ .string()+ .trim()+ .url("API URL must be a valid URL")+ .min(1, "API URL required")+ .max(256, "API URL cannot exceed 256 characters"),+ apiKeyId: z.string().trim().min(1, "API Key ID required").max(256, "API Key ID cannot exceed 256 characters"),+ apiKeySecret: z+ .string()+ .trim()+ .min(1, "API Key Secret required")+ .max(256, "API Key Secret cannot exceed 256 characters")+});++const BaseSpaceliftConnectionSchema = BaseAppConnectionSchema.extend({+ app: z.literal(AppConnection.Spacelift)+});++export const SpaceliftConnectionSchema = BaseSpaceliftConnectionSchema.extend({+ method: z.literal(SpaceliftConnectionMethod.ApiKeySecret),+ credentials: SpaceliftConnectionApiKeyCredentialsSchema+});++export const SanitizedSpaceliftConnectionSchema = z.discriminatedUnion("method", [+ BaseSpaceliftConnectionSchema.extend({+ method: z.literal(SpaceliftConnectionMethod.ApiKeySecret),+ credentials: SpaceliftConnectionApiKeyCredentialsSchema.pick({ apiUrl: true, apiKeyId: true })+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.Spacelift]} (API Key)` }))+]);++export const ValidateSpaceliftConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(SpaceliftConnectionMethod.ApiKeySecret)+ .describe(AppConnections.CREATE(AppConnection.Spacelift).method),+ credentials: SpaceliftConnectionApiKeyCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.Spacelift).credentials+ )+ })+]);++export const CreateSpaceliftConnectionSchema = ValidateSpaceliftConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.Spacelift)+);++export const UpdateSpaceliftConnectionSchema = z+ .object({+ credentials: SpaceliftConnectionApiKeyCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.Spacelift).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Spacelift));++export const SpaceliftConnectionListItemSchema = z+ .object({+ name: z.literal("Spacelift"),+ app: z.literal(AppConnection.Spacelift),+ methods: z.nativeEnum(SpaceliftConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.Spacelift] }));diff --git a/backend/src/services/app-connection/spacelift/spacelift-connection-types.ts b/backend/src/services/app-connection/spacelift/spacelift-connection-types.tsnew file mode 100644index 0000000000..abb650befc--- /dev/null+++ b/backend/src/services/app-connection/spacelift/spacelift-connection-types.ts@@ -0,0 +1,25 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreateSpaceliftConnectionSchema,+ SpaceliftConnectionSchema,+ ValidateSpaceliftConnectionCredentialsSchema+} from "./spacelift-connection-schemas";++export type TSpaceliftConnection = z.infer<typeof SpaceliftConnectionSchema>;++export type TSpaceliftConnectionInput = z.infer<typeof CreateSpaceliftConnectionSchema> & {+ app: AppConnection.Spacelift;+};++export type TValidateSpaceliftConnectionCredentialsSchema = typeof ValidateSpaceliftConnectionCredentialsSchema;++export type TSpaceliftConnectionConfig = DiscriminativePick<+ TSpaceliftConnectionInput,+ "method" | "app" | "credentials"+> & {+ orgId: string;+};diff --git a/frontend/public/images/integrations/Spacelift.png b/frontend/public/images/integrations/Spacelift.pngnew file mode 100644index 0000000000..b9faf6748cBinary files /dev/null and b/frontend/public/images/integrations/Spacelift.png differdiff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex 3445ea7a8b..39185c2f77 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -89,6 +89,7 @@ import { RundeckConnectionMethod } from "@app/hooks/api/appConnections/types/runimport { SalesforceConnectionMethod } from "@app/hooks/api/appConnections/types/salesforce-connection";import { SmbConnectionMethod } from "@app/hooks/api/appConnections/types/smb-connection";import { SnowflakeConnectionMethod } from "@app/hooks/api/appConnections/types/snowflake-connection";+import { SpaceliftConnectionMethod } from "@app/hooks/api/appConnections/types/spacelift-connection";import { SshConnectionMethod } from "@app/hooks/api/appConnections/types/ssh-connection";import { SupabaseConnectionMethod } from "@app/hooks/api/appConnections/types/supabase-connection";import { TravisCIConnectionMethod } from "@app/hooks/api/appConnections/types/travis-ci-connection";@@ -608,6 +609,12 @@ export const APP_CONNECTION_MAP: Record<image: "Nutanix.png",category: "INFRASTRUCTURE",description: "Manage a Nutanix Prism Central instance."+ },+ [AppConnection.Spacelift]: {+ name: "Spacelift",+ image: "Spacelift.png",+ category: "INFRASTRUCTURE",+ description: "Sync and manage resources with Spacelift."}};@@ -729,6 +736,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case AzureKeyVaultConnectionMethod.Certificate:return { name: "Certificate", icon: faCertificate };case DNSMadeEasyConnectionMethod.APIKeySecret:+ case SpaceliftConnectionMethod.ApiKeySecret:return { name: "API Key & Secret", icon: faKey };case AzureDNSConnectionMethod.ClientSecret:case AzureEntraIdConnectionMethod.ClientSecret:diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 8c55c0a6f4..e05e24bc8f 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -79,5 +79,6 @@ export enum AppConnection {Cloud66 = "cloud-66",LiteLLM = "litellm",Fireworks = "fireworks",- NutanixPrismCentral = "nutanix-prism-central"+ NutanixPrismCentral = "nutanix-prism-central",+ Spacelift = "spacelift"}diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex e637da1dd2..3daede1024 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -69,6 +69,7 @@ import { TRundeckConnection } from "./rundeck-connection";import { TSalesforceConnection } from "./salesforce-connection";import { TSmbConnection } from "./smb-connection";import { TSnowflakeConnection } from "./snowflake-connection";+import { TSpaceliftConnection } from "./spacelift-connection";import { TSshConnection } from "./ssh-connection";import { TSupabaseConnection } from "./supabase-connection";import { TTeamCityConnection } from "./teamcity-connection";@@ -148,6 +149,7 @@ export * from "./rundeck-connection";export * from "./salesforce-connection";export * from "./smb-connection";export * from "./snowflake-connection";+export * from "./spacelift-connection";export * from "./ssh-connection";export * from "./supabase-connection";export * from "./teamcity-connection";@@ -242,7 +244,8 @@ export type TAppConnection =| TQoveryConnection| TLiteLLMConnection| TFireworksConnection- | TNutanixPrismCentralConnection;+ | TNutanixPrismCentralConnection+ | TSpaceliftConnection;export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;diff --git a/frontend/src/hooks/api/appConnections/types/spacelift-connection.ts b/frontend/src/hooks/api/appConnections/types/spacelift-connection.tsnew file mode 100644index 0000000000..9c83abff80--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/spacelift-connection.ts@@ -0,0 +1,15 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum SpaceliftConnectionMethod {+ ApiKeySecret = "api-key-secret"+}++export type TSpaceliftConnection = TRootAppConnection & { app: AppConnection.Spacelift } & {+ method: SpaceliftConnectionMethod.ApiKeySecret;+ credentials: {+ apiUrl: string;+ apiKeyId: string;+ apiKeySecret: string;+ };+};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 1a85fbb5a4..fceae0253a 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -84,6 +84,7 @@ import { RundeckConnectionForm } from "./RundeckConnectionForm";import { SalesforceConnectionForm } from "./SalesforceConnectionForm";import { SmbConnectionForm } from "./SmbConnectionForm";import { SnowflakeConnectionForm } from "./SnowflakeConnectionForm";+import { SpaceliftConnectionForm } from "./SpaceliftConnectionForm";import { SshConnectionForm } from "./SshConnectionForm";import { SupabaseConnectionForm } from "./SupabaseConnectionForm";import { TeamCityConnectionForm } from "./TeamCityConnectionForm";@@ -267,6 +268,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <CloudflareConnectionForm onSubmit={onSubmit} />;case AppConnection.DNSMadeEasy:return <DNSMadeEasyConnectionForm onSubmit={onSubmit} />;+ case AppConnection.Spacelift:+ return <SpaceliftConnectionForm onSubmit={onSubmit} />;case AppConnection.AzureDNS:return <AzureDNSConnectionForm onSubmit={onSubmit} />;case AppConnection.Bitbucket:@@ -540,6 +543,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {return <CloudflareConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.DNSMadeEasy:return <DNSMadeEasyConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;+ case AppConnection.Spacelift:+ return <SpaceliftConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.AzureDNS:return <AzureDNSConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Bitbucket:diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SpaceliftConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SpaceliftConnectionForm.tsxnew file mode 100644index 0000000000..efa4e7b766--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SpaceliftConnectionForm.tsx@@ -0,0 +1,175 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { Info } from "lucide-react";+import { z } from "zod";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ SecretInput,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { TSpaceliftConnection } from "@app/hooks/api/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { SpaceliftConnectionMethod } from "@app/hooks/api/appConnections/types/spacelift-connection";++import { AppConnectionFormFooter } from "./AppConnectionFormFooter";+import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TSpaceliftConnection;+ onSubmit: (formData: FormData) => Promise<void>;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.Spacelift)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(SpaceliftConnectionMethod.ApiKeySecret),+ credentials: z.object({+ apiUrl: z.string().trim().url("Must be a valid URL").min(1, "API URL required"),+ apiKeyId: z.string().trim().min(1, "API Key ID required"),+ apiKeySecret: z.string().trim().min(1, "API Key Secret required")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const SpaceliftConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.Spacelift,+ method: SpaceliftConnectionMethod.ApiKeySecret,+ credentials: {+ apiUrl: "",+ apiKeyId: "",+ apiKeySecret: ""+ }+ }+ });++ const { handleSubmit, control } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="method">+ Method+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The method you would like to use to connect with{" "}+ {APP_CONNECTION_MAP[AppConnection.Spacelift].name}. This field cannot be+ changed after creation.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a method..." />+ </SelectTrigger>+ <SelectContent position="popper">+ {Object.values(SpaceliftConnectionMethod).map((method) => {+ return (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}{" "}+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.apiUrl"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="api-url">+ API URL+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Your Spacelift account URL (e.g. https://myaccount.app.spacelift.io)+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ id="api-url"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder="https://myaccount.app.spacelift.io"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.apiKeyId"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="api-key-id">API Key ID</FieldLabel>+ <Input+ id="api-key-id"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.apiKeySecret"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="api-key-secret">API Key Secret</FieldLabel>+ <SecretInput value={value} onChange={(e) => onChange(e.target.value)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <AppConnectionFormFooter+ submitLabel={isUpdate ? "Update Credentials" : "Connect to Spacelift"}+ />+ </form>+ </FormProvider>+ );+};