mirror of https://github.com/portainer/portainer
fix(relative-path): not deploy git stack via unpacker EE-6043 (#10195)
parent
a8c6bd8082
commit
4ca45e89c5
|
@ -190,7 +190,7 @@ func (handler *Handler) deleteStack(userID portainer.UserID, stack *portainer.St
|
|||
if stack.Type == portainer.DockerSwarmStack {
|
||||
stack.Name = handler.SwarmStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.UndeployRemoteSwarmStack(stack, endpoint)
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ func (handler *Handler) deleteStack(userID portainer.UserID, stack *portainer.St
|
|||
if stack.Type == portainer.DockerComposeStack {
|
||||
stack.Name = handler.ComposeStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.UndeployRemoteComposeStack(stack, endpoint)
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ func (handler *Handler) startStack(
|
|||
case portainer.DockerComposeStack:
|
||||
stack.Name = handler.ComposeStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.StartRemoteComposeStack(stack, endpoint, filteredRegistries)
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ func (handler *Handler) startStack(
|
|||
case portainer.DockerSwarmStack:
|
||||
stack.Name = handler.SwarmStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.StartRemoteSwarmStack(stack, endpoint, filteredRegistries)
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ func (handler *Handler) stopStack(stack *portainer.Stack, endpoint *portainer.En
|
|||
case portainer.DockerComposeStack:
|
||||
stack.Name = handler.ComposeStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.StopRemoteComposeStack(stack, endpoint)
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ func (handler *Handler) stopStack(stack *portainer.Stack, endpoint *portainer.En
|
|||
case portainer.DockerSwarmStack:
|
||||
stack.Name = handler.SwarmStackManager.NormalizeStackName(stack.Name)
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
return handler.StackDeployer.StopRemoteSwarmStack(stack, endpoint)
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, data
|
|||
switch stack.Type {
|
||||
case portainer.DockerComposeStack:
|
||||
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
err = deployer.DeployRemoteComposeStack(stack, endpoint, registries, true, false)
|
||||
} else {
|
||||
err = deployer.DeployComposeStack(stack, endpoint, registries, true, false)
|
||||
|
@ -95,7 +95,7 @@ func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, data
|
|||
return errors.WithMessagef(err, "failed to deploy a docker compose stack %v", stackID)
|
||||
}
|
||||
case portainer.DockerSwarmStack:
|
||||
if stackutils.IsGitStack(stack) {
|
||||
if stackutils.IsRelativePathStack(stack) {
|
||||
err = deployer.DeployRemoteSwarmStack(stack, endpoint, registries, true, true)
|
||||
} else {
|
||||
err = deployer.DeploySwarmStack(stack, endpoint, registries, true, true)
|
||||
|
|
|
@ -84,7 +84,7 @@ func (config *ComposeStackDeploymentConfig) Deploy() error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if stackutils.IsGitStack(config.stack) {
|
||||
if stackutils.IsRelativePathStack(config.stack) {
|
||||
return config.StackDeployer.DeployRemoteComposeStack(config.stack, config.endpoint, config.registries, config.forcePullImage, config.ForceCreate)
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ func (config *SwarmStackDeploymentConfig) Deploy() error {
|
|||
}
|
||||
}
|
||||
|
||||
if stackutils.IsGitStack(config.stack) {
|
||||
if stackutils.IsRelativePathStack(config.stack) {
|
||||
return config.StackDeployer.DeployRemoteSwarmStack(config.stack, config.endpoint, config.registries, config.prune, config.pullImage)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,3 +47,10 @@ func SanitizeLabel(value string) string {
|
|||
func IsGitStack(stack *portainer.Stack) bool {
|
||||
return stack.GitConfig != nil && len(stack.GitConfig.URL) != 0
|
||||
}
|
||||
|
||||
// IsRelativePathStack checks if the stack is a git stack or not
|
||||
func IsRelativePathStack(stack *portainer.Stack) bool {
|
||||
// Always return false in CE
|
||||
// This function is only for code consistency with EE
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue