Skip to content

Commit c036f9c

Browse files
committed
Let curl fail on non 2xx
1 parent 6308ec5 commit c036f9c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

helm/main.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Helm struct{}
2121
type PushOpts struct {
2222
Registry string `yaml:"registry"`
2323
Repository string `yaml:"repository"`
24-
Oci bool `yaml:"oci"`
24+
Oci bool `yaml:"oci"`
2525
Username string `yaml:"username"`
2626
Password *dagger.Secret
2727
}
@@ -101,12 +101,12 @@ func (h *Helm) PackagePush(
101101
// use a non-OCI (legacy) Helm repository
102102
// +optional
103103
// +default=false
104-
useNonOciHelmRepo bool, // Dev note: We are forced to use default=false due to https://github.com/dagger/dagger/issues/8810
104+
useNonOciHelmRepo bool, // Dev note: We are forced to use default=false due to https://github.com/dagger/dagger/issues/8810
105105
) (bool, error) {
106106
opts := PushOpts{
107107
Registry: registry,
108108
Repository: repository,
109-
Oci: !useNonOciHelmRepo,
109+
Oci: !useNonOciHelmRepo,
110110
Username: username,
111111
Password: password,
112112
}
@@ -155,7 +155,8 @@ func (h *Helm) PackagePush(
155155

156156
if useNonOciHelmRepo {
157157
curlCmd := []string{
158-
`curl --variable %REGISTRY_USERNAME`,
158+
`curl -f`,
159+
`--variable %REGISTRY_USERNAME`,
159160
`--variable %REGISTRY_PASSWORD`,
160161
`--expand-user "{{REGISTRY_USERNAME}}:{{REGISTRY_PASSWORD}}"`,
161162
`-T`,
@@ -277,12 +278,13 @@ func (h *Helm) doesChartExistOnRepo(
277278
pkgFile := fmt.Sprintf("%s-%s.tgz", name, version)
278279
// Do a GET of the chart but with response headers only so we do not download the chart
279280
curlCmd := []string{
280-
`curl --variable %REGISTRY_USERNAME`,
281-
`--variable %REGISTRY_PASSWORD`,
282-
`--expand-user "{{REGISTRY_USERNAME}}:{{REGISTRY_PASSWORD}}"`,
283-
opts.getChartFqdn(pkgFile),
284-
`--output /dev/null`,
285-
`--silent -Iw '%{http_code}'`,
281+
`curl -f`,
282+
`--variable %REGISTRY_USERNAME`,
283+
`--variable %REGISTRY_PASSWORD`,
284+
`--expand-user "{{REGISTRY_USERNAME}}:{{REGISTRY_PASSWORD}}"`,
285+
opts.getChartFqdn(pkgFile),
286+
`--output /dev/null`,
287+
`--silent -Iw '%{http_code}'`,
286288
}
287289

288290
httpCode, err := c.

0 commit comments

Comments
 (0)