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

fix: change helm cache directories #104

Merged
merged 1 commit into from
Sep 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
11 changes: 7 additions & 4 deletions internal/cmd/local/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"

"github.com/airbytehq/abctl/internal/cmd/local/localerr"
"github.com/airbytehq/abctl/internal/cmd/local/paths"
helmclient "github.com/mittwald/go-helm-client"
"github.com/pterm/pterm"
"helm.sh/helm/v3/pkg/action"
Expand Down Expand Up @@ -39,10 +40,12 @@ func New(kubecfg, kubectx, namespace string) (Client, error) {
logger := helmLogger{}
helm, err := helmclient.NewClientFromRestConf(&helmclient.RestConfClientOptions{
Options: &helmclient.Options{
Namespace: namespace,
Output: logger,
DebugLog: logger.Debug,
Debug: true,
Namespace: namespace,
Output: logger,
DebugLog: logger.Debug,
Debug: true,
RepositoryCache: paths.HelmRepoCache,
RepositoryConfig: paths.HelmRepoConfig,
},
RestConfig: restCfg,
})
Expand Down
16 changes: 16 additions & 0 deletions internal/cmd/local/paths/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@ var (
h, _ := os.UserHomeDir()
return h
}()

// Airbyte is the full path to the ~/.airbyte directory
Airbyte = airbyte()

// AbCtl is the full path to the ~/.airbyte/abctl directory
AbCtl = abctl()

// Data is the full path to the ~/.airbyte/abctl/data directory
Data = data()

// Kubeconfig is the full path to the kubeconfig file
Kubeconfig = kubeconfig()

// HelmRepoConfig is the full path to where helm stores
// its repository configurations.
HelmRepoConfig = helmRepoConfig()

// HelmRepoCache is the full path to where helm stores
// its cached data.
HelmRepoCache = helmRepoCache()
)

func airbyte() string {
Expand All @@ -40,3 +52,7 @@ func data() string {
func kubeconfig() string {
return filepath.Join(abctl(), FileKubeconfig)
}

func helmRepoConfig() string { return filepath.Join(abctl(), ".helmrepo") }

func helmRepoCache() string { return filepath.Join(abctl(), ".helmcache") }
14 changes: 14 additions & 0 deletions internal/cmd/local/paths/paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,18 @@ func Test_Paths(t *testing.T) {
t.Errorf("Kubeconfig mismatch (-want +got):\n%s", d)
}
})

t.Run("HelmRepoConfig", func(t *testing.T) {
exp := filepath.Join(UserHome, ".airbyte", "abctl", ".helmrepo")
if d := cmp.Diff(exp, HelmRepoConfig); d != "" {
t.Errorf("HelmRepoConfig mismatch (-want +got):\n%s", d)
}
})

t.Run("HelmRepoCache", func(t *testing.T) {
exp := filepath.Join(UserHome, ".airbyte", "abctl", ".helmcache")
if d := cmp.Diff(exp, HelmRepoCache); d != "" {
t.Errorf("HelmRepoCache mismatch (-want +got):\n%s", d)
}
})
}