Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump qovery api #304

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions cmd/helm_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,25 @@ var helmUpdateCmd = &cobra.Command{
}

func GetHelmSource(helm *qovery.HelmResponse, chartName string, chartVersion string, charGitCommitBranch string) (*qovery.HelmRequestAllOfSource, error) {
if helm.Source.HelmResponseAllOfSourceOneOf != nil && helm.Source.HelmResponseAllOfSourceOneOf.Git != nil && helm.Source.HelmResponseAllOfSourceOneOf.Git.GitRepository != nil {
gitRepository := helm.Source.HelmResponseAllOfSourceOneOf.Git.GitRepository

updatedBranch := gitRepository.Branch
if git := utils.GetGitSource(helm); git != nil {
updatedBranch := git.GitRepository.Branch
if charGitCommitBranch != "" {
updatedBranch = &charGitCommitBranch
}

return &qovery.HelmRequestAllOfSource{
HelmRequestAllOfSourceOneOf: &qovery.HelmRequestAllOfSourceOneOf{
GitRepository: &qovery.HelmGitRepositoryRequest{
Url: gitRepository.Url,
Url: git.GitRepository.Url,
Branch: updatedBranch,
RootPath: gitRepository.RootPath,
GitTokenId: gitRepository.GitTokenId,
RootPath: git.GitRepository.RootPath,
GitTokenId: git.GitRepository.GitTokenId,
},
},
HelmRequestAllOfSourceOneOf1: nil,
}, nil
} else if helm.Source.HelmResponseAllOfSourceOneOf1 != nil && helm.Source.HelmResponseAllOfSourceOneOf1.Repository != nil {
repository := helm.Source.HelmResponseAllOfSourceOneOf1.Repository

} else if repository := utils.GetHelmRepository(helm); repository != nil {
updatedChartName := &repository.ChartName
if chartName != "" {
updatedChartName = &chartName
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/posthog/posthog-go v0.0.0-20240327112532-87b23fe11103
github.com/pterm/pterm v0.12.79
github.com/qovery/qovery-client-go v0.0.0-20240606072918-84193eaca1eb
github.com/qovery/qovery-client-go v0.0.0-20240606115406-339d4138b0fd
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ github.com/qovery/qovery-client-go v0.0.0-20240605161652-73fbaf1b8cff h1:BH3vj2f
github.com/qovery/qovery-client-go v0.0.0-20240605161652-73fbaf1b8cff/go.mod h1:9eHj5a4EtXGIyfbvVL3HVYW9k7Xmiwi00OqHrP4dc10=
github.com/qovery/qovery-client-go v0.0.0-20240606072918-84193eaca1eb h1:cnUhdm1uR9hQTUsXSFNLt5lC2ojaNWvSPwUaxcxE6uY=
github.com/qovery/qovery-client-go v0.0.0-20240606072918-84193eaca1eb/go.mod h1:9eHj5a4EtXGIyfbvVL3HVYW9k7Xmiwi00OqHrP4dc10=
github.com/qovery/qovery-client-go v0.0.0-20240606115406-339d4138b0fd h1:KeHiaNz+MTH+7gDEqpJUEt6Im8nIjjS2XzYXdcCoH6A=
github.com/qovery/qovery-client-go v0.0.0-20240606115406-339d4138b0fd/go.mod h1:9eHj5a4EtXGIyfbvVL3HVYW9k7Xmiwi00OqHrP4dc10=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
22 changes: 14 additions & 8 deletions utils/qovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -1720,20 +1720,26 @@ func DeployHelms(client *qovery.APIClient, envId string, helmNames string, chart
return deployAllServices(client, envId, req)
}

func GetGitSource(helm *qovery.HelmResponse) *qovery.ApplicationGitRepository {
if helm.Source.HelmResponseAllOfSourceOneOf != nil && helm.Source.HelmResponseAllOfSourceOneOf.Git != nil {
return helm.Source.HelmResponseAllOfSourceOneOf.Git.GitRepository
func GetGitSource(helm *qovery.HelmResponse) *qovery.HelmSourceGitResponse {
ret := qovery.HelmSourceGitResponse{}
if helm.Source["git"] != nil {
if unmarshal(helm.Source["git"], &ret) != nil {
return nil
}
}

return nil
return &ret
}

func GetHelmRepository(helm *qovery.HelmResponse) *qovery.HelmResponseAllOfSourceOneOf1Repository {
if helm.Source.HelmResponseAllOfSourceOneOf1 != nil {
return helm.Source.HelmResponseAllOfSourceOneOf1.Repository
func GetHelmRepository(helm *qovery.HelmResponse) *qovery.HelmSourceRepositoryResponse {
ret := qovery.HelmSourceRepositoryResponse{}
if helm.Source["repository"] != nil {
if unmarshal(helm.Source["repository"], &ret) != nil {
return nil
}
}

return nil
return &ret
}

func deployAllServices(client *qovery.APIClient, envId string, req qovery.DeployAllRequest) error {
Expand Down
Loading