Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: secret-sync WIP

Piyush Guptac29d42a7b743
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 7c34879df7..7a2edc5362 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2686,6 +2686,12 @@ export const SecretSyncs = {
siteId: "The ID of the Laravel Forge site to sync secrets to.",
siteName: "The name of the Laravel Forge site to sync secrets to."
},
+ OCTOPUS_DEPLOY: {
+ spaceId: "The ID of the Octopus Deploy space to sync secrets to.",
+ projectId: "The ID of the Octopus Deploy project to sync secrets to.",
+ scope: "The Octopus Deploy scope that secrets should be synced to.",
+ scopeValues: "The Octopus Deploy scope values that secrets should be synced to."
+ },
WINDMILL: {
workspace: "The Windmill workspace to sync secrets to.",
path: "The Windmill workspace path to sync secrets to."
diff --git a/backend/src/server/routes/v1/app-connection-routers/octopus-deploy-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/octopus-deploy-connection-router.ts
index 2f47de55bb..7f6740cc8d 100644
--- a/backend/src/server/routes/v1/app-connection-routers/octopus-deploy-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/octopus-deploy-connection-router.ts
@@ -1,9 +1,15 @@
+import { z } from "zod";
+
+import { BadRequestError } from "@app/lib/errors";
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import {
CreateOctopusDeployConnectionSchema,
SanitizedOctopusDeployConnectionSchema,
UpdateOctopusDeployConnectionSchema
} from "@app/services/app-connection/octopus-deploy";
+import { AuthMode } from "@app/services/auth/auth-type";
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
@@ -15,4 +21,148 @@ export const registerOctopusDeployConnectionRouter = async (server: FastifyZodPr
createSchema: CreateOctopusDeployConnectionSchema,
updateSchema: UpdateOctopusDeployConnectionSchema
});
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/spaces`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z.array(
+ z.object({
+ id: z.string(),
+ name: z.string(),
+ slug: z.string(),
+ isDefault: z.boolean()
+ })
+ )
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+
+ const spaces = await server.services.appConnection.octopusDeploy.listSpaces(connectionId, req.permission);
+
+ return spaces;
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/projects`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ querystring: z.object({
+ spaceId: z.string().min(1, "Space ID is required")
+ }),
+ response: {
+ 200: z.array(
+ z.object({
+ id: z.string(),
+ name: z.string(),
+ slug: z.string()
+ })
+ )
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const { spaceId } = req.query;
+
+ const projects = await server.services.appConnection.octopusDeploy.listProjects(
+ connectionId,
+ spaceId,
+ req.permission
+ );
+
+ return projects;
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/scope-values`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ querystring: z.object({
+ spaceId: z.string().min(1, "Space ID is required"),
+ projectId: z.string().min(1, "Project ID is required")
+ }),
+ response: {
+ 200: z.object({
+ environments: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array(),
+ tenantTags: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array(),
+ machines: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array(),
+ processes: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array(),
+ actions: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array(),
+ channels: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const { spaceId, projectId } = req.query;
+
+ const scopeValues = await server.services.appConnection.octopusDeploy.getScopeValues(
+ connectionId,
+ spaceId,
+ projectId,
+ req.permission
+ );
+
+ if (!scopeValues) {
+ throw new BadRequestError({ message: "Unable to get Octopus Deploy scope values" });
+ }
+
+ return scopeValues;
+ }
+ });
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/index.ts b/backend/src/server/routes/v1/secret-sync-routers/index.ts
index 810e5b7faf..3699bc95d2 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/index.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/index.ts
@@ -25,6 +25,7 @@ import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
import { registerLaravelForgeSyncRouter } from "./laravel-forge-sync-router";
import { registerNetlifySyncRouter } from "./netlify-sync-router";
import { registerNorthflankSyncRouter } from "./northflank-sync-router";
+import { registerOctopusDeploySyncRouter } from "./octopus-deploy-sync-router";
import { registerRailwaySyncRouter } from "./railway-sync-router";
import { registerRenderSyncRouter } from "./render-sync-router";
import { registerSupabaseSyncRouter } from "./supabase-sync-router";
@@ -69,5 +70,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
[SecretSync.Northflank]: registerNorthflankSyncRouter,
[SecretSync.Bitbucket]: registerBitbucketSyncRouter,
[SecretSync.LaravelForge]: registerLaravelForgeSyncRouter,
- [SecretSync.Chef]: registerChefSyncRouter
+ [SecretSync.Chef]: registerChefSyncRouter,
+ [SecretSync.OctopusDeploy]: registerOctopusDeploySyncRouter
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/octopus-deploy-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/octopus-deploy-sync-router.ts
new file mode 100644
index 0000000000..c7897cefc1
--- /dev/null
+++ b/backend/src/server/routes/v1/secret-sync-routers/octopus-deploy-sync-router.ts
@@ -0,0 +1,17 @@
+import {
+ CreateOctopusDeploySyncSchema,
+ OctopusDeploySyncSchema,
+ UpdateOctopusDeploySyncSchema
+} from "@app/services/secret-sync/octopus-deploy";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+
+import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
+
+export const registerOctopusDeploySyncRouter = async (server: FastifyZodProvider) =>
+ registerSyncSecretsEndpoints({
+ destination: SecretSync.OctopusDeploy,
+ server,
+ responseSchema: OctopusDeploySyncSchema,
+ createSchema: CreateOctopusDeploySyncSchema,
+ updateSchema: UpdateOctopusDeploySyncSchema
+ });
diff --git a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
index 61e4ab79d6..a1ba5d7d9c 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
@@ -48,6 +48,7 @@ import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/
import { LaravelForgeSyncListItemSchema, LaravelForgeSyncSchema } from "@app/services/secret-sync/laravel-forge";
import { NetlifySyncListItemSchema, NetlifySyncSchema } from "@app/services/secret-sync/netlify";
import { NorthflankSyncListItemSchema, NorthflankSyncSchema } from "@app/services/secret-sync/northflank";
+import { OctopusDeploySyncListItemSchema, OctopusDeploySyncSchema } from "@app/services/secret-sync/octopus-deploy";
import { RailwaySyncListItemSchema, RailwaySyncSchema } from "@app/services/secret-sync/railway/railway-sync-schemas";
import { RenderSyncListItemSchema, RenderSyncSchema } from "@app/services/secret-sync/render/render-sync-schemas";
import { SupabaseSyncListItemSchema, SupabaseSyncSchema } from "@app/services/secret-sync/supabase";
@@ -90,7 +91,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
NorthflankSyncSchema,
BitbucketSyncSchema,
LaravelForgeSyncSchema,
- ChefSyncSchema
+ ChefSyncSchema,
+ OctopusDeploySyncSchema
]);
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
@@ -126,7 +128,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
NorthflankSyncListItemSchema,
BitbucketSyncListItemSchema,
LaravelForgeSyncListItemSchema,
- ChefSyncListItemSchema
+ ChefSyncListItemSchema,
+ OctopusDeploySyncListItemSchema
]);
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-fns.ts b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-fns.ts
index add152cc04..314b11b3f1 100644
--- a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-fns.ts
+++ b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-fns.ts
@@ -1,10 +1,20 @@
-import { Client, ClientConfiguration, userGetCurrent } from "@octopusdeploy/api-client";
+import { AxiosError } from "axios";
+import { request } from "@app/lib/config/request";
import { BadRequestError } from "@app/lib/errors";
import { AppConnection } from "../app-connection-enums";
import { OctopusDeployConnectionMethod } from "./octopus-deploy-connection-enums";
-import { TOctopusDeployConnectionConfig } from "./octopus-deploy-connection-types";
+import {
+ TOctopusDeployConnection,
+ TOctopusDeployConnectionConfig,
+ TOctopusDeployProject,
+ TOctopusDeployProjectResponse,
+ TOctopusDeployScopeValues,
+ TOctopusDeployScopeValuesResponse,
+ TOctopusDeploySpace,
+ TOctopusDeploySpaceResponse
+} from "./octopus-deploy-connection-types";
export const getOctopusDeployConnectionListItem = () => {
return {
@@ -17,19 +27,158 @@ export const getOctopusDeployConnectionListItem = () => {
export const validateOctopusDeployConnectionCredentials = async (config: TOctopusDeployConnectionConfig) => {
const { credentials: inputCredentials } = config;
try {
- const clientConfig: ClientConfiguration = {
- instanceURL: inputCredentials.instanceUrl,
- apiKey: inputCredentials.apiKey,
- userAgentApp: "Infisical App Connection"
- };
+ await request.get(`${inputCredentials.instanceUrl}/api/users/me`, {
+ headers: {
+ "X-Octopus-ApiKey": inputCredentials.apiKey,
+ "X-NuGet-ApiKey": inputCredentials.apiKey,
+ Accept: "application/json"
+ }
+ });
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to validate Octopus Deploy credentials: ${error.message || "Unknown error"}`
+ });
+ }
- const client = await Client.create(clientConfig);
- await userGetCurrent(client);
- } catch (error) {
throw new BadRequestError({
- message: "Unable to validate connection: verify credentials"
+ message: `Failed to validate Octopus Deploy credentials - verify API key is correct`
});
}
return inputCredentials;
};
+
+export const getOctopusDeploySpaces = async (
+ appConnection: TOctopusDeployConnection
+): Promise<TOctopusDeploySpace[]> => {
+ const { credentials } = appConnection;
+ const { instanceUrl, apiKey } = credentials;
+
+ try {
+ const { data } = await request.get<TOctopusDeploySpaceResponse[]>(`${instanceUrl}/api/spaces/all`, {
+ headers: {
+ "X-Octopus-ApiKey": apiKey,
+ "X-NuGet-ApiKey": apiKey,
+ Accept: "application/json"
+ }
+ });
+
+ return data.map((space) => ({
+ id: space.Id,
+ name: space.Name,
+ slug: space.Slug,
+ isDefault: space.IsDefault
+ }));
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to list Octopus Deploy spaces: ${error.message || "Unknown error"}`
+ });
+ }
+
+ throw new BadRequestError({
+ message: "Unable to list Octopus Deploy spaces",
+ error
+ });
+ }
+};
+
+export const getOctopusDeployProjects = async (
+ appConnection: TOctopusDeployConnection,
+ spaceId: string
+): Promise<TOctopusDeployProject[]> => {
+ const { credentials } = appConnection;
+ const { instanceUrl, apiKey } = credentials;
+
+ try {
+ const { data } = await request.get<TOctopusDeployProjectResponse[]>(`${instanceUrl}/api/${spaceId}/projects/all`, {
+ headers: {
+ "X-Octopus-ApiKey": apiKey,
+ "X-NuGet-ApiKey": apiKey,
+ Accept: "application/json"
+ }
+ });
+
+ return data.map((project) => ({
+ id: project.Id,
+ name: project.Name,
+ slug: project.Slug
+ }));
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to list Octopus Deploy projects: ${error.message || "Unknown error"}`
+ });
+ }
+
+ throw new BadRequestError({
+ message: "Unable to list Octopus Deploy projects",
+ error
+ });
+ }
+};
+
+export const getOctopusDeployScopeValues = async (
+ appConnection: TOctopusDeployConnection,
+ spaceId: string,
+ projectId: string
+): Promise<TOctopusDeployScopeValues> => {
+ const { credentials } = appConnection;
+ const { instanceUrl, apiKey } = credentials;
+
+ try {
+ const { data } = await request.get<TOctopusDeployScopeValuesResponse>(
+ `${instanceUrl}/api/${spaceId}/projects/${projectId}/variables`,
+ {
+ headers: {
+ "X-Octopus-ApiKey": apiKey,
+ "X-NuGet-ApiKey": apiKey,
+ Accept: "application/json"
+ }
+ }
+ );
+
+ const { ScopeValues } = data;
+
+ const scopeValues: TOctopusDeployScopeValues = {
+ environments: ScopeValues.Environments.map((environment) => ({
+ id: environment.Id,
+ name: environment.Name
+ })),
+ tenantTags: ScopeValues.TenantTags.map((tenantTag) => ({
+ id: tenantTag.Id,
+ name: tenantTag.Name
+ })),
+ machines: ScopeValues.Machines.map((machine) => ({
+ id: machine.Id,
+ name: machine.Name
+ })),
+ processes: ScopeValues.Processes.map((process) => ({
+ id: process.Id,
+ name: process.Name
+ })),
+ actions: ScopeValues.Actions.map((action) => ({
+ id: action.Id,
+ name: action.Name
+ })),
+ channels: ScopeValues.Channels.map((channel) => ({
+ id: channel.Id,
+ name: channel.Name
+ }))
+ };
+
+ return scopeValues;
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to get Octopus Deploy scope values: ${error.message || "Unknown error"}`
+ });
+ }
+
+ throw new BadRequestError({
+ message: "Unable to get Octopus Deploy scope values",
+ error
+ });
+ }
+};
diff --git a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-service.ts b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-service.ts
index d9342f003f..a8f969224a 100644
--- a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-service.ts
+++ b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-service.ts
@@ -1,6 +1,12 @@
+import { logger } from "@app/lib/logger";
import { OrgServiceActor } from "@app/lib/types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
-import { AppConnection } from "../app-connection-enums";
+import {
+ getOctopusDeployProjects,
+ getOctopusDeployScopeValues,
+ getOctopusDeploySpaces
+} from "./octopus-deploy-connection-fns";
import { TOctopusDeployConnection } from "./octopus-deploy-connection-types";
type TGetAppConnectionFunc = (
@@ -10,6 +16,50 @@ type TGetAppConnectionFunc = (
) => Promise<TOctopusDeployConnection>;
export const octopusDeployConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
- console.log("octopusDeployConnectionService", getAppConnection);
- return {};
+ const listSpaces = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.OctopusDeploy, connectionId, actor);
+ try {
+ const spaces = await getOctopusDeploySpaces(appConnection);
+
+ return spaces;
+ } catch (error) {
+ logger.error({ error, connectionId, actor: actor.type }, "Failed to list Octopus Deploy spaces");
+ return [];
+ }
+ };
+
+ const listProjects = async (connectionId: string, spaceId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.OctopusDeploy, connectionId, actor);
+
+ try {
+ const projects = await getOctopusDeployProjects(appConnection, spaceId);
+
+ return projects;
+ } catch (error) {
+ logger.error({ error, connectionId, spaceId, actor: actor.type }, "Failed to list Octopus Deploy projects");
+ return [];
+ }
+ };
+
+ const getScopeValues = async (connectionId: string, spaceId: string, projectId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.OctopusDeploy, connectionId, actor);
+
+ try {
+ const scopeValues = await getOctopusDeployScopeValues(appConnection, spaceId, projectId);
+
+ return scopeValues;
+ } catch (error) {
+ logger.error(
+ { error, connectionId, spaceId, projectId, actor: actor.type },
+ "Failed to get Octopus Deploy scope values"
+ );
+ return null;
+ }
+ };
+
+ return {
+ listSpaces,
+ listProjects,
+ getScopeValues
+ };
};
diff --git a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-types.ts b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-types.ts
index 9e411eb68e..2dae9b81d3 100644
--- a/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-types.ts
+++ b/backend/src/services/app-connection/octopus-deploy/octopus-deploy-connection-types.ts
@@ -21,3 +21,49 @@ export type TOctopusDeployConnectionConfig = DiscriminativePick<
TOctopusDeployConnectionInput,
"method" | "app" | "credentials"
>;
+
+export type TOctopusDeploySpaceResponse = {
+ Id: string;
+ Name: string;
+ Slug: string;
+ IsDefault: boolean;
+};
+
+export type TOctopusDeploySpace = {
+ id: string;
+ name: string;
+ slug: string;
+ isDefault: boolean;
+};
+
+export type TOctopusDeployProjectResponse = {
+ Id: string;
+ Name: string;
+ Slug: string;
+};
+
+export type TOctopusDeployProject = {
+ id: string;
+ name: string;
+ slug: string;
+};
+
+export type TOctopusDeployScopeValuesResponse = {
+ ScopeValues: {
+ Environments: { Id: string; Name: string }[];
+ TenantTags: { Id: string; Name: string }[];
+ Machines: { Id: string; Name: string }[];
+ Processes: { Id: string; Name: string }[];
+ Actions: { Id: string; Name: string }[];
+ Channels: { Id: string; Name: string }[];
+ };
+};
+
+export type TOctopusDeployScopeValues = {
+ environments: { id: string; name: string }[];
+ tenantTags: { id: string; name: string }[];
+ machines: { id: string; name: string }[];
+ processes: { id: string; name: string }[];
+ actions: { id: string; name: string }[];
+ channels: { id: string; name: string }[];
+};
diff --git a/backend/src/services/secret-sync/octopus-deploy/index.ts b/backend/src/services/secret-sync/octopus-deploy/index.ts
new file mode 100644
index 0000000000..4b1ad58b6e
--- /dev/null
+++ b/backend/src/services/secret-sync/octopus-deploy/index.ts
@@ -0,0 +1,4 @@
+export * from "./octopus-deploy-sync-constants";
+export * from "./octopus-deploy-sync-fns";
+export * from "./octopus-deploy-sync-schemas";
+export * from "./octopus-deploy-sync-types";
diff --git a/backend/src/services/secret-sync/octopus-deploy/octopus-deploy-sync-constants.ts b/backend/src/services/secret-sync/octopus-deploy/octopus-deploy-sync-constants.ts
new file mode 100644
index 0000000000..8f16a4cec3
--- /dev/null
+++ b/backend/src/services/secret-sync/octopus-deploy/octopus-deploy-sync-constants.ts
@@ -0,0 +1,10 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
+
+export const OCTOPUS_DEPLOY_SYNC_LIST_OPTION: TSecretSyncListItem = {
+ name: "Octopus Deploy",
+ destination: SecretSync.OctopusDeploy,
+ connection: AppConnection.OctopusDeploy,
+ canImportSecrets: false
+};
diff --git a/backend/src/services/secret-sync/secret-sync-enums.ts b/backend/src/services/secret-sync/secret-sync-enums.ts
index 835a314ca1..fc26f58e78 100644
--- a/backend/src/services/secret-sync/secret-sync-enums.ts
+++ b/backend/src/services/secret-sync/secret-sync-enums.ts
@@ -31,7 +31,8 @@ export enum SecretSync {
Northflank = "northflank",
Bitbucket = "bitbucket",
LaravelForge = "laravel-forge",
- Chef = "chef"
+ Chef = "chef",
+ OctopusDeploy = "octopus-deploy"
}
export enum SecretSyncInitialSyncBehavior {
diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts
index 6ee9b91d3e..fb4e03c70c 100644
--- a/backend/src/services/secret-sync/secret-sync-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-fns.ts
@@ -53,6 +53,7 @@ import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
import { LARAVEL_FORGE_SYNC_LIST_OPTION, LaravelForgeSyncFns } from "./laravel-forge";
import { NETLIFY_SYNC_LIST_OPTION, NetlifySyncFns } from "./netlify";
import { NORTHFLANK_SYNC_LIST_OPTION, NorthflankSyncFns } from "./northflank";
+import { OCTOPUS_DEPLOY_SYNC_LIST_OPTION, OctopusDeploySyncFns } from "./octopus-deploy";
import { RAILWAY_SYNC_LIST_OPTION } from "./railway/railway-sync-constants";
import { RailwaySyncFns } from "./railway/railway-sync-fns";
import { RENDER_SYNC_LIST_OPTION, RenderSyncFns } from "./render";
@@ -97,7 +98,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
[SecretSync.Northflank]: NORTHFLANK_SYNC_LIST_OPTION,
[SecretSync.Bitbucket]: BITBUCKET_SYNC_LIST_OPTION,
[SecretSync.LaravelForge]: LARAVEL_FORGE_SYNC_LIST_OPTION,
- [SecretSync.Chef]: CHEF_SYNC_LIST_OPTION
+ [SecretSync.Chef]: CHEF_SYNC_LIST_OPTION,
+ [SecretSync.OctopusDeploy]: OCTOPUS_DEPLOY_SYNC_LIST_OPTION
};
export const listSecretSyncOptions = () => {
@@ -289,6 +291,8 @@ export const SecretSyncFns = {
return LaravelForgeSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Chef:
return ChefSyncFns.syncSecrets(secretSync, schemaSecretMap);
+ case SecretSync.OctopusDeploy:
+ return OctopusDeploySyncFns.syncSecrets(secretSync, schemaSecretMap);
default:
throw new Error(
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
@@ -414,6 +418,9 @@ export const SecretSyncFns = {
case SecretSync.Chef:
secretMap = await ChefSyncFns.getSecrets(secretSync);
break;
+ case SecretSync.OctopusDeploy:
+ secretMap = await OctopusDeploySyncFns.getSecrets(secretSync);
+ break;
default:
throw new Error(
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
@@ -513,6 +520,8 @@ export const SecretSyncFns = {
return LaravelForgeSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Chef:
return ChefSyncFns.removeSecrets(secretSync, schemaSecretMap);
+ case SecretSync.OctopusDeploy:
+ return OctopusDeploySyncFns.removeSecrets(secretSync, schemaSecretMap);
default:
throw new Error(
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
diff --git a/backend/src/services/secret-sync/secret-sync-maps.ts b/backend/src/services/secret-sync/secret-sync-maps.ts
index 8829d46224..4511ce4bde 100644
--- a/backend/src/services/secret-sync/secret-sync-maps.ts
+++ b/backend/src/services/secret-sync/secret-sync-maps.ts
@@ -35,7 +35,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
[SecretSync.Northflank]: "Northflank",
[SecretSync.Bitbucket]: "Bitbucket",
[SecretSync.LaravelForge]: "Laravel Forge",
- [SecretSync.Chef]: "Chef"
+ [SecretSync.Chef]: "Chef",
+ [SecretSync.OctopusDeploy]: "Octopus Deploy"
};
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
@@ -71,7 +72,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.Northflank]: AppConnection.Northflank,
[SecretSync.Bitbucket]: AppConnection.Bitbucket,
[SecretSync.LaravelForge]: AppConnection.LaravelForge,
- [SecretSync.Chef]: AppConnection.Chef
+ [SecretSync.Chef]: AppConnection.Chef,
+ [SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy
};
export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
@@ -107,7 +109,8 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
[SecretSync.Northflank]: SecretSyncPlanType.Regular,
[SecretSync.Bitbucket]: SecretSyncPlanType.Regular,
[SecretSync.LaravelForge]: SecretSyncPlanType.Regular,
- [SecretSync.Chef]: SecretSyncPlanType.Enterprise
+ [SecretSync.Chef]: SecretSyncPlanType.Enterprise,
+ [SecretSync.OctopusDeploy]: SecretSyncPlanType.Regular
};
export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
@@ -152,7 +155,8 @@ export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
[SecretSync.Northflank]: [],
[SecretSync.Bitbucket]: [],
[SecretSync.LaravelForge]: [],
- [SecretSync.Chef]: []
+ [SecretSync.Chef]: [],
+ [SecretSync.OctopusDeploy]: []
};
const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;
@@ -214,5 +218,6 @@ export const DESTINATION_DUPLICATE_CHECK_MAP: Record<SecretSync, DestinationDupl
[SecretSync.Northflank]: defaultDuplicateCheck,
[SecretSync.Bitbucket]: defaultDuplicateCheck,
[SecretSync.LaravelForge]: defaultDuplicateCheck,
- [SecretSync.Chef]: defaultDuplicateCheck
+ [SecretSync.Chef]: defaultDuplicateCheck,
+ [SecretSync.OctopusDeploy]: defaultDuplicateCheck
};
diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts
index f1a87a9d21..75bcca7fd9 100644
--- a/backend/src/services/secret-sync/secret-sync-types.ts
+++ b/backend/src/services/secret-sync/secret-sync-types.ts
@@ -136,6 +136,12 @@ import {
TNorthflankSyncListItem,
TNorthflankSyncWithCredentials
} from "./northflank";
+import {
+ TOctopusDeploySync,
+ TOctopusDeploySyncInput,
+ TOctopusDeploySyncListItem,
+ TOctopusDeploySyncWithCredentials
+} from "./octopus-deploy";
import {
TRailwaySync,
TRailwaySyncInput,
@@ -201,7 +207,8 @@ export type TSecretSync =
| TSupabaseSync
| TNetlifySync
| TNorthflankSync
- | TBitbucketSync;
+ | TBitbucketSync
+ | TOctopusDeploySync;
export type TSecretSyncWithCredentials =
| TAwsParameterStoreSyncWithCredentials
@@ -236,7 +243,8 @@ export type TSecretSyncWithCredentials =
| TNetlifySyncWithCredentials
| TNorthflankSyncWithCredentials
| TBitbucketSyncWithCredentials
- | TLaravelForgeSyncWithCredentials;
+ | TLaravelForgeSyncWithCredentials
+ | TOctopusDeploySyncWithCredentials;
export type TSecretSyncInput =
| TAwsParameterStoreSyncInput
@@ -271,7 +279,8 @@ export type TSecretSyncInput =
| TNetlifySyncInput
| TNorthflankSyncInput
| TBitbucketSyncInput
- | TLaravelForgeSyncInput;
+ | TLaravelForgeSyncInput
+ | TOctopusDeploySyncInput;
export type TSecretSyncListItem =
| TAwsParameterStoreSyncListItem
@@ -306,7 +315,8 @@ export type TSecretSyncListItem =
| TDigitalOceanAppPlatformSyncListItem
| TNetlifySyncListItem
| TNorthflankSyncListItem
- | TBitbucketSyncListItem;
+ | TBitbucketSyncListItem
+ | TOctopusDeploySyncListItem;
export type TSyncOptionsConfig = {
canImportSecrets: boolean;
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
index 50fee8b9b1..a77398b93c 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
@@ -27,6 +27,7 @@ import { HumanitecSyncFields } from "./HumanitecSyncFields";
import { LaravelForgeSyncFields } from "./LaravelForgeSyncFields";
import { NetlifySyncFields } from "./NetlifySyncFields";
import { NorthflankSyncFields } from "./NorthflankSyncFields";
+import { OctopusDeploySyncFields } from "./OctopusDeploySyncFields";
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
import { RailwaySyncFields } from "./RailwaySyncFields";
import { RenderSyncFields } from "./RenderSyncFields";
@@ -109,6 +110,8 @@ export const SecretSyncDestinationFields = () => {
return <ChefSyncFields />;
case SecretSync.Northflank:
return <NorthflankSyncFields />;
+ case SecretSync.OctopusDeploy:
+ return <OctopusDeploySyncFields />;
default:
throw new Error(`Unhandled Destination Config Field: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 506c81a212..7ce5bdb75b 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -72,6 +72,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.Bitbucket:
case SecretSync.LaravelForge:
case SecretSync.Chef:
+ case SecretSync.OctopusDeploy:
AdditionalSyncOptionsFieldsComponent = null;
break;
default:
diff --git a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
index 561191da0c..d86e3d4738 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
@@ -25,6 +25,7 @@ import { LaravelForgeSyncDestinationSchema } from "./laravel-forge-sync-destinat
import { NetlifySyncDestinationSchema } from "./netlify-sync-destination-schema";
import { NorthflankSyncDestinationSchema } from "./northflank-sync-destination-schema";
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
+import { OctopusDeploySyncDestinationSchema } from "./octopus-deploy-sync-destination-schema";
import { RailwaySyncDestinationSchema } from "./railway-sync-destination-schema";
import { RenderSyncDestinationSchema } from "./render-sync-destination-schema";
import { SupabaseSyncDestinationSchema } from "./supabase-sync-destination-schema";
@@ -65,6 +66,7 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
DigitalOceanAppPlatformSyncDestinationSchema,
NetlifySyncDestinationSchema,
NorthflankSyncDestinationSchema,
+ OctopusDeploySyncDestinationSchema,
BitbucketSyncDestinationSchema,
LaravelForgeSyncDestinationSchema,
ChefSyncDestinationSchema
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 393aff6449..d2aefc1064 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -125,6 +125,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
[SecretSync.Chef]: {
name: "Chef",
image: "Chef.png"
+ },
+ [SecretSync.OctopusDeploy]: {
+ name: "Octopus Deploy",
+ image: "Octopus Deploy.png"
}
};
@@ -161,7 +165,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.Northflank]: AppConnection.Northflank,
[SecretSync.Bitbucket]: AppConnection.Bitbucket,
[SecretSync.LaravelForge]: AppConnection.LaravelForge,
- [SecretSync.Chef]: AppConnection.Chef
+ [SecretSync.Chef]: AppConnection.Chef,
+ [SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy
};
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
diff --git a/frontend/src/hooks/api/appConnections/octopus-deploy/index.ts b/frontend/src/hooks/api/appConnections/octopus-deploy/index.ts
new file mode 100644
index 0000000000..2c1906d369
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/octopus-deploy/index.ts
@@ -0,0 +1,2 @@
+export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/appConnections/octopus-deploy/queries.tsx b/frontend/src/hooks/api/appConnections/octopus-deploy/queries.tsx
new file mode 100644
index 0000000000..d2654d522d
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/octopus-deploy/queries.tsx
@@ -0,0 +1,98 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+import { appConnectionKeys } from "@app/hooks/api/appConnections";
+
+import { TOctopusDeployProject, TOctopusDeployScopeValues, TOctopusDeploySpace } from "./types";
+
+const octopusDeployConnectionKeys = {
+ all: [...appConnectionKeys.all, "octopus-deploy"] as const,
+ listSpaces: (connectionId: string) =>
+ [...octopusDeployConnectionKeys.all, "spaces", connectionId] as const,
+ listProjects: (connectionId: string, spaceId: string) =>
+ [...octopusDeployConnectionKeys.all, "projects", connectionId, spaceId] as const,
+ getScopeValues: (connectionId: string, spaceId: string, projectId: string) =>
+ [...octopusDeployConnectionKeys.all, "scope-values", connectionId, spaceId, projectId] as const
+};
+
+export const useOctopusDeployConnectionListSpaces = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TOctopusDeploySpace[],
+ unknown,
+ TOctopusDeploySpace[],
+ ReturnType<typeof octopusDeployConnectionKeys.listSpaces>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: octopusDeployConnectionKeys.listSpaces(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOctopusDeploySpace[]>(
+ `/api/v1/app-connections/octopus-deploy/${connectionId}/spaces`
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
+
+export const useOctopusDeployConnectionListProjects = (
+ connectionId: string,
+ spaceId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TOctopusDeployProject[],
+ unknown,
+ TOctopusDeployProject[],
+ ReturnType<typeof octopusDeployConnectionKeys.listProjects>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: octopusDeployConnectionKeys.listProjects(connectionId, spaceId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOctopusDeployProject[]>(
+ `/api/v1/app-connections/octopus-deploy/${connectionId}/projects`,
+ {
+ params: { spaceId }
+ }
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
+
+export const useOctopusDeployConnectionGetScopeValues = (
+ connectionId: string,
+ spaceId: string,
+ projectId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TOctopusDeployScopeValues,
+ unknown,
+ TOctopusDeployScopeValues,
+ ReturnType<typeof octopusDeployConnectionKeys.getScopeValues>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: octopusDeployConnectionKeys.getScopeValues(connectionId, spaceId, projectId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOctopusDeployScopeValues>(
+ `/api/v1/app-connections/octopus-deploy/${connectionId}/scope-values`,
+ { params: { spaceId, projectId } }
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/secretSyncs/enums.ts b/frontend/src/hooks/api/secretSyncs/enums.ts
index be51805c85..299eeb9e44 100644
--- a/frontend/src/hooks/api/secretSyncs/enums.ts
+++ b/frontend/src/hooks/api/secretSyncs/enums.ts
@@ -31,7 +31,8 @@ export enum SecretSync {
Northflank = "northflank",
Bitbucket = "bitbucket",
LaravelForge = "laravel-forge",
- Chef = "chef"
+ Chef = "chef",
+ OctopusDeploy = "octopus-deploy"
}
export enum SecretSyncStatus {
diff --git a/frontend/src/hooks/api/secretSyncs/types/index.ts b/frontend/src/hooks/api/secretSyncs/types/index.ts
index b4088728bd..3d9b8f149b 100644
--- a/frontend/src/hooks/api/secretSyncs/types/index.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/index.ts
@@ -25,6 +25,7 @@ import { THumanitecSync } from "./humanitec-sync";
import { TLaravelForgeSync } from "./laravel-forge-sync";
import { TNetlifySync } from "./netlify-sync";
import { TNorthflankSync } from "./northflank-sync";
+import { TOctopusDeploySync } from "./octopus-deploy-sync";
import { TOCIVaultSync } from "./oci-vault-sync";
import { TRailwaySync } from "./railway-sync";
import { TRenderSync } from "./render-sync";
@@ -75,7 +76,8 @@ export type TSecretSync =
| TNorthflankSync
| TBitbucketSync
| TLaravelForgeSync
- | TChefSync;
+ | TChefSync
+ | TOctopusDeploySync;
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };