fix(k8s): manifest file not persisted when deploying with manifest URL EE-1586

pull/5605/head
Hui 2021-09-10 13:35:37 +12:00 committed by GitHub
parent d166a09511
commit e86a586651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -146,8 +146,6 @@ func (handler *Handler) createKubernetesStackFromFileContent(w http.ResponseWrit
Output: output,
}
doCleanUp = false
return response.JSON(w, resp)
}
@ -193,11 +191,11 @@ func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWr
doCleanUp := true
defer handler.cleanUp(stack, &doCleanUp)
commitId, err := handler.latestCommitID(payload.RepositoryURL, payload.RepositoryReferenceName, payload.RepositoryAuthentication, payload.RepositoryUsername, payload.RepositoryPassword)
commitID, err := handler.latestCommitID(payload.RepositoryURL, payload.RepositoryReferenceName, payload.RepositoryAuthentication, payload.RepositoryUsername, payload.RepositoryPassword)
if err != nil {
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to fetch git repository id", Err: err}
}
stack.GitConfig.ConfigHash = commitId
stack.GitConfig.ConfigHash = commitID
stackFileContent, err := handler.cloneManifestContentFromGitRepo(&payload, stack.ProjectPath)
if err != nil {
@ -226,8 +224,6 @@ func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWr
Output: output,
}
doCleanUp = false
return response.JSON(w, resp)
}
@ -248,6 +244,7 @@ func (handler *Handler) createKubernetesStackFromManifestURL(w http.ResponseWrit
Type: portainer.KubernetesStack,
EndpointID: endpoint.ID,
EntryPoint: filesystem.ManifestFileDefaultName,
Namespace: payload.Namespace,
Status: portainer.StackStatusActive,
CreationDate: time.Now().Unix(),
CreatedBy: user.Username,
@ -285,6 +282,8 @@ func (handler *Handler) createKubernetesStackFromManifestURL(w http.ResponseWrit
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to persist the Kubernetes stack inside the database", Err: err}
}
doCleanUp = false
resp := &createKubernetesStackResponse{
Output: output,
}