fix(stackbuilders): swarm and k8s deploys [BE-12138] (#1003)

pull/12074/merge
Devon Steenberg 2025-08-11 15:44:36 +12:00 committed by GitHub
parent 2cf1649c67
commit 6ca0085ec8
4 changed files with 60 additions and 1 deletions

View File

@ -40,6 +40,12 @@ func CreateKubernetesStackGitBuilder(dataStore dataservices.DataStore,
}
}
func (b *KubernetesStackGitBuilder) SetGeneralInfo(payload *StackPayload, endpoint *portainer.Endpoint) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetGeneralInfo(payload, endpoint)
return b
}
func (b *KubernetesStackGitBuilder) SetUniqueInfo(payload *StackPayload) GitMethodStackBuildProcess {
if b.hasError() {
return b
@ -54,6 +60,12 @@ func (b *KubernetesStackGitBuilder) SetUniqueInfo(payload *StackPayload) GitMeth
return b
}
func (b *KubernetesStackGitBuilder) SetGitRepository(payload *StackPayload) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetGitRepository(payload)
return b
}
func (b *KubernetesStackGitBuilder) Deploy(payload *StackPayload, endpoint *portainer.Endpoint) GitMethodStackBuildProcess {
if b.hasError() {
return b
@ -79,3 +91,13 @@ func (b *KubernetesStackGitBuilder) Deploy(payload *StackPayload, endpoint *port
return b.GitMethodStackBuilder.Deploy(payload, endpoint)
}
func (b *KubernetesStackGitBuilder) SetAutoUpdate(payload *StackPayload) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetAutoUpdate(payload)
return b
}
func (b *KubernetesStackGitBuilder) GetResponse() string {
return b.deploymentConfiger.GetResponse()
}

View File

@ -38,6 +38,12 @@ func CreateKubernetesStackUrlBuilder(dataStore dataservices.DataStore,
}
}
func (b *KubernetesStackUrlBuilder) SetGeneralInfo(payload *StackPayload, endpoint *portainer.Endpoint) UrlMethodStackBuildProcess {
b.UrlMethodStackBuilder.SetGeneralInfo(payload, endpoint)
return b
}
func (b *KubernetesStackUrlBuilder) SetUniqueInfo(payload *StackPayload) UrlMethodStackBuildProcess {
if b.hasError() {
return b
@ -100,7 +106,7 @@ func (b *KubernetesStackUrlBuilder) Deploy(payload *StackPayload, endpoint *port
b.deploymentConfiger = k8sDeploymentConfig
return b.Deploy(payload, endpoint)
return b.UrlMethodStackBuilder.Deploy(payload, endpoint)
}
func (b *KubernetesStackUrlBuilder) GetResponse() string {

View File

@ -28,6 +28,12 @@ func CreateSwarmStackFileUploadBuilder(securityContext *security.RestrictedReque
}
}
func (b *SwarmStackFileUploadBuilder) SetGeneralInfo(payload *StackPayload, endpoint *portainer.Endpoint) FileUploadMethodStackBuildProcess {
b.FileUploadMethodStackBuilder.SetGeneralInfo(payload, endpoint)
return b
}
func (b *SwarmStackFileUploadBuilder) SetUniqueInfo(payload *StackPayload) FileUploadMethodStackBuildProcess {
if b.hasError() {
return b
@ -42,6 +48,16 @@ func (b *SwarmStackFileUploadBuilder) SetUniqueInfo(payload *StackPayload) FileU
return b
}
func (b *SwarmStackFileUploadBuilder) SetUploadedFile(payload *StackPayload) FileUploadMethodStackBuildProcess {
if b.hasError() {
return b
}
b.FileUploadMethodStackBuilder.SetUploadedFile(payload)
return b
}
func (b *SwarmStackFileUploadBuilder) Deploy(payload *StackPayload, endpoint *portainer.Endpoint) FileUploadMethodStackBuildProcess {
if b.hasError() {
return b

View File

@ -32,6 +32,11 @@ func CreateSwarmStackGitBuilder(securityContext *security.RestrictedRequestConte
}
}
func (b *SwarmStackGitBuilder) SetGeneralInfo(payload *StackPayload, endpoint *portainer.Endpoint) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetGeneralInfo(payload, endpoint)
return b
}
func (b *SwarmStackGitBuilder) SetUniqueInfo(payload *StackPayload) GitMethodStackBuildProcess {
if b.hasError() {
return b
@ -45,6 +50,11 @@ func (b *SwarmStackGitBuilder) SetUniqueInfo(payload *StackPayload) GitMethodSta
return b
}
func (b *SwarmStackGitBuilder) SetGitRepository(payload *StackPayload) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetGitRepository(payload)
return b
}
// Deploy creates deployment configuration for swarm stack
func (b *SwarmStackGitBuilder) Deploy(payload *StackPayload, endpoint *portainer.Endpoint) GitMethodStackBuildProcess {
if b.hasError() {
@ -62,3 +72,8 @@ func (b *SwarmStackGitBuilder) Deploy(payload *StackPayload, endpoint *portainer
return b.GitMethodStackBuilder.Deploy(payload, endpoint)
}
func (b *SwarmStackGitBuilder) SetAutoUpdate(payload *StackPayload) GitMethodStackBuildProcess {
b.GitMethodStackBuilder.SetAutoUpdate(payload)
return b
}