Commit Graph

784 Commits

Author SHA1 Message Date
yxxhero 063ba86447
fix concurrency issue (#742)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-15 15:42:16 +08:00
yxxhero 2d9f83c1de
clean: optimize postrenderer code (#738) 2023-03-14 06:18:20 +08:00
yxxhero 5cdec2dd51
clean: helm v2 logic code (#736)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-12 00:28:39 +08:00
yxxhero 400488d3ae
bump helm to 3.11.2 (#733)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-09 09:00:48 +08:00
yxxhero c21958557c
fix: improve set and values flags help message (#724)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-07 09:21:13 +09:00
yxxhero 95c56d87fc
v1: Fix --state-values-set to override values of environments colocated with releases (#705) 2023-03-05 16:03:00 +08:00
yxxhero 522392c08c
fix get template func (#721) 2023-03-03 06:37:22 +08:00
Mitsuo Heijo dfe835a9c4
Use Masterminds/semver/v3 instead of hashicorp/go-version (#712)
Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2023-02-22 09:43:13 +08:00
yxxhero d0ef31e10b
optimize logger code (#706)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-19 23:20:47 +08:00
yxxhero f629ee1ae6
bump vals to v0.22.0 (#703)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-17 14:09:49 +08:00
xiaomudk a8574ba0cf
Fix post-renderer flag not working in diff and template subcommand (#691)
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2023-02-14 10:47:24 +08:00
yxxhero 37c213210e
bump helm to 3.11.1 (#695) 2023-02-12 20:15:57 +08:00
yxxhero 65eca3337e
fix panic issue (#690) 2023-02-10 07:32:08 +08:00
Yusuke Kuoka 8f2d97a1b3
Relax the forbid-env-with-releases policy for plain helmfile.yaml on v1 (#684) 2023-02-09 07:02:50 +08:00
Yusuke Kuoka 8c130a4fa7
fix: Make the forbid-env-with-releases policy strict on v1 (#683)
Currently, both v0 and v1 warns any usage of environments with releases within the same helmfile part.

It should rather be an error for v1, as proposed in https://github.com/helmfile/helmfile/blob/main/docs/proposals/towards-1.0.md#forbid-the-use-of-environments-and-releases-within-a-single-helmfileyaml-part.

Follow-up for #592

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-02-08 09:09:12 +08:00
Yusuke Kuoka fc027d1538
breaking: Fix the inherit feature to support multi-inheritance (#674)
* breaking: Fix the inherit feature introduced in Helmfile v0.150.0 for multi-inheritance

Follow-up for #435
Addresses https://github.com/helmfile/helmfile/discussions/656#discussioncomment-4877360 towards Helmfile v1

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Print a deprecation warning on releases[].inherit of map

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

---------

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-02-07 08:18:19 +08:00
Yusuke Kuoka 59f32512fd
Use goccy/go-yaml fork to not break dynamic values on helmfile v1 (#675)
* Use goccy/go-yaml fork to not break dynamic values on helmfile v1

I forked goccy/go-yaml to https://github.com/helmfile/go-yaml and added a commit 259d2ed450 to let it produce YAML data compatible with other legacy YAML parsers that do not support YAML 1.2.

Ref https://github.com/helmfile/helmfile/discussions/656

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Add test for goccy/go-yaml fork behavior

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

---------

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-02-06 11:39:27 +08:00
yxxhero abbdb6950b
feat: add gotmpl file ext when using helmfile.d feature (#649)
Closes #654

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-01-25 08:34:39 +09:00
yxxhero 8bea5aee3e
use latest helm previous minor version for helmfile init (#652)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-24 13:44:52 +08:00
Yusuke Kuoka bc6317122b
Disable double-rendering in V1 (#647)
* Disable double-rendering in V1

We are going to force users to separate environments and releases sections in every helmfile.yaml in the [Helmfile V1](https://github.com/helmfile/helmfile/blob/main/docs/proposals/towards-1.0.md). The goal of separation was to make the helmfile.yaml rendering result not dependent on the double-rendering and therefore the feature should be safe to be turned off in V1.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix helmfile template rendering error log for v1

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Add test for helmfile template debug log differences between v0 and v1 modes

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix helmfile template render debug log to not mention "first-pass" in v1 mode

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-01-24 12:38:11 +08:00
Yusuke Kuoka 652b609b35
Do not load the legacy default charts.yaml in v1 (#651) 2023-01-24 07:01:31 +08:00
Yusuke Kuoka ec60ac815b
feat: Add missingFileHandlerConfig.ignoreMissingGitBranch (#645) 2023-01-23 17:27:00 +08:00
Yusuke Kuoka 543629f335
Remove unused go-getter driver funcs (#643)
The go-getter driver (named `Remote`) is used to implement remote values. I found some unused functions in its implementation. This commit removes those unused functions so that it becomes more maintainable.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-01-22 16:06:43 +08:00
yxxhero cff674b7e9
bump helm to v3.11.0 (#639)
* fix conflicts

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix checksum

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-21 11:56:03 +09:00
yxxhero 1664edd0b9
add --skip-charts for destroy for disable prepare charts (#637)
* add --skip-charts for destroy for disable prepare charts

Signed-off-by: yxxhero <aiopsclub@163.com>

* add --skip-charts for delete subcmd

Signed-off-by: yxxhero <aiopsclub@163.com>

* add docs and e2e test

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-21 11:54:59 +09:00
yxxhero a724ab73f6
fix inherit chart empty check issue (#635)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-19 09:37:22 +08:00
koralsky fc634c9ee3
feat: Reset values flag (#602)
Ref https://github.com/helmfile/helmfile/discussions/593

* implemented --reset-values flag overriding .helmDefaults.reuseValues=true
* tests for --reset-values flag
* fixed pkg/app tests
* added tests for both reset & reuse flags given
* added appendValuesControlMode method for --reuse/reset-values flag processing
* updated code comments & docs

Signed-off-by: Karol Ossowski <k@koralsky.pl>
2023-01-17 09:34:37 +09:00
xiaomudk c4eb62388b
Drop Helm v2 support (#613)
Resolves #589

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2023-01-17 09:24:47 +09:00
xiaomudk 1f134d931f
fix fetch does not work with kustomized releases (#624)
* fix fetch does not work with kustomized releases

Signed-off-by: xiaomudk <xiaomudk@gmail.com>

* add tests

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
2023-01-15 09:19:01 +08:00
yxxhero 8d96bbb0e4
feat: mark deprecated args and cmd for v1 (#628)
* feat: mark deprecated args and cmd for v1

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-14 23:43:05 +08:00
yxxhero db5c2a52d6
Enhance tpl func test (#619)
enfore tpl func test

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-07 11:04:52 +08:00
Yusuke Kuoka 4688cf0132
Use gopkg.in/yaml.v2 for Helmfile v0.x (#609)
This should fix #435 for Helmfile v0.x releases since the next v0.150.0.
We introduce a new envvar to opt-in to the new YAML library, so that you can give it a shot before upgrading your Helmfile to v1. The same envvar can be used to opt-out of the new YAML library after you upgrade to Helmfile v1, giving you a more flexible migration story.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-01-04 18:17:24 +09:00
Yusuke Kuoka 490bb5d147
feat: `inherit` field for release template inheritance (#606)
* feat: `inherit` field for release template inheritance

Ref https://github.com/helmfile/helmfile/issues/435#issuecomment-1364749414

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix wording

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Comment on releaseWithInheritedTemplate

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Update Release Template doc with the new `inherit` feature

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix a typo in code comment

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-28 10:01:04 +09:00
Yusuke Kuoka 6b19577987
Fix cryptic message on values template render error (#607)
Previously a values template rendering failure resulted in a cryptic error message like:

```
	g release templates in "input.yaml": failed executing templates in release "input.yaml"."foo1": failed executing template expressions in release "foo1".values[0] = "[98 97 115 101 76 97 98 101 108 58 32 34 123 123 32 103 101 116 32 46 82 101 108 101 97 115 101 46 76 97 98 101 108 115 32 92 34 98 97 115 101 92 34 32 92 34 78 79 84 95 73 78 72 69 82 73 84 69 68 92 34 32 125 125 34 10]": template: stringTemplate:1: unexpected "\\" in operand
```

The issue was that the values template at the value position of the YAML dict was printed as a formatted byte array. We now print it as a standard string so that it is easily readable.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-27 12:54:18 +08:00
yxxhero d8cb740dcf
fix env value lost in environment values (#605)
* fix env value lost in environment values

Signed-off-by: yxxhero <aiopsclub@163.com>

* add more test

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-27 09:48:07 +08:00
Yusuke Kuoka 6664f01596
Use goccy/go-yaml for v1 / Prep bringing back go-yaml v2 for v0.x (#604)
This is a successor to #596. We need a smooth migration path from `gopkg.in/yaml.v2`, and this pull request moves it forward with `goccy/go-yaml` instead of `gopkg.in/yaml.v3`. Merging this unblocks users stuck in Helmfile v0.146.x or earlier due to #435, so that they can upgrade to 0.147.x or greater without updating their helmfile configs.

We previously tried to upgrade to `yaml.v3` (https://github.com/helmfile/helmfile/issues/394) in Helmfile v0.x, presuming it won't break anything. Apparently, it broke use-cases where you want to layer release's `values` field over three or more release templates and releases (#435).

We then tried to bring back `yaml.v2` for Helmfile v0.x and keep `yaml.v3` for the upcoming Helmfile v1. However, it failed due to incompatibility in the Unmarshaller interface between `yaml.v2` and `yaml.v3` (https://github.com/helmfile/helmfile/pull/596).

`goccy/go-yaml` is, from my observation, a well-maintained alternative to `yaml.v2`. One of its premises is that it enables us to swap the implementation from `gopkg.in/yaml.v2` to `goccy/go-yaml` just by replacing the import directive. It seems to use the same `Unmarshaller` interface as yaml.v2 too.

Once this PR gets merged, I'd like to follow-up with adding a new build-time variable and an envvar to set the proper default for the yaml parser Helmfile uses and the ability to switch the parser at runtime. All in all, the next Helmfile release, v0.150.0 will get reverted to use `gopkg.in/yaml.v2` by default which resolves #435.

New users who started using Helmfile since any of v0.148.0, v0.148.1, and v0.149.0 might be already relying on the new behavior, They might need to specify a new envvar to enable `goccy/go-yaml`.

Signed-off-by: yxxhero <aiopsclub@163.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
2022-12-27 10:14:35 +09:00
Yusuke Kuoka 7860bddedc
Re: Strict helmfile.yaml file ext when rendered as template (#599)
This is a successor to #440 rebuilt on top of #594 so that we can merge this while we are still at Hemlfile v0.x without worrying any backward-incompatibility. Much appreciation to @yxxhero for the original work!

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-23 08:28:49 +08:00
Yusuke Kuoka 8144638bab
feat: Helmfile V1 mode (#594)
* feat: Helmfile V1 mode

We add a new "V1 mode" to Helmfile so that you can seemlessly upgrade Helmfile from the current v0.x to the upcoming v1.0.

The idea is that we build both v0 and v1 binaries from the same tagged commit within the main branch, with different defaults for the "V1 mode"- the V1 mode is disabled by default for v0.x binaries, while it is enabled by default for v1.x binaries.

The V1 mode can be overrode at runtime via envvar. That is, even after upgrading the binary to v1, you will not see any backward-incompatible changes while you explicitly set an envvar, `HELMFILE_V1MODE=true`, at runtime.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-22 20:30:44 +09:00
yxxhero d8d0bf830a
Add helmfile state validate policy (#592) 2022-12-21 10:49:31 +08:00
yxxhero 8ce539f4de
use yaml v3 UnmarshalYAML (#587)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-19 06:40:07 +09:00
yxxhero 36c91c5427
optimize lint logic (#586)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-18 08:39:45 +08:00
yxxhero 7410316cf9
update postrenderer docs (#580)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-15 11:50:18 +08:00
yxxhero 17b03c22ec
bump helm to v3.10.3 (#579)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-15 09:00:22 +08:00
yxxhero ecc8988f10
clean: optimize post-render code (#577)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-14 22:06:23 +08:00
Quan TRAN 7860ac988a
Remove temporary dir as well (#563)
Fixes #540

Signed-off-by: Quan TRAN <account@itscaro.me>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
2022-12-14 08:33:07 +09:00
Yusuke Kuoka d0915641ca Fix TestGenerateID
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Yusuke Kuoka c2e7804479 Add --post-render support also for diff
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Indrek Juhkam 608bb0b525 Avoid --skip-refresh on local charts (#541)
All the dependencies get correctly installed when dealing with remote
charts.

If there's a local chart that depends on remote dependencies then those
don't get automatically installed. See #526. They end up with this
error:

```
Error: no cached repository for helm-manager-b6cf96b91af4f01317d185adfbe32610179e5246214be9646a52cb0b86032272 found. (try 'helm repo update'): open /root/.cache/helm/repository/helm-manager-b6cf96b91af4f01317d185adfbe32610179e5246214be9646a52cb0b86032272-index.yaml: no such file or directory
```

One workaround for that would be to add the repositories from the local
charts. Something like this:

```
cd local-chart/ && helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
```

This however is not trivial to parse and implement.

An easier fix which I did here is just to not allow doing
`--skip-refresh` for local repositories.

Fixes #526

Signed-off-by: Indrek Juhkam <indrek@urgas.eu>

Signed-off-by: Indrek Juhkam <indrek@urgas.eu>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
guofutan 0a953731b0 fix(#507): support assign --post-renderer within helmfile flags and helmdefault or release config
1. only implement post-renderer flags this patch
2. As mumoshu advise, add helmfile flags `--post-render` and add the
   postRenderer  config in helmDefaults and release. the priority is
   helmfile flags > release > helmDefaults.
3. fix the test case in state_test.go and some other tests.

Signed-off-by: guofutan <guofutan@tencent.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
guofutan 1f0f7ec8d6 fix(#510): fea add postRenderer and postRendererArgs config in helmDefault of helmfile.yaml
Signed-off-by: guofutan <guofutan@tencent.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
guofutan 4cc07daced fix(#510): fix golangci-lint run error,add the unit test, add the compatibility when there is blank in the args values.
Signed-off-by: guofutan <guofutan@tencent.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
guofutan 7be64f29cf fea(#507): support assign `--post-renderer` and `--post-renderer-args` within args in helmDefaults when use helm v3
Signed-off-by: guofutan <guofutan@tencent.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
xiaomudk 94381c1e17
Fix preapply hooks are not called on no diff when run apply subcommand (#522)
* Fix presync hooks are not called on no diff when run apply subcommand

Signed-off-by: xiaomudk <xiaomudk@gmail.com>

* Update docs/index.md

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: xiaomudk <xiaomudk@gmail.com>

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-10 12:07:26 +09:00
yxxhero 70a1b3b513
Fix snapshot tests to pass regardless of helm version (#572)
* Fix snapshot tests to pass regardless of helm version

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-10 10:54:03 +08:00
Quan TRAN 398c812e49
Use go-getter with secrets as well (#560)
* Use go-getter with secrets as well

Signed-off-by: Quan TRAN <account@itscaro.me>
2022-12-09 07:46:28 +08:00
xiaomudk 7844145ee3
Allow helmfile statefile to passed by stdin (#520)
* Allow helmfile statefile to passed by stdin

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-11-22 11:34:05 +08:00
yxxhero 85f577e551
Merge pull request #533 from xiaomudk/patch-9
Fix getArray function copy error
2022-11-22 07:15:48 +08:00
xiaomudk a05ccab6c3 Fix getArray function copy error
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-11-21 23:30:13 +08:00
koralsky 1ba83ae722
declare "reuse values" control mode in helmDefaults (#527)
* support for helmDefaults.reuseValues

Signed-off-by: Karol Ossowski <k@koralsky.pl>
2022-11-20 08:47:48 +08:00
Yusuke Kuoka 8d2aec249d Use the new log capturing helper in all tests
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-11-13 08:53:53 +00:00
Yusuke Kuoka 6b69b31754 Use log capturing helper in TestApply_hooks
Along with the addition of the new arg to the helper for log level customization.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-11-13 08:20:13 +00:00
yxxhero 143f85b4f1 fix: helmfile template fails when selector matches a chart fetched with go-getter
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-13 15:10:57 +08:00
Yusuke Kuoka 844f6e9583 Introduce a new test helper for easier log snapshot testing
Use the new runWithLogCapture helper instead of the long boilerplate to capture the log for snapshot testing.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-11-13 03:24:24 +00:00
Lassi Pölönen 0f44cfacc4
Add the ability to specify a lock file (#432)
Allow configuring the lockfile in the state. This makes it possible for
example maintain a lock per environment.

Signed-off-by: Lassi Pölönen <lassi.polonen@iki.fi>

Signed-off-by: Lassi Pölönen <lassi.polonen@iki.fi>
2022-11-12 08:59:56 +09:00
yxxhero 2324188695 bump: helm to 3.10.2
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-11 13:54:35 +08:00
Helge Eichelberg 8f59a1c18a
Add --output-dir-template flag to the fetch command (#456)
* Add --output-dir-template flag to the fetch command

Signed-off-by: elchenberg <elchenberg@users.noreply.github.com>
2022-11-05 18:55:02 +08:00
yxxhero bc3528ae09 fix: args parse issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 10:53:00 +09:00
xiaomudk 6dcde20d7a
Add subcommand init for checks and installs helmfile deps (#389)
* Add subcommand init for checks and installs helmfile deps

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-11-03 14:51:30 +08:00
Quan TRAN e919b4b1d2
fix oci:// chart (#477)
* fix oci:// chart

Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
2022-11-01 13:50:05 +08:00
Quan TRAN 414f899c28
use fs.Getwd() to get working dir for sub helmfile (#471)
* use fs.Getwd() to get working dir for sub helmfile

Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
2022-10-29 07:40:40 +08:00
Quan TRAN 2702161e74
add basepath along with filepath into yaml comment (#460)
* add basepath along with filepath into yaml comment

Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
2022-10-25 17:44:28 +08:00
yxxhero f8a297bbac fix --debug flag
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-25 08:24:23 +08:00
yxxhero bc255f3e51 fix: fix need logic in chart stage
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-24 09:51:04 +08:00
Indrek Juhkam a409b450cd
Add `--skip-refresh` flag to the build command (#444)
This improves the `helmfile sync` performance.

From the code: `BuildDeps` is used only by `runHelmDepBuilds`, which
only is used by `PrepareCharts` which is finally only used by
`withPreparedCharts`.

`withPreparedCharts` already does `SyncReposOnce` which means we do not
have to refresh the local repository cache on each chart build.

This is only supported in Helm v3.

This seems to be mostly affecting helmfiles which have a lot of releases
and those release charts use sub dependencies.

I saw significant performance improvements for a helmfile with 45
releases, 2 repositories, and most of the charts also had their own
dependencies. Results:

Before the patch:
* real  9m10.565s
* real  9m38.335s
* real  9m14.941s
* real  5m13.106s (with cache)

After the patch:
* real  6m51.965s
* real  6m36.605s
* real  6m31.685s
* real  3m0.271s (with cache)

These were tested with:
```
rm -rf ~/.cache/helmfile ~/.cache/helm ~/.config/helm/repositories.* && helmfile sync ...
```

The result with `(with cache)` was without deleting the caches first.

From these metrics it seems that the sync duration decreased 20-45%
depending on the run, release count, dependencies and if the cache was
used or not.

As far as I understand, this should be backward-compatible change.

Signed-off-by: Indrek Juhkam <indrek@urgas.eu>

Signed-off-by: Indrek Juhkam <indrek@urgas.eu>
2022-10-20 09:03:08 +09:00
yxxhero f2be4861d5
Merge pull request #441 from helmfile/move_upgrade_notice_env_into_envvar 2022-10-20 05:18:19 +08:00
yxxhero 420f5b2079
Merge pull request #451 from helmfile/445-01470-fails-to-execute-diff
fix helmfile diff error in window platform
2022-10-19 18:18:02 +08:00
yxxhero 94cc07cdf2
Merge pull request #446 from helmfile/fix_deps_args
fix: fix deps args
2022-10-19 18:15:43 +08:00
yxxhero 62cbeb661d fix helmfile diff error in window platform
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-19 17:50:56 +08:00
yxxhero 61233badd5 fix: issue path in test on windows
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-19 08:46:43 +08:00
yxxhero da2ce574b0 fix: fix deps args
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-18 22:01:05 +08:00
yxxhero ed228c9c7e move HELMFILE_UPGRADE_NOTICE_DISABLED into envvar file
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-15 14:22:51 +08:00
Rui Chen ffce09a35f
deps: update dockerfile dependencies (#421)
* deps: helm 3.10.0

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-10-12 20:41:26 +08:00
Yusuke Kuoka b7da0965f1 fixup! Address a lint error
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka ef115ba653 Address a lint error
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 85bfe64b90 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka caee32f7be fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka a2d5d82cb6 fixup! fixup! fixup! fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 3e2285ea72 fixup! fixup! fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka f7f858cc52 fixup! fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 95065f8d28 fixup! fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 2ff0969e3b fixup! fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 3a5d9efb20 fixup! fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka 111a248523 fixup! Fix preapply hook behavior
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka c2ea0f0355 Fix preapply hook behavior
Fixes #399

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 08:20:51 +08:00
Yusuke Kuoka e001f6f05d Address golangci-lint finding
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 06:19:32 +09:00
Yusuke Kuoka c762310a5f fixup! Prevent excessive log in tests
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 06:19:32 +09:00
Yusuke Kuoka 31cd729fd4 Prevent excessive log in tests
I had been unhappy with the fact that our go-test output had a lot of debug log messages which obfuscated test results.

I'm finally removeing all those by directing the test log output to io.Discard.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-11 06:19:32 +09:00
yxxhero 6a36f34c7d
fix: child process not exit when recive term signal (#418)
* fix: child process not exit when recive term signal

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: wait for clean done

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-09 17:51:52 +09:00
yxxhero ad257554c9
Merge pull request #419 from helmfile/405-helmfile-deps-cannot-create-a-lock-file-for-an-oci-repo
fix: helmfile deps issue with oci repo
2022-10-09 09:13:46 +08:00
yxxhero d1c31e8c17 fix: helmfile deps issue with oci repo
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-09 08:56:52 +08:00
yxxhero 21c28ca6d0
feat: add reuse-values args for diff apply and sync (#411)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-08 14:27:39 +09:00
yxxhero 8f7796b260
feat: optimize version output (#412)
* feat: optimize version output

Signed-off-by: yxxhero <aiopsclub@163.com>

* Update docs/index.md

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-08 14:26:15 +09:00
yxxhero e06abe4620
feat: add more clear error message and Environment info for template (#413)
* feat: add more clear error message and Environment info for template

Signed-off-by: yxxhero <aiopsclub@163.com>

* Update pkg/state/state.go

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-07 10:56:32 +09:00
Kevin Leturc 422852dd9a feat: retrieve repository's username/password from environment
Signed-off-by: Kevin Leturc <kevinleturc@users.noreply.github.com>
2022-10-06 16:48:44 +02:00
yxxhero bffa048dc6
Merge pull request #396 from helmfile/bump_yaml_v3
bump: upgrade gopkg.in/yaml.v2 to gopkg.in/yaml.v3
2022-10-05 10:12:25 +08:00
yxxhero e6b263340d
Merge pull request #388 from helmfile/fix_retain_values_issue
fix SetRetainValuesFiles issue
2022-10-05 10:10:34 +08:00
Felipe Santos f15bdbbb0c Use helm show chart to identify chart version
Signed-off-by: Felipe Santos <felipecassiors@gmail.com>
2022-10-03 22:04:08 -03:00
mugioka 68728ef352 chore: add test for gatherOCIUsernamePassword.
Signed-off-by: mugioka <okamugi0722@gmail.com>
2022-10-03 15:45:40 +09:00
mugioka a42c14e640 imprv: convert hyphen included in repo name to underbar with gatherOCIUsernamePassword.
Most shells do not support hyphens in environment variables.

However, there are cases where you may want to include hyphens in the repository name.

Therefore, I have included a process in `gatherOCIUsernamePassword` to replace hyphens with underbar.

Signed-off-by: mugioka <okamugi0722@gmail.com>
2022-10-03 14:49:03 +09:00
yxxhero 14ba7cd156 bump: upgrade gopkg.in/yaml.v2 to gopkg.in/yaml.v3
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-03 05:24:51 +08:00
yxxhero 06cfdfc891 fix SetRetainValuesFiles issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-24 12:10:42 +08:00
yxxhero a36f07cda3 fix path issue in windows
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-23 09:10:36 +08:00
Yusuke Kuoka c90cace43b fixup! Fix not to ignore diff selector when it matched nothing
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 04:46:52 +00:00
Yusuke Kuoka 6aeb6b38ba Fix not to ignore diff selector when it matched nothing
Fixes #327

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 04:46:52 +00:00
Yusuke Kuoka bb13ef68d7 fixup! Add more testcases for hooks
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 02:31:07 +00:00
Yusuke Kuoka dc40ccde2e Add more testcases for hooks
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 02:19:42 +00:00
Yusuke Kuoka 793050cc18 Defer implementing preapply hook start logs to another commit/pr
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 00:44:31 +00:00
Yusuke Kuoka 9e673ca902 Write preapply notice to debug log instead of info
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 00:27:33 +00:00
Yusuke Kuoka 5b1606df75 fixup! Updates based on review comments
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting 3c0456c577 Updates based on review comments
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting 1e9cce7d36 Fix lint errors
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting f0b76e9e26 Fixes for updates from rebase
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting fcdd852153 Add unittests for new preapply functions
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting ea56061609 Move preapply code to separate function
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting ca7942c751 Uncomment code that was accidentally commented out
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting eb2419aa15 Remove unnecessary if statement
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting c6e8afd3d0 Remove logic that limits execution of hooks to only once
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting 32477e6cf2 Fix merge conflicts
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting db81f18095 Only run preapply or presync
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting 1a3c11dffd Add unittests for preapply
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
Anton Bretting 4e5987d833 Add preapply hook
Signed-off-by: Anton Bretting <sajfer@gmail.com>
2022-09-19 08:55:44 +09:00
yxxhero 0341027bc0
Merge pull request #371 from toVersus/fix/oci-pull-bug
fix: add missing untar flag to pull chart from oci registry
2022-09-18 19:36:39 +08:00
Tsubasa Nagasawa 7b40cefdda
fix: add missing untar flag to pull chart from oci registry
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2022-09-18 19:11:34 +09:00
yxxhero 18eee1fa47
move interactive option to global (#370)
Fixes #366

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-18 18:47:40 +09:00
Arpan e1ca846772
added option for --no-hooks for helm diff and apply (#279)
* added option for --no-hooks for helm diff and apply

Signed-off-by: Arpan Adhikari <kcarpan5@gmail.com>

* test case for --no-hooks

Signed-off-by: Arpan Adhikari <kcarpan5@gmail.com>

* fix test fails

Signed-off-by: Arpan Adhikari <kcarpan5@gmail.com>

* Resolve conflict with main

Signed-off-by: Arpan Adhikari <kcarpan5@gmail.com>

* fixup! Resolve conflict with main

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Add no-hooks case for diff test

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* fixup! Add no-hooks case for diff test

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Arpan Adhikari <kcarpan5@gmail.com>
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Co-authored-by: Arpan Adhikari <arpan@thephotostudio.com.au>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-18 18:41:27 +09:00
Jean-Yves CAMIER b8cf0f156e
fix(oci): clean dead code (#290)
fix(oci): remove dead code

Signed-off-by: Jean-Yves CAMIER <jycamier@gmail.com>
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-18 16:34:16 +09:00
Rodrigo Fior Kuntzer 8408b021f0
feat: show live output from the Helm binary (#286)
* feat: show live output from the Helm binary

Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>

* fixup! Merge branch 'main' into enable-live-output

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-18 14:24:35 +09:00
KqLLL 0fbcb07bad
Support helm-secrets v4.0.0 (#360)
Support helm-secret v4.0.0

Signed-off-by: KqLLL <lllkq546449541@gmail.com>
2022-09-17 19:54:28 +09:00
yxxhero 3ff98c02a1
Merge pull request #359 from helmfile/358-incorrect-exit-code
Fix incorrent exit code issue introduced in v0.145.0
2022-09-14 08:51:16 +08:00
yxxhero ade8e81cc1
Merge pull request #342 from helmfile/339-introduction-of-skip-needs-results-in-breaking-change
Fix --skip-needs regression introduced in v0.145.0
2022-09-14 08:50:38 +08:00
yxxhero 76bf9952b9 fix incorrent exit code
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-13 08:23:55 +08:00
yxxhero bf323b4021 fixed: fix skip-needs issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-12 18:04:20 +08:00
Viktor Oreshkin af52c960f4 chore: list: withPreparedCharts -> skipCharts
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 09:54:51 +03:00
Viktor Oreshkin 4dd73d4efb test: move TestListWithJSONOutput to app_list_test
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 09:48:47 +03:00
Viktor Oreshkin 1838ec0a11 fix: make func names in app_list_test consistent
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 09:48:17 +03:00
Viktor Oreshkin ebf0f370a1 fix: add missing concurrency option to List
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 09:43:56 +03:00
Viktor Oreshkin f3788249e4 feat: add flag to list to skip prepare
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-05 18:12:17 +03:00
Viktor Oreshkin 8b0ad72e77 feat: dont prepare on list
This changes list command so it doesn't run withPreparedCharts,
and just lists releases instead

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-05 13:37:00 +03:00
Viktor Oreshkin 822b7b2a9b feat: honor concurrency in withPreparedCharts
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-01 02:08:54 +03:00
yxxhero 9284d1764e
Add --interactive option to sync, delete and destroy / Remove --interactive from global options (#328)
* add interactive in sync & remove --interactive in global options

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix unittest

Signed-off-by: yxxhero <aiopsclub@163.com>

* same behave as apply when in interactive

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-28 10:36:07 +09:00
Arkaitz Jimenez cc33e7b7d8
Introduce Helmfile's own filesystem abstraction to correctly unit test some components (#307)
Use abstracted FS

Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>

Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-24 12:58:43 +09:00
yxxhero 7972a8921c
Merge pull request #301 from mikelorant/fix/diff-context
fix: return diff context config value
2022-08-18 15:09:23 +08:00
Michael Lorant b616a8b690 fix: return diff output config value
Signed-off-by: Michael Lorant <michael.lorant@fairfaxmedia.com.au>
2022-08-18 17:06:31 +10:00
Michael Lorant 86deeb377d fix: return diff context config value
Signed-off-by: Michael Lorant <michael.lorant@fairfaxmedia.com.au>
2022-08-18 16:40:05 +10:00
Arkaitz Jimenez 4553efdcf1 Formatting
Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-16 16:25:24 +02:00
Arkaitz Jimenez 684be0af50 Missing context readDir, required for any template using readDir* functions
Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-16 16:25:24 +02:00
Yusuke Kuoka bb056a4ffc fixup! Merge branch 'main' into update_golang_lint
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-08-14 04:06:45 +00:00
Yusuke Kuoka 89950f3794
Merge branch 'main' into update_golang_lint 2022-08-14 12:21:10 +09:00
yxxhero 94b7a6c128
Cleanup pkg/config/config.go (#287)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-14 12:17:02 +09:00
David Ackroyd cf94a4edb3
Fix Inclusion of Releases for Other Environments (#276)
Fixing releases being included which do not match the environment
 requested, which is a regression introduced by #234. The issue remains
 when Helmfile state values are supplied, which is not a regression and
 will be addressed separately.

Partial resolution for #271

Signed-off-by: David Ackroyd <dackroyd@fairfaxmedia.com.au>

Signed-off-by: David Ackroyd <dackroyd@fairfaxmedia.com.au>
2022-08-14 10:47:47 +09:00
yxxhero 8690d63401 fix lint error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-13 07:40:32 +08:00
Vladimir Kuznichenkov 6c1b6f855a
Add file existence check for remove values
If remote file isn't present in repo we will add it anyway to the files list and check `if len(files) == 0 {` never will be true. That leads to missing section with `MissingFileHandler`.

That fix check that cloned file actually exists. In that case if we add a link to non-existing remote file `MissingFileHandler` will be called as expected.

Signed-off-by: Vladimir Kuznichenkov <kuzaxak.tech@gmail.com>
2022-08-12 10:01:56 +03:00
yxxhero 6a37ae9650
Add flags about need for lint subcmd (#273)
* fix typo

Signed-off-by: yxxhero <aiopsclub@163.com>

* add flags about needs for lint subcmd

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-08 10:32:30 +09:00
Sergii Iefremov 5ac1e1fb98 feat: fix needs error with context that includes slash
Signed-off-by: Sergii Iefremov <sergii.iefremov@axios.com>
2022-08-04 11:18:57 -04:00
yxxhero 9af8f1286a
Merge pull request #254 from vasicvuk/main
Implement readDirEntries method
2022-07-27 19:00:38 +08:00
vasicvuk 68d7c5f6a4 Implement readDirEntries method
Signed-off-by: vasicvuk <vuk.vasic@asseco-see.rs>
2022-07-26 16:20:38 +02:00
yxxhero 4e9b99d10e
Merge pull request #258 from xiaomudk/patch-4
fix: OCI Url and Version parse error
2022-07-23 21:14:04 +08:00
xiaomudk 59ffa687df fix: OCI Url and Version parse error
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-07-23 20:52:32 +08:00
xiaomudk cf62499d4a test: Add unit tests for ChartPull
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-07-23 18:41:59 +08:00
xiaomudk 70fd920384 test: Add unit tests for ChartExport
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-07-23 16:32:09 +08:00
yxxhero 85ade797ab
Use cobra (#234)
switch to cobra

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-19 21:06:18 +09:00
Quan TRAN 9884e4fdb1 (fix) path on windows
ci
on canary build, version should show "0.0.0-dev"

Signed-off-by: Quan TRAN <account@itscaro.me>
2022-07-18 11:07:58 +02:00
yxxhero ac23def893 add Go lint
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-16 20:21:11 +08:00
Yusuke Kuoka cc13492623
Merge pull request #201 from magicmemories/fix/helm-secrets-view
fix: use helm secrets view rather than helm secrets dec to decrypt
2022-07-16 21:04:48 +09:00
Adam Gardner a93661d382 chore: remove obsolete exemption of os.PathError in test case
Signed-off-by: Adam Gardner <adam.gardner@magicmemories.com>
2022-07-10 09:15:18 -10:00
Radon Rosborough de6a9aeebf Fix Test_DecryptSecretWithGotmpl
Signed-off-by: Radon Rosborough <rrosborough@plaid.com>
2022-07-07 16:26:33 -10:00
Radon Rosborough c1eb7f0623 Fix Test_DecryptSecret
Signed-off-by: Radon Rosborough <rrosborough@plaid.com>
2022-07-07 16:26:33 -10:00
Adam Gardner 74c1f9e9a0 fix: use helm secrets view rather than helm secrets dec to decrypt
Signed-off-by: Adam Gardner <adam.gardner@magicmemories.com>

chore: fix test case broken by change of helm subcommand

Signed-off-by: Adam Gardner <adam.gardner@magicmemories.com>
2022-07-07 16:26:12 -10:00
yxxhero 9179cfb55f fix deps issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-06 08:37:19 +08:00
yxxhero 9b0293d9ea
fix within func issue (#209)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-05 17:50:43 +09:00
yxxhero ae5e93d71d
Merge pull request #200 from magicmemories/fix/invalid-path-on-windows
Fix/invalid path on windows
2022-06-30 14:00:07 +08:00
Adam Gardner e106d105ce Don't make unnecessary whitespace changes
Signed-off-by: Adam Gardner <adam.gardner@magicmemories.com>
2022-06-29 15:06:40 -10:00
Adam Gardner a81c8fa4e1 chore: rename test so that snapshot data lives at valid path on all filesystems
Signed-off-by: Adam Gardner <adam.gardner@magicmemories.com>
2022-06-29 15:06:40 -10:00
Eng Zer Jun ce3b81e2a1
test: use `T.Setenv` to set env vars in tests (#189)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-06-30 09:15:34 +09:00
yxxhero 5bd5f72170
add unittest for text_renderer.go (#168)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-29 20:33:15 +09:00
Yusuke Kuoka fc306ec3d1
Make a few helmfile sub-commands consistently support needs-related flags (#78)
* Make a few helmfile sub-commands to consistently support needs-related flags

* helmfile-diff adds support for --include-transitive-needs
* helmfile-template adds support for --skip-needs
* helmfile-lint adds support for --skip-needs, --include-needs, and --include-transitive-needs

Ref https://github.com/roboll/helmfile/issues/2055

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix a few helmfile-lint needs related bugs and add tests

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Is include-transitive-needs realy working as intended? 🤔

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Confirm that it does fail on unselected need by default

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Add missing testdata

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Test helmfile-template for include/skip needs support

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix a few terms

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Add more tests to better know the current helmfile-diff behavior around needs

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix failing tests

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix helmfile-diff to consistently handle skip/include-needs

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Extract testhelper.RequireLog for reusing

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix all bugs and test cases for TestDiff and TestDiff_2

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix TestDiff_2

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix TestDiff

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix TestDiffWithNeeds

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Unify behavior on including disabled releases as needs for lint and template

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix bug that --include-transitive-needs does not imply include-needs

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-20 07:19:39 +09:00
Sergio Morales 414db47428
chore(state): Append Api Versions flags to helm-diff (#107)
* chore(state): Append Api Versions flags to helm-diff

Signed-off-by: Sergio Morales <sergio@cornershopapp.com>

* chore(state): Added unit test to state.flagsForDiff

Signed-off-by: Sergio Morales <sergio@cornershopapp.com>

* chore(state): Check Helmstate values if ReleaseSpec values aren't set

Signed-off-by: Sergio Morales <sergio@cornershopapp.com>
2022-06-05 15:18:54 +09:00
Quan TRAN 577f54af7a
Introduce DISABLE_INSECURE_FEATURES to disable insecure command executions (#1)
* introduce DISABLE_INSECURE_FEATURES to disable insecure executions

Signed-off-by: Quan TRAN <account@itscaro.me>

* disable remote sources when DISABLE_INSECURE_FEATURES is set to "true"

Signed-off-by: Quan TRAN <account@itscaro.me>

* refactor envvar package

Signed-off-by: Quan TRAN <account@itscaro.me>

* (test) fix test fixtures

Signed-off-by: Quan TRAN <account@itscaro.me>

* use absolute path to avoid unit test failure

Signed-off-by: Quan TRAN <account@itscaro.me>

* Fix conflicts

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 15:15:06 +09:00
Dominic 789af92c09
Adds feature to fetch release values and secret values from remote (#47)
* Adds feature to fetch environment values from remote

The releases and environment section allow for values files on the local
disk.
This enhancement allows for referencing remote (go-getter) files to be
fetched, cached and referenced.

In addition when fetching a remote git source with a ssh key the ssh key
will not be part of the caching folder name. This avoids two problems:
1. Don't leak sensitive information in the name of the caching folder
2. Base64 encoded SSH keys are very long. On some file systems the max
lenght of the directory name is hit when using the full base64
information in the path name.

The sshkey informations are reducted. Because of this fixed string
there is a change of colloding cache names. The likelihood of this
collision is very low. The git repo and git reference need to be the
same, but the sshkey can change. This will result in the same source to
be checkout out and referenced.

Signed-off-by: Lüchinger Dominic <dev@snowgarden.ch>

* Update pkg/state/storage.go

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 15:08:38 +09:00
yxxhero aaf2126f91 little code optimize
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-05 12:58:55 +08:00
Yusuke Kuoka 7c34e2e1b7
Merge pull request #83 from yxxhero/refactor_main
reconstruct main function
2022-06-05 13:27:04 +09:00
Yusuke Kuoka b986b3de9f
Merge pull request #99 from yxxhero/add_e2e_tmpl_test
add e2e tmpl test
2022-06-05 13:23:08 +09:00
yxxhero 8024949d48 reconstruct_main_function
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-01 07:32:36 +08:00
Quan TRAN a92c574a98
Merge pull request #112 from yxxhero/remove_unused_comments
remove unused comments
2022-05-30 23:12:19 +02:00
Quan TRAN 0cfef76f0d
Merge pull request #88 from chubchubsancho/validate_manifest_on_sync
feat: allow --validate on sync command
2022-05-30 10:11:53 +02:00
yxxhero 0c57129aab remove unused comments
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-30 10:08:19 +02:00
yxxhero 33c66a6f46 add readfile e2e test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
Yusuke Kuoka 281fe9bf59
Merge pull request #101 from austince/rename-module
Rename module to github.com/helmfile/helmfile
2022-05-22 15:19:16 +09:00
austin ce eb3484d4a8
Rename module to github.com/helmfile/helmfile
Also updates a few more references to the roboll/helmfile repository,
where possible.

Signed-off-by: austin ce <austin.cawley@gmail.com>
2022-05-18 10:05:07 -04:00
Grégory SANCHEZ 62747378ca feat: allow --validate on sync command
This will permit usage of `--validate` options with sync command

Signed-off-by: Grégory SANCHEZ <gregory.sanchez@icloud.com>
2022-05-17 14:00:55 +02:00
yxxhero 10c3eb61a5 fix issue in context_funcs.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-17 17:37:47 +08:00
yxxhero d83e9214e6 rename execEnvs to envExec
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-17 08:30:46 +08:00
Quan TRAN f7ef07ff94
Merge pull request #95 from yxxhero/add_execEnvs
[feat] add execEnvs
2022-05-16 17:13:57 +02:00
yxxhero a320fccdd2 update unittest for execEnvs
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-16 22:54:31 +08:00
yxxhero 1258c9ed10 add execEnvs
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-14 09:59:08 +08:00
yxxhero faef77d143 add unittest for error.go in pkg/app
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-28 09:01:02 +08:00
Yusuke Kuoka cc6edc18b6
Merge pull request #69 from yxxhero/remote_temp_rand
remove temp_rand and use k8s.io/apimachinery/pkg/util/rand
2022-04-28 06:07:43 +09:00
yxxhero 218d7a6f0a remove temp_rand and use k8s.io/apimachinery/pkg/util/rand
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 13:54:06 +08:00
yxxhero eeb2eee099 fix unittest issue for context.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 10:57:26 +08:00
yxxhero e2cb7fe176 add unittest for context.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 09:30:40 +08:00
yxxhero 04d364a467 add unittest for ValidateConfig
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 07:38:22 +08:00
Yusuke Kuoka aef233489f
Merge pull request #62 from yxxhero/newExecutionID_unittest
Add unittest for newExecutionID
2022-04-25 08:40:45 +09:00
yxxhero 45c983a0bb Add unittest for newExecutionID
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-24 13:55:28 +08:00
Yusuke Kuoka 1bcf6a7bb1
Merge pull request #52 from yxxhero/feat_inherit_environment_variables_for_Exec
add unittest for Exec
2022-04-22 12:21:31 +09:00
yxxhero 33f733026b remove cmd.Env set
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-22 08:36:02 +08:00
yxxhero d26f83c460 add unittest for Exec and add feature that inherit the environment variables from the parent process for Exec
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-21 19:29:32 +08:00
yxxhero 88f17e6c9a fix more go lint warn
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-20 16:26:06 +08:00
yxxhero 8b15272cbc fix go lint warn
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-20 15:59:12 +08:00
yxxhero a0d4047cc7 remove gotest deps
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-19 08:02:21 +08:00
yxxhero b895f75198 add unittest for constants.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-18 17:15:04 +08:00
Yusuke Kuoka 42ad7beb6e
Merge pull request #24 from helmfile/auto-detect-term-for-color-diff
feat: Auto-detect term for coloring helm-diff output
2022-04-15 07:24:42 +09:00
Yusuke Kuoka a4542265ca
Merge pull request #23 from helmfile/fix-helmfile-deps-chartify
Fix helmfile deps not to remove entries for charts that are being chartified
2022-04-15 07:24:20 +09:00
Yusuke Kuoka f84ab66ba0 Make --color and --no-color exclusive
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-04-13 23:43:41 +00:00
Yusuke Kuoka 47e13fcdad
Merge pull request #34 from dol/feature/redacted-url-in-chart-name
Redact sensitive informations like password in chart url
2022-04-14 08:28:25 +09:00
Yusuke Kuoka 7af57add9d
Merge pull request #37 from itscaro/qtran/fix-temp-dir
Fix non-existent custom temp dir
2022-04-14 08:27:41 +09:00
Yusuke Kuoka d0841c72aa
Merge pull request #22 from itscaro/qtran/issue-2118
(fix) chartify process when chart path is absolute
2022-04-14 08:25:13 +09:00
Lüchinger Dominic f89234e5dc
Redact sensitive informations like password in chart url
Signed-off-by: Lüchinger Dominic <dev@snowgarden.ch>
2022-04-13 00:47:32 +02:00
Quan TRAN 12e103d510 (fix) non-existent custom temp dir
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-12 22:27:59 +02:00
Quan TRAN 88127d641b [fix] chartify process when chart path is absolute
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-11 23:34:52 +02:00
yxxhero 9c0c021dc9 fix typo in state.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-11 23:33:25 +02:00
Yusuke Kuoka 97e0ca73ca feat: Auto-detect term for coloring helm-diff output
Since helm-diff has added an ability to auto-detect the term to decide if it should output with color or not, helmfile had been defaulted to no-color.
This resoloves that, by adding a term-detection logic that is same as helm-diff.

As a part of this work, I have also implemented a new global flag `--color`, which is used for forcing color without relying on the term-detection logic implemented in helmfile or explicitly setting the HELM_DIFF_COLOR envvar. I hope it is useful for folks.

Ref https://github.com/roboll/helmfile/issues/2043

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-04-06 02:38:36 +00:00
Yusuke Kuoka 8e50dbc46d Fix helmfile deps not to remove entries for charts that are being chartified
When chartify is involved due to the use of `forceNamespace`, `strategicMergePatches`, `jsonPatches`, and so on, We had been internally mutating the Release.Chart with the path to the local temporary directory that contains the modified version of the chart.

This resulted in us unintentionally making `helmfile deps` to remove entries for the chart being modified out of helmfile.lock file, which resulted in issues like #2110.

To be clear, although the original issue is reported to occur for `strategicMergePatches`, I believe that it occurered also for any remote charts using `jsonPatches` and `forceNamespace` too.

I also believe this has been the issue since our introduction of chartify (maybe a year or so ago??), and I guess why it took so much time to be found and reported is that not so many people with chartify in combination with `helmfile deps` 🤔

Lastly, this changes chart names surfaced in the various log output from Helmfile, from temporary chart paths to the chart name/path declared in the helmfile.yaml. I think this is generally a good change, no fear of being a breaking change. But if anyone has any concern about that, please feel free to comment/report/etc.

Ref https://github.com/roboll/helmfile/issues/2110

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-04-06 02:12:08 +00:00
Yusuke Kuoka f49d181b41
Merge pull request #20 from itscaro/qtran/fix-decrypted-file
[fix] unclosed file stream when creating temporary decrypted files
2022-04-06 08:37:13 +09:00
Yusuke Kuoka 3f1d01a688
Merge pull request #18 from yxxhero/add_unittest_RequiredEnv
add unittest for RequiredEnv func
2022-04-06 08:35:26 +09:00
Yusuke Kuoka e8212276d5
Merge pull request #17 from yxxhero/update_args_unitest
update args_test.go unittest
2022-04-06 08:32:35 +09:00
Quan TRAN a793797404 [fix] unclosed file stream when creating temporary decrypted files
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-05 22:52:17 +02:00
yxxhero 5cb82ec3d1 add unittest for RequiredEnv func
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-05 22:53:07 +08:00
yxxhero 8e5c779626 update args_test.go unittest
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-05 06:26:42 +08:00
yxxhero 02058cc1f5 add unittest for load_opts.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-04 17:20:54 +08:00
yxxhero e0244bc341 mv captureStdout as public func
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 22:24:38 +08:00
yxxhero 7f70138b5f add unit for formatters.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 17:31:59 +08:00
yxxhero 303ef9cd80 remove ioutil usage in all project
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 15:53:19 +08:00
yxxhero d4a7b3bfff
fix little issue (#2126)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 09:16:59 +09:00
Yusuke Kuoka be5af8e3b7
Enhance support for kube-version and api-versions (#2121)
This adds support for `kube-version` and `api-versions` to be available to `chartify` so that it works even if your release requires `chartify` due to that you use features like `forceNamespace`, `jsonPatches`, `strategicMergePatches`, and so on.

This also enhances `ReleaseSpec` which corresponds to each item of `releases[]` in your `helmfile.yaml` to also accept `kubeVersion` and `apiVersions`, in addition to the top-level `kubeVersion` and `apiVersions` we have today.

The top-level ones works as the default values for release-specific ones. If you have been using the top-level ones, keep using it. It is backward-compatible. If you want to specify it per release, because, for example, your releases are deployed across clusters(in case you differentiate `kubeContext` fields), try the new fields added to the release spec.

Resolves #1864
2022-03-31 11:02:36 +09:00
Quan TRAN ed436ba68b
Add template function isFile (#2045)
* Add template function isFile

* Update context_funcs.go
2022-03-31 10:59:10 +09:00
Quan TRAN 45be24da53
Add .StateValues as alias of .Values in EnvironmentTemplateData (#2056) 2022-03-31 10:57:33 +09:00
Anton Bretting b1928e585d
Stop panic when deduplicating releases (#2067)
* Stop panic when deduplicating releases
* Add testdata for new testcases
2022-03-10 18:57:58 +09:00
Yusuke Kuoka dbc40f68b8
Make release template to work on `needs` (#2099)
It turned out that Helmfile has never had support for release template on `needs`.
This adds that, along with the new end-to-end test suite to verify helmfile template output with snapshot testing involving a real `helmfile build` command.

Ref #2098
2022-03-10 18:42:55 +09:00
Anton Bretting 0105ed4df3
Allow more characters in label selectors (#2064)
Label selectors also allows ".", "/" and "+" now

Fixes #970
2022-03-09 20:38:29 +09:00
Anton Bretting 2f04831817
Fix various golangci-lint errors (#2059) 2022-02-12 20:28:08 +09:00