Commit Graph

104 Commits

Author SHA1 Message Date
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
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 e6b263340d
Merge pull request #388 from helmfile/fix_retain_values_issue
fix SetRetainValuesFiles issue
2022-10-05 10:10:34 +08:00
yxxhero 5f699656df
Optimize cmd pkg (#384)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-05 11:02:24 +09:00
Stoned Elipot 636f2f130c fix: build command short description
Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
2022-09-30 15:14:30 +02:00
yxxhero 06cfdfc891 fix SetRetainValuesFiles issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-24 12:10:42 +08:00
yxxhero a1c8926a86 fix enable-live-output style
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-18 20:21:10 +08: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
Yusuke Kuoka 2663ac4f1b chore: Tidy up a local var scopinng for maintainability
Ref https://github.com/helmfile/helmfile/pull/279#discussion_r973675321

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-18 09:44:53 +00: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
yxxhero 24cefc7fd5 remove flags.Parse in cobra
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-18 13:25:54 +08: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
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
yxxhero 7eb23296e1
Merge pull request #348 from helmfile/fix_selector_help_msg_style
fixed: selector help msg style
2022-09-11 11:04:21 +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
yxxhero 3b890056e3 fix selector help msg stylp
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-06 08:05:35 +08:00
Viktor Oreshkin cb780be6bd fix: rename with-prepared-charts to skip-charts
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-05 18:12:37 +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 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
yxxhero 429e724104
Improve some multi-value flags to accept comma-separated values (#300)
fix cobra issue

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

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-18 20:30:30 +09:00
Michal Jura 14e277f683
Bring back --set flag to apply subcommand
We would like to add back --set flag to apply subcommand, which was
accidentally removed after switching to cobra (#234)

Signed-off-by: Michal Jura <mjura@suse.com>
2022-08-17 13:25:22 +02: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
yxxhero 8690d63401 fix lint error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-13 07:40:32 +08:00
Yusuke Kuoka eabf360fe8
Merge branch 'main' into fix_cobra_flag_default_value 2022-08-08 10:35:32 +09: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
yxxhero 8beb69d08e fix cobra flag default value
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-06 15:04:34 +08:00
Cyril Jouve a405a52609 remove selector override in cmd/apply
Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>
2022-08-01 11:19:42 +02:00
yxxhero 6dc1736f15
Merge pull request #250 from jouve/fix-cli
revert environment long option from --env to --environment
2022-07-22 06:49:47 +08:00
Cyril Jouve a97ff87fa1
correct --help cli arg regression
Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>
2022-07-21 19:08:08 +02:00
Cyril Jouve a4dee77430
revert --env long option to --environment
Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>
2022-07-21 18:47:52 +02: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 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
yxxhero 45283bfcde move all subcommand to sigle file
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-10 12:42:31 +08:00
yxxhero e5e8309ea6
Move diff charts template subcommand to a dedicated source file (#139)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-10 10:24:30 +09:00
yxxhero bb20fcaf5b
Move repos subcommand to a dedicated source file (#137)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-06 09:12:54 +09:00
yxxhero 871f2a9ed3 refactor cmd dir
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-01 07:32:36 +08:00
yxxhero 8024949d48 reconstruct_main_function
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-01 07:32:36 +08:00
KUOKA Yusuke e2d6dc4afa
feat: helmfile as a go library (#639)
* feat: helmfile as a go library

This removes almost all the dependencies from the helmfile core logic to urfave/cli. `main.go` is now a thin wrapper around the core logic implemented in `pkg/app`.
2019-06-04 09:12:00 +09:00
KUOKA Yusuke c68fc5bc50
chore: tidy up pkgs (#636)
for readability and towards potentially making helmfile usable as a go library
2019-06-01 13:36:05 +09:00
KUOKA Yusuke 1226ea6d1a
feat: specify env values from the parent to the nested state (#622)
* feat: specify env values from the parent to the nested state

Adds the `helmfiles[].environment.values` that accepts a mix of file pathes and inline dictes:

```yaml
helmfiles:
- path: path/to/nested/helmfile.yaml
  environment:
    values:
    - key1: val1
    - values.yaml
```

The values files are loaded in the context of the parent state file. For example, in case the above state file is located at `/path/to/helmfile.yaml`,
`values.yaml` is located at `/path/to/values.yaml` instead of `/path/to/nested/values.yaml`.

Resolves #523

* fix: multiple "bases" declarations yields duplicate releases

Fixes #615

* fix regression in double-rendering with env value overrides

The latest commit broke any state files like the below to NOT pass env value overrides at all:

```
helmfiles:
- path: nested/state.yaml
  environment:
    values:
    - overrides.yaml
```

This fixes the issue.
2019-05-29 19:08:51 +09:00
Raj Perera 4a5996d083 feat: ability to exit zero with no releases match selector (#618)
- Change exit code from 2 to 3 when helmfiles have no releases that match a selector
- Introduces new flag `--allow-no-matching-release` to exit 0 when no releases match a selector.

Resolves: #597
2019-05-27 09:53:24 +09:00
KUOKA Yusuke c9a43ad9cb
feat: Dependency locking (#593)
In order to maintain predictable deployments, as developer I want to generate and use "lock files" for all chart versions retrieved from a helmfile.

This change solves it by (1)enhancing `helmfile deps` to generate a lock file containing all the direct chart dependencies of each helmfile state file and
(2)making other helmfile sub-commands reads the lock file and merge the locked version numbers to the helmfile state file being processed.

The lock file is named after the helmfile state file being locked, so that you can have multiple set of the helmfile state file and the lock file pairs in a directory.

When `helmfile deps` are not explicitly run before commands like `sync`, all the helmfile behavior should remain as before.

Let's say you have `helmfile.1.yaml`:

```
repositories:
- name: stable
  url: https://kubernetes-charts.storage.googleapis.com

releases:
- name: envoy
  chart: stable/envoy
- name: envoy2
  chart: stable/envoy
```

`helmfile deps` generates `helmfile.1.lock` that looks like:

```
dependencies:
- name: envoy
  repository: https://kubernetes-charts.storage.googleapis.com
  version: 1.5.0
digest: sha256:e43b05c8528ea8ef1560f4980a519719ad2a634658abde0a98daefdb83a104e9
generated: 2019-05-14T16:45:37.78205+09:00
```

Under the hood, `helmfile deps` creates a temporary local helm chart with a dummy `Chart.yaml` and `requirements.yaml` deduced from the `helmfile.yaml` content, then runs `helm dependency update` to produce od update the corresponding `requirements.lock` file.

`helmfile` then renames it to match the name of the targeted helmfile state file and moves it,  so that it becomes adjacent to each `helmfile.yaml`.

Other `helmfile` commands like `sync`, `diiff`, `apply`, `lint` read chart version numbers from the lock file.

Resolves #483
2019-05-15 09:39:12 +09:00
KUOKA Yusuke 4f83e69bf6
Various U/X improvements for `helmfile apply` (#586)
* Various U/X improvements for `helmfile apply`

This improves the U/X of `helmfile apply`, by allowing you to selectively apply sub-helmfiles.
When you have two or more sub-helmfiles processed, typing `n` to cancel the first doesn't automatically stop the whole helmfile execution.
Instead, it proceeds by diffing the next sub-helmfile, and asks you to apply it, which should be what the user would expect.

To support this workflow, I have suppressed useless exec logs, correct exit status when diff exists in sub-helmfiles but not in the parent helmfile, and made the final error message emitted by helmfile better.

More concretely, this moves more output from `helm` to STDERR and the `debug` log-level.

The overall output from `helmfile` should be a bit more cleaner especially for `apply`, `sync`, `diff` and perhaps other `helmfile` sub-commands, too.

For example, when one of release failed, `helmfile`'s final error message now includes the error message from the failed `helm` execution, like seen in the last line:

```
List of updated releases :
RELEASE   CHART          VERSION
envoy     stable/envoy     1.5.0

List of releases in error :
RELEASE
envoy2
in ./helmfile.yaml: in .helmfiles[0]: in /Users/c-ykuoka/helmfile/helmfile.1.yaml: failed processing release envoy2: helm exited with status 1:
  Error: UPGRADE FAILED: "envoy2" has no deployed releases
```

This way you can better understand what caused helmfile to finally fail.

`helmfile` has been streaminig a lot of stdout and stderr contents from the `helm` commands regardless of the helmfile's log-level. It has been suppressed by default and moved to the `debug` log-level.
You will see that it helps you focus on what was the cause of a failure.

While working on the above, I found an another bug that made `--detailed-exitcode` useless in some case.
That is, `helmfile diff --detailed-exitcode`, when any diff existed only in sub-helmfiles, has been returning an exit code of `1`. It should return `2` when any release had diff and no release had an error, regardless of the target is a sub-helmfile or a parent helmfile. Why? Because that's what `--detailed-exitcode` meant for!

After this PR gets merged, `helmfile diff --detailed-exitcode`  propery return exit code `2` in such cases.

Fixes #543
Resolves #540
2019-05-12 16:26:11 +09:00
sgandon 4581e004b8 feat(#344): add sub helmfiles explicit selectors (#567)
Fixes #344 by allowing explicit selectors to be specified for composed helmfiles using the following structure

```yaml
helmfiles:
- path: helmfile.d/a*.yaml
  selectors:
  - name=prometheus      
  - name!=zipkin      
- helmfile.d/b*.yaml
- path: helmfile.d/c*.yaml
  selectors: {}
```

2 modes here : 
* legacy mode when no the env var HELMFILE_EXPERIMENTAL is not set to true
  * no selector : inherit from the command line.
  * selector:  is specified then it is used (an emty means no inheritance from command line and take everything).
* experimental when the env var HELMFILE_EXPERIMENTAL=true
  * no selector : nothing is inherited from the command line so use all releases.
  * selector:  is specified then it is used (an emty means no inheritance from command line and take everything).
2019-05-05 13:38:52 +09:00
KUOKA Yusuke c6236a15bb
feat: Opt-out dep-builds and repo-updates (#463)
* Improve code organization

To make sure it is still readable after upcoming changes to helmfile

* feat: `helmfile deps` to update dependencies of all the local charts

Resolves #450

* feat: helmfile updates repos and build deps by default

But not update deps. Use `helmfile deps` to update deps, and provide `--skip-deps` to skip updating repos and builds deps in sync/diff/apply/template

Resolves #415

* Improve integration test coverage
2019-02-04 12:07:25 +09:00