Skip to content
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
8 changes: 6 additions & 2 deletions internal/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helm

import (
"fmt"
"strings"

"github.com/airbytehq/abctl/internal/common"
"github.com/airbytehq/abctl/internal/validate"
Expand Down Expand Up @@ -50,7 +51,7 @@ func ChartIsV2Plus(v string) bool {

// ResolveChartReference resolves an Airbyte chart reference to its full URL/path and version.
// For empty chart+version, returns latest v2 chart.
// For version-only, uses v1/v2 repo based on version number.
// For version-only, uses v1/v2 repo based on base version (strips pre-release suffix for repo selection).
// For URLs and local paths, returns as-is with version from chart metadata.
func (r *ChartResolver) ResolveChartReference(chart, version string) (string, string, error) {
if chart == "" {
Expand All @@ -61,7 +62,10 @@ func (r *ChartResolver) ResolveChartReference(chart, version string) (string, st
}
return chartURL, chartVersion, nil
} else {
if ChartIsV2Plus(version) {
// Extract base version without suffix (e.g., "1.8.4-rc5" -> "1.8.4")
// to determine which repo to use, but keep full version for URL
baseVersion, _, _ := strings.Cut(version, "-")
if ChartIsV2Plus(baseVersion) {
// Construct the v2 chart URL.
return fmt.Sprintf("%s/airbyte-%s.tgz", r.v2RepoURL, version), version, nil
} else {
Expand Down
7 changes: 7 additions & 0 deletions internal/helm/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ entries:
wantChart: fmt.Sprintf("%s/airbyte-%s.tgz", v2Server.URL, "2.1.0-beta.1"),
wantVer: "2.1.0-beta.1",
},
{
name: "version only v1 with rc suffix",
chart: "",
version: "1.8.4-rc5",
wantChart: fmt.Sprintf("%s/airbyte-%s.tgz", v1Server.URL, "1.8.4-rc5"),
wantVer: "1.8.4-rc5",
},
{
name: "chart as local ref",
chart: "local/path",
Expand Down