Commit graph

6197 commits

Author SHA1 Message Date
Matthew Fisher
8d8a27ed1f
Merge pull request #9980 from schra/feat/password-stdin
feat(helm): add --password-stdin to `helm repo add`
2021-08-20 09:39:26 -07:00
Matthew Fisher
29da1b94e9
Merge pull request #9889 from bacongobbler/fix-5567
fix: refactor downloadAll
2021-08-19 14:13:28 -07:00
Matthew Fisher
bd62fb287f
Merge pull request #9970 from howardjohn/drop-k8s
Update oras-go to latest version
2021-08-19 09:19:34 -07:00
John Howard
82a2abf512 Update oras-go to v0.4.0
Signed-off-by: John Howard <howardjohn@google.com>
2021-08-19 08:33:22 -07:00
Matthew Fisher
4b23d0a25b
fix: refactor downloadAll
This refactor cleans up downloadAll's validation, download, and save
logic:

1. A temporary directory is created, and removed after all references to
   the struct have been dropped via `defer`
2. Any local dependencies in the `charts` directory are kept intact and validated
3. Charts that have been updated are moved to the `charts` directory

This refactor has a number of improvements, including:

- tmpCharts is removed after execution
- no remote charts are downloaded to destPath: they are all pulled into
  tmpPath, validated, then moved to destPath
- lots of code cleanup/improvements, like the `if` block checking
  whether the `charts` directory was actually not a directory. In some
  cases it could be checking a `nil` object, causing a runtime panic.
- the cyclomatic complexity of the code was simplified
- extra (and in some cases, dangerous) calls to `os.RemoveAll` have been
  refactored, cleaning the code and preventing certain failure cases.

A test has been provided to demonstrate the tmpCharts removal issue has
been fixed.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2021-08-19 07:53:08 -07:00
Matthew Fisher
92bd9558e5
Merge pull request #9998 from bacongobbler/distribution-v3
Switch to distribution v3
2021-08-18 19:36:35 -07:00
André Schröder
2131f4cba8 [fix concern] implement test
Signed-off-by: André Schröder <andre.schroedr@gmail.com>
2021-08-18 15:03:13 +02:00
André Schröder
6515ea84e2 [fix concern] use io.ReadAll instead of ioutil.ReadAll
Signed-off-by: André Schröder <andre.schroedr@gmail.com>
2021-08-18 15:03:13 +02:00
Martin Hickey
d83dd95cae
Merge pull request #9774 from yxxhero/fix_msg_when_index_yaml_empty
Add a more friendly prompt when index.yaml is empty.
2021-08-18 09:59:46 +01:00
Matthew Fisher
4801818f7c
Switch to distribution v3
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2021-08-04 09:21:55 -07:00
Marc Khouzam
efe2638f87 feat(comp): Move to Cobra's bash completion V2
Cobra's bash completion V2 has the following benefits:
- aligned with the completion logic for the other shells
- provides completion descriptions as for the other shells
- uses a 300-line shell script (versus 4K lines for V1)

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-08-02 12:40:14 -04:00
Marc Khouzam
c6dfb490ab feat(comp): Add support for powershell completion
Cobra provides powershell auto-completion out of the box.  This commit
teaches helm how to use it.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-08-02 12:38:29 -04:00
André Schröder
b14fe2cead feat(helm): add --password-stdin to helm repo add
**What*

Without this commit, you can't pipe the password into `helm repo add`:

```
$ echo password | helm repo add repo-name https://repo-url --username username
Password:
Error: inappropriate ioctl for device
```

This commit introduces `--password-stdin`:

```
$ echo password | helm repo add repo-name https://repo-url --username username --password-stdin
"repo-name" has been added to your repositories
```

**Why**

There are two reasons I see for adding this:

* I personally would expect that it's possible to pipe the password into
  `helm repo add` but that's currently not the case. If I understand it
  correctly, you currently either need to pass the password via a cli
  parameter (`--password`) or use a expect/send mechanism.

* Subcommands like `helm registry login` already support
  `--password-stdin`. The cli interfaces should be consistent regarding
  which options they support.

**Notes**

I basically just copy-pasted code from `cmd/helm/registry_login.go`.

Signed-off-by: André Schröder <andre.schroedr@gmail.com>
2021-07-28 10:19:03 +02:00
Martin Hickey
e9e6b07f62
Merge pull request #9974 from viccuad/fix-win-resolver-test
test: Make internal/resolver/resolver_test.go pass on Win
2021-07-27 10:39:46 +01:00
Víctor Cuadrado Juan
84a07a4774
test: Make internal/resolver/resolver_test.go pass on Win
TestGetLocalPath() needs Windows-specific expected strings.

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
2021-07-26 16:53:18 +02:00
Martin Hickey
29d273f985
Merge pull request #9967 from longkai/fix-typo
fix(typo): fix typo of storage doc
2021-07-22 16:45:31 +01:00
Matthew Fisher
5946457ce9
Merge pull request #9675 from ndeloof/main
Migrate to oras-go library
2021-07-22 08:41:29 -07:00
longkai
2deb641efd fix(typo): fix typo of storage doc
Signed-off-by: longkai <im.longkai@gmail.com>
2021-07-22 23:32:06 +08:00
Nicolas De Loof
663c569887 Migrate to oras-go library
see https://github.com/deislabs/oras/pull/265

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-07-19 11:52:34 +02:00
Marc Khouzam
6a3daaa7aa fix(tests): Remove unnecessary test
Testing that a bad completion directive was being replaced by the
default one was actually testing Cobra's behaviour.  This is unnecessary
especially since that behaviour changed in the 1.2.0 release.  Helm
tests should focus on testing Helm's behaviour.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-07-14 17:40:42 -04:00
Marc Khouzam
95b80ed80b chore(deps): Update to Cobra 1.2.1
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-07-14 17:40:42 -04:00
Matt Farina
ea41e790a5
Merge pull request #9763 from sathieu/patch-1
Ensure RawPath match Path when resolving reference
2021-07-14 12:59:18 -04:00
Martin Hickey
433b90c4b6
Merge pull request #9929 from goodfirstissue/main
refactor: use os instead of ioutil's ReadDir
2021-07-12 15:28:30 +01:00
Josh Dolitsky
4bb28b78d9
Merge pull request #9925 from bloodorangeio/github-actions
Add build-pr github actions workflow
2021-07-09 11:25:11 -05:00
Marc Khouzam
6951cd5076 feat(cmd): Allow to specify which repos to update
This is a port to helm v3 of #5182.
A little more flexible than the v2 version, it allows to specify a list
of repositories that should be updated.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-07-08 13:01:03 -04:00
Josh Dolitsky
28f44b8269
Revert "Use official golangci-lint action"
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2021-07-08 10:10:37 -05:00
Josh Dolitsky
07a25a26f6
Use official golangci-lint action
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2021-07-08 10:06:16 -05:00
Josh Dolitsky
b16091a01a
verify golangci-lint sha256 checksum
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2021-07-08 09:59:23 -05:00
Kally Fox
f9b1445b63
refactor: use os instead of ioutil's ReadDir
Signed-off-by: Kally Fox <kallydev@gmail.com>
2021-07-08 21:28:42 +08:00
Josh Dolitsky
7605db034d
Use setup-go v2
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2021-07-07 12:19:59 -05:00
Josh Dolitsky
2f63045f25
Add build-pr github actions workflow
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2021-07-07 11:04:08 -05:00
Matt Farina
21251378b4
Merge pull request #9870 from mattfarina/fix-9859
Set Helm as manager for managedFields
2021-07-06 15:41:14 -04:00
Matt Farina
8855488272
Merge pull request #9736 from cndoit18/fix-issue-9348
fix(dep update): helm dep update is not respecting the "version" stip…
2021-07-06 14:24:08 -04:00
Adam Reese
862e2b255c
Merge pull request #9916 from adamreese/fix/golangci-timout
fix(ci-lint): increase timeout for golangci-lint
2021-07-06 11:16:10 -07:00
Adam Reese
d1da9e757e
fix(ci-lint): increase timeout for golangci-lint
Signed-off-by: Adam Reese <adam@reese.io>
2021-07-06 10:37:37 -07:00
小龙同学
cf0c6fed51
fix(doc): fix kube client interface doc. (#9882)
- add missing interface methods doc.
- fix some wrong english grammar.

Signed-off-by: longkai <im.longkai@gmail.com>
2021-07-06 10:41:55 -06:00
Matt Farina
eb99434597
Merge pull request #9871 from mattfarina/logging-for-creds
Fix the url being set by WithURL on the getters
2021-06-28 15:38:14 -04:00
Matt Farina
385fcae1ba
Adding test for user/pass without repo on Helm install
Signed-off-by: Matt Farina <matt.farina@suse.com>
2021-06-28 11:36:37 -04:00
Matt Farina
4e2e4084ed
Fix the url being set by WithURL on the getters
The URL passed to the getter for WithURL needs to be a full URL
rather than a chart reference used at the CLI. For example,
bitnami/wordpress can point to the wordpress chart in the bitnami
repo where the bitnami repo is at https://charts.bitnami.com.
WithURL needs the full URL to the repo and not bitnami/wordpress.
This is important because getters use the full URL information.
In this case the http getter uses the host name for SNI handling.

Before this change WithURL was being set to the chart reference
instead of the URL. This was a silent bug.

This change sets WithURL using a URL after for the repo is
available when a reference is used instead of a full url.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2021-06-25 20:42:10 -04:00
Matt Farina
aeb94798f0
Set Helm as manager for managedFields
managedFields were a changed that landed in 1.18. This is an array
under metadata with managedFields. The kubernetes client pkgs that
Helm uses automatically add them.

This change added a manager for the managedFields. The flow for
deciding on the name to use is:

1. An explicit name if one is chosen
2. The base name of the first os.Arg (the binary name) if no name
   explicitly set.
3. unknown if no name set and name cannot be detected

The name is at the package level as there is no other place to easily
set it for Helm v3. Since the name is for the binary or app it should
be ok to set app wide.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2021-06-25 18:36:27 -04:00
Martin Hickey
ae8e88e0d9
Merge pull request #9862 from longkai/refine-http-req
refactor(getter): refine http GET request
2021-06-25 12:47:00 +01:00
longkai
0d9ebc7885 refactor(getter): refine http GET request
It just makes the code better, I suppose the following is rational:

- use standard libaray common constants instead of hardcode though it's
  really common
- close the response body even if the http status code is not 200 OK.
  The doc says *It is the caller's responsibility to close Body*.
- move the `bytes.Buffer` return value declaration where it gets used.

Signed-off-by: longkai <im.longkai@gmail.com>
2021-06-25 13:18:48 +08:00
Adam Reese
fa558f7843
Merge pull request #9828 from cvila84/dep-tls-config
use TLS client information from repo config when downloading a chart
2021-06-21 11:34:22 -07:00
Christophe VILA
8232a76aef use TLS client information from repo config when downloading a chart
Signed-off-by: Christophe VILA <christophe.vila@thalesgroup.com>
2021-06-18 13:41:57 +02:00
Mathieu Parent
dbb4eb6b75 Ensure RawPath match Path when resolving reference
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2021-06-17 16:25:57 +02:00
Matt Farina
179f90151d
Merge pull request from GHSA-56hp-xqp3-w2jf
tweak basic handling
2021-06-16 11:12:58 -04:00
Matt Farina
17ed9c4cd3
tweak basic handling
Signed-off-by: Matt Farina <matt.farina@suse.com>
2021-06-15 06:53:31 -04:00
Martin Hickey
3e1da5f39c
Merge pull request #9795 from helm/release-3.6
Cherry-pick off the current PRs merged for 3.6.1 release
2021-06-14 09:34:47 +01:00
Mike Ng
877276ceda keep existing behavior of returning ErrReleaseNotFound when release(s) failed to decode
Signed-off-by: Mike Ng <ming@redhat.com>
(cherry picked from commit 3be333b73b)
2021-06-11 17:36:20 +01:00
Mike Ng
f2d7ed8d80 fix(sql storage): Query() should return ErrReleaseNotFound immediately when no records are found
Signed-off-by: Mike Ng <ming@redhat.com>
(cherry picked from commit b86105aebc)
2021-06-11 17:36:07 +01:00