mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 22:51:53 +00:00
feat(secret-sync): rework GitLab secret-sync to add group variables
This commit is contained in:
@@ -7,15 +7,14 @@ import { TGitLabGroup, TGitLabProject } from "./types";
|
||||
|
||||
const gitlabConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "gitlab"] as const,
|
||||
listProjects: (connectionId: string, group?: string) =>
|
||||
[...gitlabConnectionKeys.all, "projects", connectionId, group] as const,
|
||||
listProjects: (connectionId: string) =>
|
||||
[...gitlabConnectionKeys.all, "projects", connectionId] as const,
|
||||
listGroups: (connectionId: string) =>
|
||||
[...gitlabConnectionKeys.all, "groups", connectionId] as const
|
||||
};
|
||||
|
||||
export const useGitlabConnectionListProjects = (
|
||||
connectionId: string,
|
||||
group?: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TGitLabProject[],
|
||||
@@ -27,10 +26,10 @@ export const useGitlabConnectionListProjects = (
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: gitlabConnectionKeys.listProjects(connectionId, group),
|
||||
queryKey: gitlabConnectionKeys.listProjects(connectionId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TGitLabProject[]>(
|
||||
`/api/v1/app-connections/gitlab/${connectionId}/projects${group ? `?group=${group}` : ""}`
|
||||
`/api/v1/app-connections/gitlab/${connectionId}/projects`
|
||||
);
|
||||
|
||||
return data;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||
|
||||
export enum GitlabSyncScope {
|
||||
Individual = "individual",
|
||||
Project = "project",
|
||||
Group = "group"
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export type TGitlabSync = TRootSecretSync & {
|
||||
destination: SecretSync.GitLab;
|
||||
destinationConfig:
|
||||
| {
|
||||
scope: GitlabSyncScope.Individual;
|
||||
scope: GitlabSyncScope.Project;
|
||||
projectId: string;
|
||||
projectName: string;
|
||||
targetEnvironment?: string;
|
||||
@@ -22,8 +22,7 @@ export type TGitlabSync = TRootSecretSync & {
|
||||
| {
|
||||
scope: GitlabSyncScope.Group;
|
||||
groupId: string;
|
||||
projectId: string;
|
||||
projectName: string;
|
||||
groupName: string;
|
||||
targetEnvironment?: string;
|
||||
shouldProtectSecrets?: boolean;
|
||||
shouldMaskSecrets?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user