1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

fix(edgestack): gitops auto update issue [EE-7260] (#11965)

This commit is contained in:
Oscar Zhou 2024-06-27 08:48:03 +12:00 committed by GitHub
parent e828615467
commit 39bdfa4512
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 22 additions and 7 deletions

View file

@ -10,6 +10,7 @@ import { getVariablesFieldDefaultValues } from '@/react/portainer/custom-templat
import { useAppTemplate } from '@/react/portainer/templates/app-templates/queries/useAppTemplates';
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
import { getDefaultValues as getEnvVarDefaultValues } from '@/react/portainer/templates/app-templates/DeployFormWidget/EnvVarsFieldset';
import { parseAutoUpdateResponse } from '@/react/portainer/gitops/AutoUpdateFieldset/utils';
import { Widget } from '@@/Widget';
@ -56,7 +57,7 @@ export function CreateForm() {
retryDeploy: false,
staggerConfig: getDefaultStaggerConfig(),
method: templateParams.id ? 'template' : 'editor',
git: toGitFormModel(),
git: toGitFormModel(undefined, parseAutoUpdateResponse()),
relativePath: getDefaultRelativePathModel(),
enableWebhook: false,
fileContent: '',

View file

@ -5,6 +5,7 @@ import { useAnalytics } from '@/react/hooks/useAnalytics';
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
import { CustomTemplate } from '@/react/portainer/templates/custom-templates/types';
import { notifySuccess } from '@/portainer/services/notifications';
import { transformAutoUpdateViewModel } from '@/react/portainer/gitops/AutoUpdateFieldset/utils';
import {
BasePayload,
@ -89,6 +90,10 @@ export function useCreate({
...getBasePayload(values),
git: values.git,
relativePathSettings: values.relativePath,
autoUpdate: transformAutoUpdateViewModel(
values.git.AutoUpdate,
webhookId
),
},
};
default:

View file

@ -2,7 +2,7 @@ import axios, { parseAxiosError } from '@/portainer/services/axios';
import { RegistryId } from '@/react/portainer/registries/types/registry';
import { Pair } from '@/react/portainer/settings/types';
import { EdgeGroup } from '@/react/edge/edge-groups/types';
import { AutoUpdateModel } from '@/react/portainer/gitops/types';
import { AutoUpdateResponse } from '@/react/portainer/gitops/types';
import { DeploymentType, EdgeStack, StaggerConfig } from '../../types';
import { buildUrl } from '../buildUrl';
@ -42,7 +42,7 @@ export type GitRepositoryPayload = {
/** TLSSkipVerify skips SSL verification when cloning the Git repository */
tlsSkipVerify?: boolean;
/** Optional GitOps update configuration */
autoUpdate?: AutoUpdateModel;
autoUpdate: AutoUpdateResponse | null;
/** Whether the stack supports relative path volume */
supportRelativePath?: boolean;
/** Local filesystem path */

View file

@ -4,6 +4,7 @@ import { EdgeGroup } from '@/react/edge/edge-groups/types';
import { RegistryId } from '@/react/portainer/registries/types/registry';
import { Pair } from '@/react/portainer/settings/types';
import {
AutoUpdateResponse,
GitFormModel,
RelativePathModel,
} from '@/react/portainer/gitops/types';
@ -70,6 +71,7 @@ export type CreateEdgeStackPayload =
payload: BasePayload & {
git: GitFormModel;
relativePathSettings?: RelativePathModel;
autoUpdate: AutoUpdateResponse | null;
};
};
@ -115,6 +117,7 @@ async function createStackAndGitCredential(
payload: BasePayload & {
git: GitFormModel;
relativePathSettings?: RelativePathModel;
autoUpdate: AutoUpdateResponse | null;
}
) {
const newGitModel = await saveGitCredentialsIfNeeded(userId, payload.git);
@ -144,6 +147,6 @@ async function createStackAndGitCredential(
payload.relativePathSettings?.PerDeviceConfigsMatchType,
perDeviceConfigsPath: payload.relativePathSettings?.PerDeviceConfigsPath,
tlsSkipVerify: newGitModel.TLSSkipVerify,
autoUpdate: newGitModel.AutoUpdate,
autoUpdate: payload.autoUpdate,
});
}