8000 feat: allow pulling from OCI registries by MrMarkW · Pull Request #860 · gimlet-io/gimlet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

feat: allow pulling from OCI registries #860

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by 8000 extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions pkg/dx/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
helmCLI "helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/registry"
)

// SplitHelmOutput splits helm's multifile string output into file paths and their content
Expand Down Expand Up @@ -120,7 +121,10 @@ func CloneChartFromRepo(m *Manifest, token string) (string, error) {
}

func ChartSchema(m *Manifest, installationToken string) (string, string, error) {
client, settings := helmClient(m)
client, settings, err := helmClient(m)
if err != nil {
return "", "", err
}
chartFromManifest, err := loadChartFromManifest(m, client, settings, installationToken)
if err != nil {
return "", "", err
Expand All @@ -138,7 +142,10 @@ func ChartSchema(m *Manifest, installationToken string) (string, string, error)
}

func templateChart(m *Manifest) (string, error) {
client, settings := helmClient(m)
client, settings, err := helmClient(m)
if err != nil {
return "", err
}
chartFromManifest, err := loadChartFromManifest(m, client, settings, "")
if err != nil {
return "", err
Expand Down Expand Up @@ -177,7 +184,7 @@ func loadChartFromManifest(m *Manifest, client *action.Install, settings *helmCL
return loader.Load(cp)
}

func helmClient(m *Manifest) (*action.Install, *helmCLI.EnvSettings) {
func helmClient(m *Manifest) (*action.Install, *helmCLI.EnvSettings, error) {
actionConfig := new(action.Configuration)
client := action.NewInstall(actionConfig)

Expand All @@ -187,10 +194,24 @@ func helmClient(m *Manifest) (*action.Install, *helmCLI.EnvSettings) {
client.ClientOnly = true
client.APIVersions = []string{}
client.IncludeCRDs = false
client.DisableHooks = true
client.ChartPathOptions.RepoURL = m.Chart.Repository
client.ChartPathOptions.Version = m.Chart.Version
client.Namespace = m.Namespace

var settings = helmCLI.New()
return client, settings

// Set the registry client to support pulling charts from OCI registries
opts := []registry.ClientOption{
registry.ClientOptDebug(settings.Debug),
registry.ClientOptEnableCache(true),
registry.ClientOptWriter(os.Stdout),
registry.ClientOptCredentialsFile(settings.RegistryConfig),
}
registryClient, err := registry.NewClient(opts...)
if err != nil {
return nil, settings, err
}
client.SetRegistryClient(registryClient)
return client, settings, err
}
2 changes: 1 addition & 1 deletion web/dashboard/src/components/deployStatus/deployStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function DeployStatusModal(props) {
const key = runningDeploy.trackingId

let stack = connectedAgents[env].stacks.find(s => s.service.name === app)
const config = envConfigs[env].find((config) => config.app === app)
const config = envConfigs[env]?.find((config) => config.app === app)

if (!stack) { // for apps we haven't deployed yet
stack={service:{name: app}}
Expand Down
0