mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
fix(edgestack): gitops auto update issue [EE-7260] (#11965)
This commit is contained in:
parent
e828615467
commit
39bdfa4512
7 changed files with 22 additions and 7 deletions
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="$ctrl.state.showConfig">
|
<div ng-if="$ctrl.state.showConfig">
|
||||||
<relative-path-fieldset value="$ctrl.stack" git-model="$ctrl.stack" is-editing="true" hide-edge-configs="true"></relative-path-fieldset>
|
<relative-path-fieldset values="$ctrl.stack" git-model="$ctrl.stack" is-editing="true" hide-edge-configs="true"></relative-path-fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<stack-environment-variables-panel
|
<stack-environment-variables-panel
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { getVariablesFieldDefaultValues } from '@/react/portainer/custom-templat
|
||||||
import { useAppTemplate } from '@/react/portainer/templates/app-templates/queries/useAppTemplates';
|
import { useAppTemplate } from '@/react/portainer/templates/app-templates/queries/useAppTemplates';
|
||||||
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
|
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
|
||||||
import { getDefaultValues as getEnvVarDefaultValues } from '@/react/portainer/templates/app-templates/DeployFormWidget/EnvVarsFieldset';
|
import { getDefaultValues as getEnvVarDefaultValues } from '@/react/portainer/templates/app-templates/DeployFormWidget/EnvVarsFieldset';
|
||||||
|
import { parseAutoUpdateResponse } from '@/react/portainer/gitops/AutoUpdateFieldset/utils';
|
||||||
|
|
||||||
import { Widget } from '@@/Widget';
|
import { Widget } from '@@/Widget';
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ export function CreateForm() {
|
||||||
retryDeploy: false,
|
retryDeploy: false,
|
||||||
staggerConfig: getDefaultStaggerConfig(),
|
staggerConfig: getDefaultStaggerConfig(),
|
||||||
method: templateParams.id ? 'template' : 'editor',
|
method: templateParams.id ? 'template' : 'editor',
|
||||||
git: toGitFormModel(),
|
git: toGitFormModel(undefined, parseAutoUpdateResponse()),
|
||||||
relativePath: getDefaultRelativePathModel(),
|
relativePath: getDefaultRelativePathModel(),
|
||||||
enableWebhook: false,
|
enableWebhook: false,
|
||||||
fileContent: '',
|
fileContent: '',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useAnalytics } from '@/react/hooks/useAnalytics';
|
||||||
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
|
import { TemplateViewModel } from '@/react/portainer/templates/app-templates/view-model';
|
||||||
import { CustomTemplate } from '@/react/portainer/templates/custom-templates/types';
|
import { CustomTemplate } from '@/react/portainer/templates/custom-templates/types';
|
||||||
import { notifySuccess } from '@/portainer/services/notifications';
|
import { notifySuccess } from '@/portainer/services/notifications';
|
||||||
|
import { transformAutoUpdateViewModel } from '@/react/portainer/gitops/AutoUpdateFieldset/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BasePayload,
|
BasePayload,
|
||||||
|
@ -89,6 +90,10 @@ export function useCreate({
|
||||||
...getBasePayload(values),
|
...getBasePayload(values),
|
||||||
git: values.git,
|
git: values.git,
|
||||||
relativePathSettings: values.relativePath,
|
relativePathSettings: values.relativePath,
|
||||||
|
autoUpdate: transformAutoUpdateViewModel(
|
||||||
|
values.git.AutoUpdate,
|
||||||
|
webhookId
|
||||||
|
),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||||
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
||||||
import { Pair } from '@/react/portainer/settings/types';
|
import { Pair } from '@/react/portainer/settings/types';
|
||||||
import { EdgeGroup } from '@/react/edge/edge-groups/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 { DeploymentType, EdgeStack, StaggerConfig } from '../../types';
|
||||||
import { buildUrl } from '../buildUrl';
|
import { buildUrl } from '../buildUrl';
|
||||||
|
@ -42,7 +42,7 @@ export type GitRepositoryPayload = {
|
||||||
/** TLSSkipVerify skips SSL verification when cloning the Git repository */
|
/** TLSSkipVerify skips SSL verification when cloning the Git repository */
|
||||||
tlsSkipVerify?: boolean;
|
tlsSkipVerify?: boolean;
|
||||||
/** Optional GitOps update configuration */
|
/** Optional GitOps update configuration */
|
||||||
autoUpdate?: AutoUpdateModel;
|
autoUpdate: AutoUpdateResponse | null;
|
||||||
/** Whether the stack supports relative path volume */
|
/** Whether the stack supports relative path volume */
|
||||||
supportRelativePath?: boolean;
|
supportRelativePath?: boolean;
|
||||||
/** Local filesystem path */
|
/** Local filesystem path */
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
||||||
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
||||||
import { Pair } from '@/react/portainer/settings/types';
|
import { Pair } from '@/react/portainer/settings/types';
|
||||||
import {
|
import {
|
||||||
|
AutoUpdateResponse,
|
||||||
GitFormModel,
|
GitFormModel,
|
||||||
RelativePathModel,
|
RelativePathModel,
|
||||||
} from '@/react/portainer/gitops/types';
|
} from '@/react/portainer/gitops/types';
|
||||||
|
@ -70,6 +71,7 @@ export type CreateEdgeStackPayload =
|
||||||
payload: BasePayload & {
|
payload: BasePayload & {
|
||||||
git: GitFormModel;
|
git: GitFormModel;
|
||||||
relativePathSettings?: RelativePathModel;
|
relativePathSettings?: RelativePathModel;
|
||||||
|
autoUpdate: AutoUpdateResponse | null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,6 +117,7 @@ async function createStackAndGitCredential(
|
||||||
payload: BasePayload & {
|
payload: BasePayload & {
|
||||||
git: GitFormModel;
|
git: GitFormModel;
|
||||||
relativePathSettings?: RelativePathModel;
|
relativePathSettings?: RelativePathModel;
|
||||||
|
autoUpdate: AutoUpdateResponse | null;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const newGitModel = await saveGitCredentialsIfNeeded(userId, payload.git);
|
const newGitModel = await saveGitCredentialsIfNeeded(userId, payload.git);
|
||||||
|
@ -144,6 +147,6 @@ async function createStackAndGitCredential(
|
||||||
payload.relativePathSettings?.PerDeviceConfigsMatchType,
|
payload.relativePathSettings?.PerDeviceConfigsMatchType,
|
||||||
perDeviceConfigsPath: payload.relativePathSettings?.PerDeviceConfigsPath,
|
perDeviceConfigsPath: payload.relativePathSettings?.PerDeviceConfigsPath,
|
||||||
tlsSkipVerify: newGitModel.TLSSkipVerify,
|
tlsSkipVerify: newGitModel.TLSSkipVerify,
|
||||||
autoUpdate: newGitModel.AutoUpdate,
|
autoUpdate: payload.autoUpdate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { RefField } from '@/react/portainer/gitops/RefField';
|
||||||
import { GitFormUrlField } from '@/react/portainer/gitops/GitFormUrlField';
|
import { GitFormUrlField } from '@/react/portainer/gitops/GitFormUrlField';
|
||||||
import { DeployMethod, GitFormModel } from '@/react/portainer/gitops/types';
|
import { DeployMethod, GitFormModel } from '@/react/portainer/gitops/types';
|
||||||
import { TimeWindowDisplay } from '@/react/portainer/gitops/TimeWindowDisplay';
|
import { TimeWindowDisplay } from '@/react/portainer/gitops/TimeWindowDisplay';
|
||||||
|
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
||||||
|
|
||||||
import { FormSection } from '@@/form-components/FormSection';
|
import { FormSection } from '@@/form-components/FormSection';
|
||||||
import { validateForm } from '@@/form-components/validate-form';
|
import { validateForm } from '@@/form-components/validate-form';
|
||||||
|
@ -102,7 +103,7 @@ export function GitForm({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{value.AutoUpdate && (
|
{isBE && value.AutoUpdate && (
|
||||||
<AutoUpdateFieldset
|
<AutoUpdateFieldset
|
||||||
environmentType={environmentType}
|
environmentType={environmentType}
|
||||||
webhookId={webhookId || ''}
|
webhookId={webhookId || ''}
|
||||||
|
|
|
@ -71,13 +71,17 @@ export interface GitFormModel extends GitAuthModel {
|
||||||
AutoUpdate?: AutoUpdateModel;
|
AutoUpdate?: AutoUpdateModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toGitFormModel(response?: RepoConfigResponse): GitFormModel {
|
export function toGitFormModel(
|
||||||
|
response?: RepoConfigResponse,
|
||||||
|
autoUpdate?: AutoUpdateModel
|
||||||
|
): GitFormModel {
|
||||||
if (!response) {
|
if (!response) {
|
||||||
return {
|
return {
|
||||||
RepositoryURL: '',
|
RepositoryURL: '',
|
||||||
ComposeFilePathInRepository: '',
|
ComposeFilePathInRepository: '',
|
||||||
RepositoryAuthentication: false,
|
RepositoryAuthentication: false,
|
||||||
TLSSkipVerify: false,
|
TLSSkipVerify: false,
|
||||||
|
AutoUpdate: autoUpdate,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,5 +100,6 @@ export function toGitFormModel(response?: RepoConfigResponse): GitFormModel {
|
||||||
RepositoryPassword: Authentication?.Password,
|
RepositoryPassword: Authentication?.Password,
|
||||||
RepositoryGitCredentialID: Authentication?.GitCredentialID,
|
RepositoryGitCredentialID: Authentication?.GitCredentialID,
|
||||||
TLSSkipVerify,
|
TLSSkipVerify,
|
||||||
|
AutoUpdate: autoUpdate,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue