diff --git a/ci/dagger/main.go b/ci/dagger/main.go index 0d0e25e..e3e4538 100644 --- a/ci/dagger/main.go +++ b/ci/dagger/main.go @@ -58,23 +58,55 @@ func (m *Ci) DeployHelmCharts( version string, dryRun bool, ) (string, error) { + // var result string + // container := m.deployTapService(username, password, helmValues, version, dryRun) + // output, err := container.Stdout(ctx) + // if err != nil { + // return "", err + // } + // result += output + "\n" + // return result, nil var result string - container := m.deployTapService(username, password, helmValues, version, dryRun) + container, err := m.deployTapService(username, password, helmValues, version, dryRun) + if err != nil { + return "", fmt.Errorf("deploy failed: %w", err) + } + output, err := container.Stdout(ctx) if err != nil { - return "", err + return "", fmt.Errorf("failed to get deployment output: %w", err) } + result += output + "\n" + return result, nil } func (m *Ci) deployTapService(username string, password *Secret, helmValues *string, version string, dryRun bool) *Container { + // opts := TapservicegoDeployOpts{ + // HelmValues: *helmValues, + // } + // url := "ghcr.io/%s/tapservice-chart/tapservice:%s" + // url = fmt.Sprintf(url, username, version) + // return dag.Tapservicego().Deploy(username, password, url, dryRun, opts) + + helmValuesStr := "" + if helmValues != nil { + helmValuesStr = *helmValues + } + opts := TapservicegoDeployOpts{ - HelmValues: *helmValues, + HelmValues: helmValuesStr, + } + url := fmt.Sprintf("ghcr.io/%s/tapservice-chart/tapservice:%s", username, version) + + container := dag.Tapservicego().Deploy(username, password, url, dryRun, opts) + if container == nil { + return nil, fmt.Errorf("failed to create deployment container") } - url := "ghcr.io/%s/tapservice-chart/tapservice:%s" - url = fmt.Sprintf(url, username, version) - return dag.Tapservicego().Deploy(username, password, url, dryRun, opts) + + return container, nil + } func (m *Ci) publishTapservice(