Skip to content

Commit

Permalink
adapt to new Helm git source API (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 authored Jan 2, 2024
1 parent 59f22a0 commit 831a226
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions cmd/helm_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ func GetHelmSource(helm *qovery.HelmResponse, chartName string, chartVersion str
updatedBranch = &charGitCommitBranch
}

if gitRepository.Url == nil {
return nil, fmt.Errorf("Invalid Helm git repository source")
}

return &qovery.HelmRequestAllOfSource{
HelmRequestAllOfSourceOneOf: &qovery.HelmRequestAllOfSourceOneOf{
GitRepository: &qovery.HelmGitRepositoryRequest{
Url: gitRepository.Url,
Url: *gitRepository.Url,
Branch: updatedBranch,
RootPath: gitRepository.RootPath,
GitTokenId: gitRepository.GitTokenId,
Expand Down Expand Up @@ -172,9 +176,13 @@ func GetHelmValuesOverride(helm *qovery.HelmResponse, valuesOverrideCommitBranch
updatedBranch = &valuesOverrideCommitBranch
}

if git.GitRepository.Url == nil {
return nil, fmt.Errorf("Invalid Helm git repository source")
}

updatedFile := qovery.HelmRequestAllOfValuesOverrideFile{}
updatedFile.SetGitRepository(qovery.HelmValuesGitRepositoryRequest{
Url: git.GitRepository.Url,
Url: *git.GitRepository.Url,
Branch: *updatedBranch,
Paths: git.Paths,
GitTokenId: git.GitRepository.GitTokenId,
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-20221221115252-24dfed35d71a
github.com/pterm/pterm v0.12.55
github.com/qovery/qovery-client-go v0.0.0-20231222093609-d7ae5a912bea
github.com/qovery/qovery-client-go v0.0.0-20240102111457-e9d5e9a578cd
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
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 @@ -194,6 +194,8 @@ github.com/qovery/qovery-client-go v0.0.0-20231219130711-1b52194296f5 h1:uTmfOdy
github.com/qovery/qovery-client-go v0.0.0-20231219130711-1b52194296f5/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/qovery/qovery-client-go v0.0.0-20231222093609-d7ae5a912bea h1:/MLgKpXXPqTJBclZ1kFbC42BXQjl77+COijlmiFpnBg=
github.com/qovery/qovery-client-go v0.0.0-20231222093609-d7ae5a912bea/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/qovery/qovery-client-go v0.0.0-20240102111457-e9d5e9a578cd h1:K3H0JYTE+VN7hIo2T/UlKgDCbL2Z8Om7vkqrhVVP7og=
github.com/qovery/qovery-client-go v0.0.0-20240102111457-e9d5e9a578cd/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
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
2 changes: 1 addition & 1 deletion utils/qovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ func DeployHelms(client *qovery.APIClient, envId string, helmNames string, chart
return deployAllServices(client, envId, req)
}

func GetGitSource(helm *qovery.HelmResponse) *qovery.ApplicationGitRepositoryRequest {
func GetGitSource(helm *qovery.HelmResponse) *qovery.ApplicationGitRepository {
if helm.Source.HelmResponseAllOfSourceOneOf != nil && helm.Source.HelmResponseAllOfSourceOneOf.Git != nil {
return helm.Source.HelmResponseAllOfSourceOneOf.Git.GitRepository
}
Expand Down

0 comments on commit 831a226

Please sign in to comment.