Skip to content

Commit

Permalink
fix: change helm cache directories (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
colesnodgrass authored Sep 6, 2024
1 parent 61e503d commit d71eae2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
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)
}
})
}

0 comments on commit d71eae2

Please sign in to comment.