Compare commits

...
1134 Commits
Author SHA1 Message Date
xiaomudk c498af3f52 Fix set flag are ignored when used in conjunction with jsonPatches (#867)
* Fix set flag are ignored when used in conjunction with jsonPatches

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2023-05-24 07:29:19 +08:00
SeWielandandsewieland 8b3ad5b793 feat: make environment context available (#832)
* feat: make environment context available

This feature adds the "{{.Environment.KubeContext}}" variable.

Discussion #829

Signed-off-by: sewieland <sebastian.wieland@iav.de>

* chore: fix tests which compare logging outputs

This commit adds an addtional space wherever needed to the expected log outputs due to the added "KubeContext" in the environment struct.

Discussion #829

Signed-off-by: Sebastian Wieland <wieland.s@mailbox.org>

* docs: added documentation for `Environment.KubeContext`

Discussion #829

Signed-off-by: Sebastian Wieland <wieland.s@mailbox.org>

* test: make sure the `Environment.KubeContext` is mapped out correctly

Discussion #829

Signed-off-by: Sebastian Wieland <wieland.s@mailbox.org>

---------

Signed-off-by: sewieland <sebastian.wieland@iav.de>
Signed-off-by: Sebastian Wieland <wieland.s@mailbox.org>
Co-authored-by: sewieland <sebastian.wieland@iav.de>
2023-05-22 13:43:46 +09:00
dependabot[bot] c299cd930d build(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3 (#866)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.2...v1.8.3)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-20 06:43:58 +08:00
dependabot[bot] 03883e246d build(deps): bump k8s.io/apimachinery from 0.27.1 to 0.27.2 (#865) 2023-05-19 05:06:26 +08:00
yxxhero 3bbd816247 fix extra args missing in helmfile apply subcommand (#858)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-05-18 12:34:18 +08:00
yxxhero 641e1f876a docs: update cascade (#861)
* docs: update cascade

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-05-15 17:07:17 +08:00
yxxhero 00dace9b63 Feat add cascade support (#860)
* feat: add cascade support for helm v3.12.0

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-05-15 13:49:33 +08:00
dependabot[bot] 8e036e19dc build(deps): bump github.com/docker/distribution from 2.8.1+incompatible to 2.8.2+incompatible (#857) 2023-05-12 05:42:03 +08:00
yxxhero 54ed6bf0d5 bump helm to v3.12.0 (#855)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-05-11 10:35:17 +08:00
dependabot[bot] 45e6bccbfa build(deps): bump go.szostok.io/version from 1.1.0 to 1.2.0 (#852)
Bumps [go.szostok.io/version](https://github.com/mszostok/version) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/mszostok/version/releases)
- [Commits](https://github.com/mszostok/version/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: go.szostok.io/version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 07:44:50 +08:00
yxxhero 643f888703 fix: loadBases overrodeEnv issue (#838) 2023-05-08 05:24:32 +08:00
William Lahti b6dd7122f9 feat: add --skip-trailing-cr to helmfile diff (#625) 2023-05-08 05:23:59 +08:00
dependabot[bot] 14a33f998f build(deps): bump golang.org/x/sync from 0.1.0 to 0.2.0 (#847) 2023-05-05 09:07:57 +08:00
dependabot[bot] 68f569f2c7 build(deps): bump golang.org/x/term from 0.7.0 to 0.8.0 (#846)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/golang/term/releases)
- [Commits](https://github.com/golang/term/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-05 07:54:32 +08:00
Dmitry Chepurovskiyandyxxhero aa5be82834 Make helmfile respect signals send by kill command (not only Ctrl+C in terminal) (#750)
Fixes #746 

Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
2023-04-29 15:25:29 +09:00
Vincent Stchu 3d0f0afe3a Feat: support helm flag --enable-dns (#830)
* Support helm flag --enable-dns

Signed-off-by: vincent_stchu <24803055+vincentstchu@users.noreply.github.com>
2023-04-27 16:27:09 +08:00
Lavi Blumberg b7233d1238 Properly emulated arm64 Docker builds (#826)
Signed-off-by: Lavi Blumberg <lavifb@gmail.com>
2023-04-24 23:32:59 +08:00
Ronny Moreas 58a1f2d079 chore(release): fix condition for latest tag (#823)
Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>
2023-04-22 16:55:04 +08:00
Lavi Blumberg b5cc1685ec Fix depedency binaries for arm64 builds (#820)
* Build correct arch for container image

Signed-off-by: Lavi Blumberg <lavifb@gmail.com>

* Fixed arch of binaries pulled in by the Dockerfile

Signed-off-by: Lavi Blumberg <lavifb@gmail.com>

---------

Signed-off-by: Lavi Blumberg <lavifb@gmail.com>
2023-04-21 07:36:43 +08:00
Lavi Blumberg 75092bf0bc Build correct arch for container image (#817)
Signed-off-by: Lavi Blumberg <lavifb@gmail.com>
2023-04-20 06:15:00 +08:00
stoned 75e52d70b5 Uniformize usage message (#813) 2023-04-19 06:37:28 +08:00
stoned b1f1d28fa7 Fix Markdown rendering of indented code blocks (#814)
... by using plain indented code blocks instead of indented fenced
code blocks.

While here also fix list rendering and add missing Go template escaping
in inline `values` map example.

Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
2023-04-19 06:19:49 +08:00
stoned 4aeb0ff6f2 Fix inherit examples following #674 (#815) 2023-04-19 05:56:29 +08:00
stoned 1ddba549d3 Doc fixes (#812) 2023-04-18 21:10:22 +08:00
Oleksandr Vorona e45b1b66c9 Add documentation on internal environment variables (#811)
Signed-off-by: Alex Vorona <alex@vorona.com.ua>
2023-04-18 19:24:48 +08:00
dependabot[bot] 1f106784d0 build(deps): bump k8s.io/apimachinery from 0.27.0 to 0.27.1 (#810) 2023-04-18 05:06:14 +08:00
stoned 36d35d97c1 bump vals to v0.25.0 (#808) 2023-04-17 13:07:00 +08:00
Soh Takada a8a0a33c33 Add kube version flag (#804)
* add --kube-version flag into template cmd

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>

* add test

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>

* modify flag description

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>

* use switch

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>

* add comment

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>

---------

Signed-off-by: FeLvi-zzz <34182539+FeLvi-zzz@users.noreply.github.com>
2023-04-16 07:05:23 +08:00
AlexAxenti 0012e7e5a1 feat: add duration to affected releases on sync (#773)
* feat: add duration to affected releases on sync

Signed-off-by: Alexandru Axenti <alex.axenti@gmail.com>
2023-04-15 08:09:47 +08:00
yxxhero 7c72e2ba3e fix: ValuesTemplate quote issue (#787)
* fix: ValuesTemplate quote issue

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

* optimize goccy yaml options

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

* add more options

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

* fix tests

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

* fix tests

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-04-14 13:03:26 +09:00
yxxhero 219602ebc7 bump helm to v3.11.3 (#802)
* bump helm to v3.11.3

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-04-13 10:34:58 +08:00
dependabot[bot] 4972dc49f1 build(deps): bump k8s.io/apimachinery from 0.26.3 to 0.27.0 (#801) 2023-04-13 02:16:08 +08:00
Edu-DevOps 6eeca385e0 Documentation updated about kubeVersion field (#797) 2023-04-11 05:42:48 +08:00
dependabot[bot] 58519d3b28 build(deps): bump github.com/Masterminds/semver/v3 from 3.2.0 to 3.2.1 (#796) 2023-04-11 05:00:58 +08:00
dependabot[bot] d0dbb2c2e2 build(deps): bump golang.org/x/term from 0.6.0 to 0.7.0 (#789) 2023-04-06 06:49:30 +08:00
AndreiBrandes b52e2af217 Update USERS.md (#777) 2023-04-05 11:12:17 +08:00
dependabot[bot] ed5f530c00 build(deps): bump github.com/docker/docker from 20.10.21+incompatible to 20.10.24+incompatible (#784)
build(deps): bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.21+incompatible to 20.10.24+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v20.10.21...v20.10.24)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 08:10:53 +08:00
dependabot[bot] 52358fc2ce build(deps): bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (#783) 2023-04-05 06:53:59 +08:00
Jan-Otto Kröpke ca2759e78d Bump github.com/helmfile/vals (#781) 2023-04-05 05:33:53 +08:00
dependabot[bot] 0573034c6d build(deps): bump github.com/goccy/go-yaml from 1.10.1 to 1.11.0 (#778) 2023-04-04 04:31:33 +08:00
Hans Song 1d0ba72b47 feat: add/expose cli flags (#771)
* feat: add/expose cli flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* fix tests

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove skipdeps from subcommand options

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove skip-deps from subcommand flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove SkipDeps from subcommand implementations

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* update doco with new flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

---------

Signed-off-by: Hans Song <hans.m.song@gmail.com>
2023-04-02 14:53:52 +08:00
dependabot[bot] fe1eba60db build(deps): bump go.uber.org/multierr from 1.10.0 to 1.11.0 (#772) 2023-03-31 06:00:51 +08:00
Quan TRANandyxxhero 5650661a88 remove unnecessary remote.Locate() (#565)
* remove unnecessary Locate

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

* add remote test

Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>

---------

Signed-off-by: Quan TRAN <account@itscaro.me>
Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2023-03-29 21:27:12 +08:00
yxxhero 6b31b66473 fix: goccy/go-yaml tests (#770)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-28 18:00:14 +08:00
yxxhero c17317100b feat: use offical goccy/go-yaml (#769)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-28 17:26:48 +08:00
Scott Leggett 734957238d fix: formatting of YAML samples in 1.0 proposal doc (#767)
Signed-off-by: Scott Leggett <scott@sl.id.au>
2023-03-27 17:01:26 +08:00
Ronny Moreas 10d640b211 chore(release): add latest tag only on release tags (#766) 2023-03-26 05:12:49 +08:00
dependabot[bot] d276cd2902 build(deps): bump github.com/imdario/mergo from 0.3.14 to 0.3.15 (#762) 2023-03-25 07:11:11 +08:00
yxxhero 5e8a502b41 feat: use new helm version parse function (#760)
* feat: use new helm version parse function

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-23 08:46:11 +08:00
yxxhero bfb94314be bump chartify to v0.14.0 (#759)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-21 18:52:42 +08:00
dependabot[bot] 198b6e173a build(deps): bump k8s.io/apimachinery from 0.26.2 to 0.26.3 (#758) 2023-03-21 06:05:04 +08:00
Ronny Moreas d34cfaafa1 chore(ci): use docker/metadata-action (#756)
* chore(ci): use `docker/metadata-action`

- Replace custom `setup-image-vars` action by `docker/metadata-action`
- Automatically add latest tag on semver tag

Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>

* chore(ci): add image tag on PR

Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>

* chore(ci): cleanup trailing spaces

Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>

* chore(ci): remove `setup-image-vars` action

Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>

---------

Signed-off-by: Ronny Moreas <ronny.moreas@kuleuven.be>
2023-03-20 08:14:51 +08:00
yxxhero a817997ed8 bump mergo to 0.3.14 (#751)
bump merge to 0.3.14

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-17 18:37:15 +08:00
dependabot[bot] 011066f653 build(deps): bump github.com/hashicorp/go-getter from 1.7.0 to 1.7.1 (#745) 2023-03-16 06:31:22 +08:00
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
dependabot[bot] ccc69399e5 build(deps): bump github.com/helmfile/vals from 0.22.0 to 0.23.0 (#735) 2023-03-11 06:35:51 +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
dependabot[bot] 87eaa851e7 build(deps): bump go.uber.org/multierr from 1.9.0 to 1.10.0 (#731) 2023-03-09 05:50:08 +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
dependabot[bot] 939ae409c3 build(deps): bump golang.org/x/term from 0.5.0 to 0.6.0 (#728) 2023-03-07 05:22:46 +08: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
yxxhero a5c4bea54a fix build-in objects docs (#719)
* fix build-in objects docs

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

* fix typo

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-03-02 11:03:24 +08:00
dependabot[bot] d56dfeb5e4 build(deps): bump k8s.io/apimachinery from 0.26.1 to 0.26.2 (#720) 2023-03-02 07:44:59 +08:00
dependabot[bot] 6607d12cac build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (#717) 2023-02-28 05:37:25 +08:00
yxxhero 68d6b2d885 fix: update file help message (#714) 2023-02-27 06:33:44 +08:00
yxxhero 2c2bfcf58a issue with in process label will never be considered stale (#716)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-27 07:28:53 +09:00
yxxhero 489a3ae133 fix cobra issue (#715)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-24 21:43:42 +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
dependabot[bot] 77d3aee6f7 build(deps): bump golang.org/x/net from 0.5.0 to 0.7.0 (#704) 2023-02-18 16:50:24 +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
yxxhero 9d74fa3513 bump chartify to v0.13.0 (#702)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-17 14:07:14 +08:00
dependabot[bot] ebc56f3aff build(deps): bump github.com/containerd/containerd from 1.6.15 to 1.6.18 (#701)
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.15 to 1.6.18.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.15...v1.6.18)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 07:47:00 +08:00
dependabot[bot] 99e85bb672 build(deps): bump github.com/hashicorp/go-getter from 1.6.2 to 1.7.0 (#697)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.6.2 to 1.7.0.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.6.2...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-16 12:43:23 +08:00
Kohei Yamamoto cb50fa932c fix: repos command help message (#698) 2023-02-15 07:23:50 +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 2d98bba1a1 Fix a typo in the v1 proposal (#688)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-09 08:24:07 +08:00
dependabot[bot] d443e7424e build(deps): bump helm.sh/helm/v3 from 3.11.0 to 3.11.1 (#689) 2023-02-09 08:00:06 +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
dependabot[bot] e930deffbc build(deps): bump golang.org/x/term from 0.4.0 to 0.5.0 (#686) 2023-02-09 06:03:48 +08:00
Yusuke Kuoka 0e89ceb0f0 Remove references to .tpl from v1 proposal (#685)
I think we never implemented support for .tpl suffixed helmfile.yaml.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-02-08 11:14:22 +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
xiaomudk b359efef8b Sync Chinese readme (#676) 2023-02-07 07:05:18 +08:00
xiaomudk 4ce8676588 Improve readme readability (#678)
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2023-02-07 07:25:35 +09: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 https://github.com/helmfile/go-yaml/commit/259d2ed450aed2aa1d6f05139f99a8b01f87633a 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 652628c5ee Bump Go to 1.20 (#672)
* bump go 1.20

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

* use go-version: ^1.20

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

* bump go 1.20

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

* fix go version

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

* fix go version

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-04 08:57:52 +08:00
yxxhero 9aadde6173 fix typo (#670)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-01 22:25:01 +08:00
xiaomudk 04fc38f233 Add chinese readme (#664)
Add chinese docs

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2023-02-01 07:54:25 +09:00
yxxhero f355b297be add build-in objects docs (#667)
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-02-01 07:53:59 +09:00
Yusuke Kuoka d263b99b44 Reformat v1 proposal (#663)
so that we can link to each section easily using "#the-element-id" URL fragment.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2023-01-30 08:47:00 +08:00
toyamagu 5190d0b62b docs: Running helmfile withought an internet connection by --skip-deps option (#659) 2023-01-29 13:34:59 +08:00
Felix daa77b24c0 Bring up the init command in readme #661 (#662) 2023-01-29 04:44:22 +08:00
yxxhero 1ccdf83cd5 update hooks docs (#657)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-26 07:36:13 +09:00
yxxhero d164a4f0bb update examples info (#658)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-26 07:34:43 +09:00
Chetan Goti 518ab98c1c fix(docs): transfer issue link for Docs site (#655) 2023-01-25 13:56:22 +08:00
yxxheroandYusuke Kuoka 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
yxxhero b44aaf90f7 remove helm v2 code in tests (#648)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-24 07:02:57 +09:00
Yusuke Kuoka ec60ac815b feat: Add missingFileHandlerConfig.ignoreMissingGitBranch (#645) 2023-01-23 17:27:00 +08:00
Yusuke Kuoka 60e024ee3b Fix a minor typo in the v1 proposal (#646) 2023-01-23 09:50:19 +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
dependabot[bot] f3a24dd99a build(deps): bump k8s.io/apimachinery from 0.26.0 to 0.26.1 (#641)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.26.0...v0.26.1)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 09:37:14 +08: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
dependabot[bot] 44b473ebe8 build(deps): bump github.com/containerd/containerd from 1.6.6 to 1.6.12 (#632)
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.6 to 1.6.12.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.6...v1.6.12)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-17 17:14:01 +08:00
Gaius c3a9d45b55 feat: add paths-ignore to ci.yaml and lint.yaml (#631)
Signed-off-by: Gaius <gaius.qi@gmail.com>

Signed-off-by: Gaius <gaius.qi@gmail.com>
2023-01-17 16:56:36 +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
xiaomudkandyxxhero 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
dependabot[bot] fdfa520f1b build(deps): bump gitpython from 3.1.27 to 3.1.30 in /docs (#618)
Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.27 to 3.1.30.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.27...3.1.30)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 09:26:37 +08:00
dependabot[bot] 982795acb3 build(deps): bump golang.org/x/term from 0.3.0 to 0.4.0 (#616)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/term/releases)
- [Commits](https://github.com/golang/term/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 08:48:34 +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 Kuokaandyxxhero 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
Denis Kadyshev 50fd0d786e Sops and gpg command (#597) 2022-12-23 21:51:53 +08:00
Yusuke Kuoka c83ba69f3e Re: Remove deprecated args and cmd for v1.0.0 (#598)
This is a successor to #442 rebuilt on top of #594 so that we can merge this while we are still at Hemlfile v0.x without worrying any backward-incompatibility.

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

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-23 08:29:03 +08: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 eb810c6c0c add goreportcard (#595)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-21 23:46:31 +08:00
yxxhero d8d0bf830a Add helmfile state validate policy (#592) 2022-12-21 10:49:31 +08:00
Yusuke Kuoka 8ec51c2826 doc: Remove HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS in Helmfile v1 (#590) 2022-12-19 07:38:43 +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
Felipe Santos 9cc0cff07f Clarify postsync hooks docs (#585)
Signed-off-by: Felipe Santos <felipecassiors@gmail.com>

Signed-off-by: Felipe Santos <felipecassiors@gmail.com>
2022-12-16 19:03:08 +09: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
dependabot[bot] 0a0640affd build(deps): bump helm.sh/helm/v3 from 3.10.2 to 3.10.3 (#578) 2022-12-15 06:30:23 +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
yxxhero 5da1200a8b add post render integration test (#576)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-14 11:38:47 +08:00
dependabot[bot] 524003d80b build(deps): bump go.uber.org/multierr from 1.6.0 to 1.9.0 (#575)
Bumps [go.uber.org/multierr](https://github.com/uber-go/multierr) from 1.6.0 to 1.9.0.
- [Release notes](https://github.com/uber-go/multierr/releases)
- [Changelog](https://github.com/uber-go/multierr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/multierr/compare/v1.6.0...v1.9.0)

---
updated-dependencies:
- dependency-name: go.uber.org/multierr
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-14 07:43:21 +08:00
Quan TRANandyxxhero 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 a93035a3e5 Revert "Add e2e test for helmfile-diff with post-renderer"
This reverts commit a3e8c0426c.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-12-13 07:12:48 +00:00
yxxhero 89d9a9b3a2 Merge branch 'main' into main 2022-12-13 13:18:13 +08:00
yxxhero 773b0d6fc4 fix e2e
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
yxxhero 04729b027a fix e2etest
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Yusuke Kuoka a3e8c0426c Add e2e test for helmfile-diff with post-renderer
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Yusuke Kuoka 9f702280ae Add e2e test for post-renderer
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
yxxhero 9b0eeaad94 Update output.yaml
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08: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
yxxheroandQuan TRAN 197fdcdabd add xiaomudk as maintainer (#504)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Quan TRAN <itscaro@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Patrick Hobusch c744046f88 Allow running images with users other than root (#546)
* Allow running images with users other than root

Signed-off-by: Patrick Hobusch <patrick@hobusch.net>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-13 13:12:07 +08:00
Quan TRAN 73134d8a70 Add documentation on go-getter cache
Signed-off-by: Quan TRAN <account@itscaro.me>
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
Indrek Juhkam bdc6982172 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>
2022-12-12 16:43:10 +09:00
yxxheroandQuan TRAN 2a18134986 add xiaomudk as maintainer (#504)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Quan TRAN <itscaro@users.noreply.github.com>
2022-12-12 08:49:45 +09:00
Patrick Hobusch 2f2a74d28f Allow running images with users other than root (#546)
* Allow running images with users other than root

Signed-off-by: Patrick Hobusch <patrick@hobusch.net>
2022-12-11 09:01:41 +08:00
yxxhero 195cf774a3 Merge pull request #566 from helmfile/issue-544
Add documentation on go-getter cache
2022-12-10 21:18:48 +08:00
Quan TRAN ad7fcbb0e9 Add documentation on go-getter cache
Signed-off-by: Quan TRAN <account@itscaro.me>
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-12-10 19:36:56 +08:00
dependabot[bot] a6df2f8148 build(deps): bump k8s.io/apimachinery from 0.25.4 to 0.26.0 (#568)
* build(deps): bump k8s.io/apimachinery from 0.25.4 to 0.26.0

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-10 13:26:40 +08:00
yxxhero e173a7b64f Merge pull request #569 from helmfile/dependabot/go_modules/github.com/go-test/deep-1.1.0
build(deps): bump github.com/go-test/deep from 1.0.8 to 1.1.0
2022-12-10 11:31:03 +08:00
dependabot[bot] 3f4673aa95 build(deps): bump github.com/variantdev/vals from 0.20.0 to 0.21.0 (#570)
Bumps [github.com/variantdev/vals](https://github.com/variantdev/vals) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/variantdev/vals/releases)
- [Changelog](https://github.com/variantdev/vals/blob/main/.goreleaser.yml)
- [Commits](https://github.com/variantdev/vals/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: github.com/variantdev/vals
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-10 11:30:36 +08:00
xiaomudkandYusuke Kuoka 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
dependabot[bot] 75aab769c8 build(deps): bump github.com/go-test/deep from 1.0.8 to 1.1.0
Bumps [github.com/go-test/deep](https://github.com/go-test/deep) from 1.0.8 to 1.1.0.
- [Release notes](https://github.com/go-test/deep/releases)
- [Changelog](https://github.com/go-test/deep/blob/master/CHANGES.md)
- [Commits](https://github.com/go-test/deep/compare/v1.0.8...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/go-test/deep
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-10 02:56:08 +00: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
yxxhero f7b3fb4432 Merge pull request #562 from helmfile/dependabot/go_modules/golang.org/x/term-0.3.0
build(deps): bump golang.org/x/term from 0.2.0 to 0.3.0
2022-12-07 08:12:27 +08:00
dependabot[bot] 28ba777d5f build(deps): bump golang.org/x/term from 0.2.0 to 0.3.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/golang/term/releases)
- [Commits](https://github.com/golang/term/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 15:10:08 +00:00
yxxhero b76f1d37d7 Merge pull request #557 from helmfile/dependabot/go_modules/go.uber.org/zap-1.24.0 2022-12-02 06:21:52 +08:00
dependabot[bot] ba2b68fd18 build(deps): bump go.uber.org/zap from 1.23.0 to 1.24.0
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.23.0 to 1.24.0.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/zap/compare/v1.23.0...v1.24.0)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 15:09:33 +00:00
yxxhero 354f9097cf Merge pull request #549 from helmfile/fix_typo_in_cmd
typo: fix typo in cmd/apply.go
2022-12-01 12:17:42 +08:00
yxxhero 1f6ef3edc1 Merge pull request #556 from helmfile/dependabot/go_modules/github.com/Masterminds/sprig/v3-3.2.3 2022-11-30 23:28:15 +08:00
dependabot[bot] 1c77bc5cfb build(deps): bump github.com/Masterminds/sprig/v3 from 3.2.2 to 3.2.3
Bumps [github.com/Masterminds/sprig/v3](https://github.com/Masterminds/sprig) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/Masterminds/sprig/releases)
- [Changelog](https://github.com/Masterminds/sprig/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Masterminds/sprig/compare/v3.2.2...v3.2.3)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/sprig/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 15:11:33 +00:00
yxxhero 9b1312aaee Merge pull request #554 from helmfile/rm-embrawtest/myapp/foo.yaml.gotmpl
rm embrawtest/myapp/foo.yaml.gotmpl
2022-11-30 13:08:01 +08:00
yxxhero 02dc32aa2b rm embrawtest/myapp/foo.yaml.gotmpl
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-30 12:31:11 +08:00
yxxhero 23aa8ce46f Merge pull request #552 from helmfile/dependabot/go_modules/github.com/variantdev/vals-0.20.0 2022-11-29 23:57:55 +08:00
yxxhero 04679b4b90 Merge pull request #551 from helmfile/dependabot/go_modules/github.com/Masterminds/semver/v3-3.2.0 2022-11-29 23:22:45 +08:00
dependabot[bot] 5a29137572 build(deps): bump github.com/variantdev/vals from 0.19.0 to 0.20.0
Bumps [github.com/variantdev/vals](https://github.com/variantdev/vals) from 0.19.0 to 0.20.0.
- [Release notes](https://github.com/variantdev/vals/releases)
- [Changelog](https://github.com/variantdev/vals/blob/main/.goreleaser.yml)
- [Commits](https://github.com/variantdev/vals/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: github.com/variantdev/vals
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 15:08:27 +00:00
dependabot[bot] 63bbcf8930 build(deps): bump github.com/Masterminds/semver/v3 from 3.1.1 to 3.2.0
Bumps [github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/Masterminds/semver/releases)
- [Changelog](https://github.com/Masterminds/semver/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Masterminds/semver/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/semver/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 15:07:54 +00:00
yxxhero 5262145f6e typo: fix typo in cmd/apply.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-29 19:37:08 +08:00
yxxhero 01aee9337f Merge pull request #543 from helmfile/fix-go-mod
fix go mod
2022-11-28 08:21:07 +08:00
yxxhero 447481ae83 fix go mod
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-27 14:32:52 +08:00
yxxhero 211852cd38 use dyff as yamldiff tool (#542)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-27 09:47:09 +09:00
Cyril Jouve 60621ff318 rework dockerfiles (#519)
* fetch checksum when possible
* use sha256sum -c to validate checksum
* use tar features to extract artifacts
* validate installed pkg in-place

Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>

Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>
2022-11-25 10:14:27 +09:00
yxxhero 181c2f4509 fix ghcr-badge in docs (#539)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-25 10:12:11 +09:00
yxxhero 44c26e6639 Merge pull request #538 from helmfile/fix-unit-test 2022-11-25 06:57:28 +08:00
yxxhero 36996df980 fix unit test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-24 21:05:16 +08:00
yxxhero bd84b51fba Merge pull request #537 from helmfile/yxxhero-patch-1
fix ghr badge
2022-11-24 20:24:11 +08:00
yxxhero 54d987dd75 fix ghr badge
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-24 19:36:30 +08:00
yxxheroandYusuke Kuoka 5c5dc42ef5 Refactor integration tests (#531)
* refactor integrations

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

* Update the integration test directory structure to better correlate the test script with testdata

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

* Undo the test-cases directory renaming to make the diff more easy to understand

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

* fix ci

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

Signed-off-by: yxxhero <aiopsclub@163.com>
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-11-23 14:44:16 +09: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 ce7f38ee96 Merge pull request #535 from xiaomudk/patch-10
Remove redundant metadata fields from test samples
2022-11-22 10:55:31 +08:00
xiaomudk 766c1c951f Remove redundant metadata fields from test samples
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-11-22 10:33: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
yxxhero bdbfc9106d Merge pull request #517 from helmfile/use-log-cap-helper-in-all-tests
Use the new log capturing helper in all remaining tests
2022-11-13 17:15:47 +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
yxxhero 235917c11c Merge pull request #516 from helmfile/use-log-cap-helper-in-test-apply-hooks
Use log capturing helper in TestApply_hooks
2022-11-13 16:33:20 +08:00
Yusuke Kuoka 445c74c92b Enhance make fmt to cover running gci for golangci-lint compat (#515)
* Enhance `make fmt` to cover running gci for golangci-lint compat

I have been using `make fmt` for formatting code before submitting a pull request. It turned out not to work in some cases where you added a new import because the default go-fmt obviously do not organize imports as the golangci-lint and gci expect.
This fixes that, by adding a gci command to the `make fmt` target.
Please note that this does not cover installing gci. If you need, please submit another pull request to add something like a `make install-gci` and make the `make fmt` depenedent on that target, so that one can get automatic gci installation when running `make fmt` for first time.

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

* We don't need running gci via make on CI as we already run it as part of golangci-lint run

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

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-11-13 16:24:28 +08: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 f09ec18aa9 Merge pull request #499 from helmfile/498-helmfile-template-fails-when-selector-matches-a-chart-fetched-with-go-getter
fix: helmfile template fails when selector matches a chart fetched with go-getter
2022-11-13 15:27:50 +08: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
yxxhero 667c3723f0 Merge pull request #514 from helmfile/log-snapshot-test-helper
Introduce a new test helper for easier log snapshot testing
2022-11-13 11:41:44 +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 2594dc1524 Merge pull request #513 from helmfile/dependabot/go_modules/k8s.io/apimachinery-0.25.4 2022-11-12 06:07:26 +08:00
dependabot[bot] c9db278df7 build(deps): bump k8s.io/apimachinery from 0.25.3 to 0.25.4
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.25.3 to 0.25.4.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.25.3...v0.25.4)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 15:17:25 +00:00
yxxhero 8c870dc444 Merge pull request #512 from helmfile/bump-helm-to-3.10.2
bump: helm to 3.10.2
2022-11-11 14:40:08 +08:00
yxxhero 2324188695 bump: helm to 3.10.2
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-11 13:54:35 +08:00
dependabot[bot] cd92b4185e build(deps): bump helm.sh/helm/v3 from 3.10.1 to 3.10.2 (#511) 2022-11-11 06:29:40 +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 712ee3a0a2 Merge pull request #495 from helmfile/add_go_test_total_cover
feat: add go test total cover
2022-11-05 16:58:00 +08:00
yxxhero 34c5adb1da feat: add go test total cover
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 22:00:15 +08:00
yxxhero 3c907e2c2b Merge pull request #494 from helmfile/add_anchors_merge_e2e_test
test: add template anchors merge e2e test
2022-11-04 21:14:09 +08:00
yxxhero 1513035718 test: add template anchors merge e2e test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 20:56:56 +08:00
yxxhero 831410c814 Merge pull request #492 from helmfile/fix_deps_issue
fix deps issues
2022-11-04 14:32:20 +08:00
yxxhero b0bb03a0ea fix unittest
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 12:53:38 +08:00
yxxhero faf3444761 fix deps issues
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 12:53:38 +08:00
yxxhero ce6f8fc9ec Merge pull request #457 from helmfile/454-helmfile-template-args-swallows-args
fix: args parse issue
2022-11-04 10:16:11 +08:00
yxxhero bc3528ae09 fix: args parse issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 10:53:00 +09:00
yxxhero 120ff7cce6 remove hooks dir (#484)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 10:52:38 +09:00
yxxhero 82004b53f9 split run.sh to make run.sh be more clear. (#485)
split run.sh

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

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-11-04 10:51:57 +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
yxxhero 008e92de37 Merge pull request #486 from bmwiedemann/date
Allow to override build date with SOURCE_DATE_EPOCH
2022-11-02 19:50:03 +08:00
Bernhard M. Wiedemann 5f2b6994a6 Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This date call works with different variants of date.
Also use UTC to be independent of timezone.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2022-11-02 08:06:44 +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
Nenad Strainovic 3ac0cee50a Document git for windows env auto-prefix #481 (#487)
* Document git for windows env auto-prefix #481

Signed-off-by: Nenad Strainovic <nenad.strainovic@asseco-see.rs>
2022-10-31 22:24:06 +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
yxxhero 2cf6501d1f Merge pull request #480 from helmfile/fix_chart_need
fix chart needs test issue
2022-10-28 15:06:37 +08:00
yxxhero 2e7261426a fix chart needs test issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-28 14:45:24 +08:00
yxxhero 9704180862 Merge pull request #476 from helmfile/qtran/readme 2022-10-27 05:17:12 +08:00
Quan TRAN 4c103073bc Fix OCI example 2022-10-26 21:34:43 +02:00
yxxhero d54104d6ec Merge pull request #470 from helmfile/dependabot/go_modules/github.com/spf13/cobra-1.6.1 2022-10-26 06:43:56 +08:00
dependabot[bot] dcfc31eca6 build(deps): bump github.com/spf13/cobra from 1.6.0 to 1.6.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 16:12:27 +00: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 4a5928e269 Merge pull request #467 from helmfile/qtran/docker-build-wget
use curl instead of wget & update helm to 3.10.1
2022-10-25 16:17:57 +08:00
Quan TRAN 7d05ffd098 use curl instead of wget & update helm to 3.10.1
Signed-off-by: Quan TRAN <itscaro@users.noreply.github.com>
2022-10-25 07:48:54 +00:00
yxxhero d4b1b078cf Merge pull request #465 from helmfile/463-debug-is-not-set-in-helm-template
fix --debug flag
2022-10-25 14:36:18 +08:00
yxxhero f8a297bbac fix --debug flag
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-25 08:24:23 +08:00
yxxhero 9d28e28086 Merge pull request #462 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.8.1 2022-10-25 07:09:09 +08:00
dependabot[bot] 83868d8db4 build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 16:01:17 +00:00
yxxhero dba05f1fdf Merge pull request #461 from helmfile/fix_cmd_typo
fix typo
2022-10-24 20:38:00 +08:00
yxxhero 6be3c11119 fix typo
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-24 20:01:13 +08:00
yxxhero 39d0371d15 Merge pull request #458 from helmfile/455-chartify-not-applied-to-needed-releases
fix: needs logic in chart stage
2022-10-24 17:49:16 +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 38fffad737 Merge pull request #449 from helmfile/fix_issue_path_in_test_on_window
fix: issue path in test on windows
2022-10-19 18:15:22 +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
dependabot[bot] 82f0d88d56 build(deps): bump k8s.io/apimachinery from 0.25.2 to 0.25.3 (#439)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.25.2 to 0.25.3.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.25.2...v0.25.3)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-15 07:52:23 +08:00
dependabot[bot] 48c1e34a07 build(deps): bump helm.sh/helm/v3 from 3.10.0 to 3.10.1 (#436)
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.10.0...v3.10.1)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-14 08:52:29 +08:00
yxxhero bdaafdff67 feat: add helm-diff and kustomize in ci matrix (#434)
* feat: add helm-diff and kustomize in ci matrix

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-13 08:08:58 +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
yxxhero 97ce31d7c8 Merge pull request #433 from helmfile/dependabot/go_modules/github.com/spf13/cobra-1.6.0
build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.0
2022-10-12 08:02:18 +08:00
dependabot[bot] b77ccd844e build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 15:50:08 +00:00
yxxhero 62f0d722cd Merge pull request #423 from helmfile/fix-preapply-hook
Fix preapply hook behavior
2022-10-11 08:54:57 +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
yxxhero ff107103da Merge pull request #424 from helmfile/prevent-excessive-log-in-test
Prevent excessive log in tests
2022-10-11 08:20:25 +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 31da58fa3c fix helmfile version issue in docker image (#427)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-10 20:30:38 +09:00
yxxhero 20d321ca16 Merge pull request #422 from helmfile/mumoshu-patch-1
Update ci.yaml
2022-10-10 14:17:42 +08:00
Yusuke Kuoka 7c98dbb20c Update ci.yaml
Modified the test matrix description for more clarity.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-10-10 05:55:41 +00:00
yxxhero 0c205771ce Merge pull request #420 from chenrui333/go-1.19
deps: build with go1.19
2022-10-10 08:31:27 +08:00
Rui Chen f483a09879 deps: build with go1.19
Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-10-09 14:30:46 -04:00
yxxheroandYusuke Kuoka 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
yxxheroandYusuke Kuoka 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 144964002e fix README.md users.md to USERS.md (#410)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-08 14:25:01 +09:00
yxxhero 8f0993a081 doc: update template funcs docs (#414)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-08 14:24:32 +09:00
yxxheroandYusuke Kuoka 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
yxxhero a8101e44c7 Merge pull request #415 from kevinleturc/feature-resolve-helm-auth-from-env
feat: retrieve repository's username/password from environment
2022-10-07 07:27:20 +08: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 b5d54d6921 Merge pull request #407 from helmfile/up_docs
docs: update docs order
2022-10-05 10:13:46 +08: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
yxxhero e92c71f9d8 Merge pull request #395 from felipecrs/helm-show-version
Use helm show chart to identify chart version
2022-10-05 10:09:47 +08:00
yxxhero 65cc3741d2 Update ci.yaml and use helm 3.10.0 (#383)
add helm 3.10.0 in ci

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

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-05 11:05:07 +09:00
yxxhero 69d77507ee update helm-diff version to 3.5.0 (#379)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-05 11:02:49 +09: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
yxxhero c0a1ec46dc docs: update docs order
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-05 10:01:44 +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
yxxhero 3165551f9a Merge pull request #406 from mugioka/imprv/convert-hyphen-included-in-repo-name-to-underbar
imprv: convert hyphen included in repo name to underbar with gatherOCIUsernamePassword.
2022-10-03 15:08:25 +08: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 b347eec6f2 add more tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-03 11:47:46 +08:00
yxxhero 5367fbe549 add more tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-03 11:24:58 +08:00
yxxhero f6fd754386 add more tests
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-10-03 11:09:02 +08: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 d169786770 Merge pull request #403 from stoned/build-short-descr
fix: build command short description
2022-10-01 06:32:33 +08:00
yxxhero bef8aaceee Merge pull request #385 from helmfile/382-invalid-path-to-chart-when-running-helmfile-apply
fix path issue in windows
2022-10-01 06:32:13 +08: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 6862c362b4 Merge pull request #400 from stoned/typo
fix:  docs typo
2022-09-30 18:24:27 +08:00
Stoned Elipot 22f0d7b8a0 typo
Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
2022-09-30 11:02:19 +02:00
yxxhero de1aa61693 Merge pull request #401 from duckty/main
Fix incubator charts location in advanced-features.md
2022-09-30 11:46:40 +08:00
Kevin Nguyen e9fadfc868 Fix incubator charts location
Signed-off-by: Kevin Nguyen <concuadong89@gmail.com>
2022-09-30 10:42:42 +07:00
yxxhero 5f05bb01ca Merge pull request #398 from TartanLeGrand/main
docs: fix best pratices guide link
2022-09-29 19:59:50 +08:00
Ugo Mignon 0e04546880 docs: fix best pratices guide link
Signed-off-by: Ugo Mignon <umignon.externe@bedrockstreaming.com>
2022-09-29 13:58:38 +02:00
yxxhero 06cfdfc891 fix SetRetainValuesFiles issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-24 12:10:42 +08:00
yxxhero 2a7669f8fa Merge pull request #386 from helmfile/dependabot/go_modules/k8s.io/apimachinery-0.25.2
build(deps): bump k8s.io/apimachinery from 0.25.1 to 0.25.2
2022-09-24 06:32:51 +08:00
dependabot[bot] 1328d24452 build(deps): bump k8s.io/apimachinery from 0.25.1 to 0.25.2
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.25.1 to 0.25.2.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.25.1...v0.25.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-23 21:57:02 +00:00
yxxhero da60e90bc0 Merge pull request #387 from helmfile/dependabot/go_modules/helm.sh/helm/v3-3.10.0
build(deps): bump helm.sh/helm/v3 from 3.9.4 to 3.10.0
2022-09-24 05:54:25 +08:00
dependabot[bot] 85f050d2e5 build(deps): bump helm.sh/helm/v3 from 3.9.4 to 3.10.0
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.9.4 to 3.10.0.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.9.4...v3.10.0)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-23 15:47:26 +00:00
yxxhero 6408ff1319 Merge pull request #376 from helmfile/dependabot/go_modules/k8s.io/apimachinery-0.25.1
build(deps): bump k8s.io/apimachinery from 0.24.4 to 0.25.1
2022-09-23 18:13:57 +08:00
yxxhero a36f07cda3 fix path issue in windows
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-23 09:10:36 +08:00
dependabot[bot] 7cf010bb15 build(deps): bump k8s.io/apimachinery from 0.24.4 to 0.25.1
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.24.4 to 0.25.1.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.24.4...v0.25.1)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-20 10:26:17 +08:00
yxxhero d94f740f45 Merge pull request #378 from helmfile/mumoshu-patch-1
Update towards-1.0.md
2022-09-20 07:57:06 +08:00
Yusuke Kuoka 466661c223 Update towards-1.0.md
A small enhancement to the 1.0 proposal.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 23:33:30 +00:00
yxxhero 0a1b6c0907 Merge pull request #377 from helmfile/dependabot/go_modules/helm.sh/helm/v3-3.9.4
build(deps): bump helm.sh/helm/v3 from 3.8.1 to 3.9.4
2022-09-20 06:13:37 +08:00
dependabot[bot] 7f3076a054 build(deps): bump helm.sh/helm/v3 from 3.8.1 to 3.9.4
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.8.1 to 3.9.4.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.8.1...v3.9.4)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-19 15:50:34 +00:00
yxxhero 3c151b8d45 Merge pull request #375 from helmfile/bump-chartify
Bump chartify to v0.11.0
2022-09-19 15:25:20 +08:00
Yusuke Kuoka 1f4af59c5f Bump chartify to v0.11.0
Resolves #229 and #308 via https://github.com/variantdev/chartify/pull/39 and https://github.com/variantdev/chartify/pull/38

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 06:51:16 +00:00
yxxhero e4d36e44fb Merge pull request #374 from helmfile/fix-diff-selector-not-working-on-installed-false
Fix not to ignore diff selector when it matched nothing
2022-09-19 13:51:59 +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
yxxhero 24810a45ae Merge pull request #79 from Sajfer/preapply
Add preapply hook
2022-09-19 10:58:04 +08: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 385c3e80ef Add documentation about the new preapply hook
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-19 02:28:11 +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 5b88006e86 Update documentation
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 9019cec4ac Merge pull request #373 from helmfile/update_cli_ref
update CLI Ref
2022-09-19 07:46:32 +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 fa8dcc2c8f update CLI Ref
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-18 20:18:57 +08: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
Tsubasa Nagasawa e8a7e23d4d chore: add e2e test case for helm template with oci based helm chart
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2022-09-18 19:11:26 +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
yxxhero 7d88370310 Merge pull request #372 from helmfile/tidy-up-var-scope
chore: Tidy up a local var scopinng for maintainability
2022-09-18 17:46:24 +08: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
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 CAMIERandYusuke Kuoka 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
yxxhero d4e4d10fa1 Merge pull request #369 from helmfile/remove_flags_parse_in_cobra
remove flags.Parse in cobra
2022-09-18 13:40:16 +08: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
yxxheroandYusuke Kuoka c828d22a5c use latest helm in github ci (#367)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-09-17 20:39:06 +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 99d5eaf25b Merge pull request #361 from helmfile/fix_github_ci_matrix_config
fix github ci matrix config
2022-09-14 08:50:54 +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 9fe54c72d7 fix github ci matrix config
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-13 13:34:42 +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 98ca036d99 Merge pull request #356 from helmfile/update_docs_for_cli
update docs for CLI
2022-09-12 17:32:00 +08:00
yxxhero deca47087f update docs for cli
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-09-11 11:11:53 +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
yxxhero ca9bb9bcd2 Merge pull request #353 from helmfile/dependabot/go_modules/github.com/google/go-cmp-0.5.9
build(deps): bump github.com/google/go-cmp from 0.5.8 to 0.5.9
2022-09-09 05:41:27 +08:00
dependabot[bot] 68995bd34b build(deps): bump github.com/google/go-cmp from 0.5.8 to 0.5.9
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.8 to 0.5.9.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.8...v0.5.9)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-08 15:45:30 +00:00
yxxhero 9cd2c99286 Merge pull request #351 from helmfile/dependabot/go_modules/github.com/urfave/cli-1.22.10
build(deps): bump github.com/urfave/cli from 1.22.9 to 1.22.10
2022-09-07 06:29:29 +08:00
dependabot[bot] f37289e3e1 build(deps): bump github.com/urfave/cli from 1.22.9 to 1.22.10
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.9 to 1.22.10.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.9...v1.22.10)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-06 15:37:35 +00:00
yxxhero d8ec42c48f Merge pull request #350 from stek29/list-skip-charts-docs
docs: add docs for helmfile list
2022-09-06 20:41:31 +08:00
Viktor Oreshkin 9ef075a249 docs: update cli-reference with latest version
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 15:37:05 +03:00
Viktor Oreshkin ac0bdb8052 docs: add docs for helmfile list
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-06 15:19:45 +03:00
yxxhero 700d708b29 Merge pull request #346 from stek29/list-noprepare
feat: dont prepare on list
2022-09-06 17:22:41 +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
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 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
yxxhero d9ee3afd6f Merge pull request #345 from stek29/concurrency-preparedcharts
feat: honor concurrency in withPreparedCharts
2022-09-04 17:51:13 +08:00
Viktor Oreshkin a56303b5bf hack: fix flaky e2e test
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
2022-09-02 18:36:27 +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 f3984d5be5 Merge pull request #336 from muffl0n/add-ndr-to-users
add NDR to USERS.md
2022-08-30 18:02:12 +08:00
Sven Schliesing 8b326fb1c3 add NDR to USERS.md
Signed-off-by: Sven Schliesing <s.schliesing@tagesschau.de>
2022-08-30 11:20:08 +02:00
yxxhero 56e83dc8a8 Merge pull request #335 from philmtd/patch-1
add subshell to USERS.md
2022-08-30 17:12:58 +08:00
Philip Dakowitz 18d7d7561d Update USERS.md
Signed-off-by: Philip Dakowitz <dakowitz@subshell.com>
2022-08-30 10:43:20 +02:00
yxxhero 50736aaefe Merge pull request #331 from lemeurherve/chore-jenkins-name
chore: remove 'OSS' from Jenkins name
2022-08-29 16:59:51 +08:00
Hervé Le Meur de567ac0f7 chore: remove 'OSS' from Jenkins name
Signed-off-by: Hervé Le Meur <hlemeur@cloudbees.com>
2022-08-29 10:57:04 +02:00
yxxhero ab12e5ef2d Merge pull request #326 from helmfile/use_helmfile_testdata
use helmfile testdata
2022-08-28 10:24:32 +08:00
yxxhero 86072ca200 use helmfile testdata
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-28 10:36:21 +09: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 896d16566f Merge pull request #329 from dreglad/patch-1
Fix typos in docs
2022-08-28 06:04:36 +08:00
David Regla cbace3d7af Fix typos in docs
Signed-off-by: David Regla <dreglad@gmail.com>
2022-08-27 16:53:37 -05:00
yxxhero 43b52f6040 Merge pull request #322 from helmfile/dependabot/go_modules/go.uber.org/zap-1.23.0
build(deps): bump go.uber.org/zap from 1.22.0 to 1.23.0
2022-08-26 10:45:08 +08:00
yxxhero b89c24cd8a Merge pull request #317 from helmfile/update_readme
Add Users information in Readme.md
2022-08-26 10:08:09 +08:00
yxxhero 107c2c3458 Merge branch 'main' into dependabot/go_modules/go.uber.org/zap-1.23.0 2022-08-26 10:06:52 +08:00
yxxhero d201c1d2ea Add Users information in Readme.md
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-26 10:00:29 +08:00
yxxhero 7434872c6b fix ci error in issue.2118.yaml (#319)
Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-26 10:59:28 +09:00
yxxhero ece0387fc6 Merge pull request #320 from lemeurherve/patch-1
chore: update Jenkins's main helmfile repository in USERS
2022-08-26 07:29:08 +08:00
dependabot[bot] 630919e8f2 build(deps): bump go.uber.org/zap from 1.22.0 to 1.23.0
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/zap/compare/v1.22.0...v1.23.0)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-25 15:35:04 +00:00
Hervé Le Meur e0d7b98075 chore: update Jenkins's main helmfile repository in USERS
Signed-off-by: Hervé Le Meur <hlemeur@cloudbees.com>
2022-08-25 17:11:05 +02:00
yxxhero 01f896ced6 Merge pull request #312 from thenam153/main
fix typo for readme.md
2022-08-24 13:44:25 +08: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
Patrick Hobusch a626664f46 Add logo as .png and .ai (Adobe Illustrator) files (#263)
Signed-off-by: Patrick Hobusch <patrick.hobusch@gmail.com>

Signed-off-by: Patrick Hobusch <patrick.hobusch@gmail.com>
2022-08-24 07:37:52 +09:00
Nam Nguyen 5d5d61e56f fix typo for readme.md 2022-08-23 15:11:20 +07:00
yxxhero 316f7ddf5d Merge pull request #306 from helmfile/dependabot/go_modules/k8s.io/apimachinery-0.24.4
build(deps): bump k8s.io/apimachinery from 0.24.3 to 0.24.4
2022-08-20 07:01:37 +08:00
dependabot[bot] 3984659133 build(deps): bump k8s.io/apimachinery from 0.24.3 to 0.24.4
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.24.3 to 0.24.4.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.24.3...v0.24.4)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-19 15:44:30 +00: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
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
yxxhero d28f16253f Merge pull request #303 from mikelorant/fix/diff-output
fix: return diff output config value
2022-08-18 15:08:49 +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
yxxhero be9e88d3b5 Merge pull request #298 from mjura/apply-set
Bring back --set flag to apply subcommand
2022-08-18 08:36:12 +08: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
yxxhero c26bc2e26e Merge pull request #297 from arkaitzj/FixForReadDir
Fix for readDir selection, currently any template that uses readDir* functions seems to break
2022-08-17 15:48:45 +08:00
Arkaitz Jimenez c9b5f95890 lint
Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-16 16:25:24 +02: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
Arkaitz Jimenez 824f7ba2b2 Create failing test case
Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-16 16:25:24 +02:00
yxxhero e44a915d40 Merge pull request #294 from helmfile/fix_miss_tag_in_docker_build
fix tag miss in docker build
2022-08-16 09:41:33 +08:00
yxxhero 295d54d838 fix tag miss in docker build
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-16 09:11:22 +08:00
yxxhero 1d882697d9 Merge pull request #293 from helmfile/dependabot/go_modules/github.com/mattn/go-isatty-0.0.16
build(deps): bump github.com/mattn/go-isatty from 0.0.14 to 0.0.16
2022-08-16 04:50:14 +08:00
dependabot[bot] 3986f81ff8 build(deps): bump github.com/mattn/go-isatty from 0.0.14 to 0.0.16
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.14 to 0.0.16.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.14...v0.0.16)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-15 15:36:03 +00:00
yxxhero 211b8efebb Merge pull request #262 from pathob/feature/ubuntu-image-push-and-workflow-refactoring
Refactor 'images' workflow, include Ubuntu image to push
2022-08-15 20:58:29 +08:00
yxxhero 8d798e69f1 Merge pull request #288 from helmfile/update_golang_lint
update golang lint
2022-08-14 14:45:30 +08: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 8c4a122be4 Merge pull request #282 from AnatolyRugalev/patch-1
Update ArchLinux installation instructions
2022-08-14 07:49:05 +08:00
Anatoly Rugalev 75aa0e5a21 Update ArchLinux installation instructions
Signed-off-by: Anatoly Rugalev <anatoly.rugalev@gmail.com>
2022-08-14 01:46:55 +02:00
yxxhero 8690d63401 fix lint error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-13 07:40:32 +08:00
yxxhero 18942e2a2c update golang lint
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-12 20:36:09 +08:00
yxxhero f309dc3332 Merge pull request #284 from kuzaxak/skip_missing_remote_secrets
Add file existence check for remote values
2022-08-12 15:41:38 +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
Patrick Hobusch bbf790247b Refactor 'images' workflow, include Ubuntu image to push
Until now, the 'images' workflow was separated into two different jobs,
one for just building the images in e.g. pull requests and the other
one for building and pushing the images e.g. after a merge to the 'main'
branch, which resulted in code repetitions. Also, both jobs used
different approaches, one (build) using a 'matrix strategy' based on
the file name of the Dockerfile, the other one (build and push) having a
seperate build and push step for each Dockerfile.

With this change, both jobs have been unified into a single "build and
optionally push" job to remove the repetitions, which now also shares
the same approach - a matrix strategy based on the file names of the
Dockerfiles.

The package naming now follows a clear schema based on the file name of
the Dockerfile. 'Dockerfile' will result in a 'helmfile' package,
'Dockerfile.ubuntu' will result in a 'helmfile-ubuntu' package and so
on. In order to keep the 'helmfile-debian-stable-slim' image package
name, the 'Dockerfile.debian' had to be renamed to
'Dockerfile.debian-stable-slim' accordingly.

Furthermore, the evaluation of the condition whether a push is intended
(or not) has been moved directly to the 'push' flag of the
'docker/build-push-action'.

Signed-off-by: Patrick Hobusch <patrick.hobusch@gmail.com>
2022-08-10 09:01:37 +02:00
yxxhero 86bfb5689a Merge pull request #280 from helmfile/dependabot/go_modules/go.uber.org/zap-1.22.0
build(deps): bump go.uber.org/zap from 1.21.0 to 1.22.0
2022-08-10 07:15:33 +08:00
dependabot[bot] 13bac519d0 build(deps): bump go.uber.org/zap from 1.21.0 to 1.22.0
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.21.0 to 1.22.0.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/zap/compare/v1.21.0...v1.22.0)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 15:35:45 +00:00
yxxhero 2cb4bdba1a Merge pull request #274 from helmfile/fix_cobra_flag_default_value
Refactor cobra flag default values for readability
2022-08-08 09:55:21 +08:00
Yusuke Kuoka eabf360fe8 Merge branch 'main' into fix_cobra_flag_default_value 2022-08-08 10:35:32 +09:00
yxxhero 5d0a5671f2 fix go.mod (#275)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-08 10:35:02 +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 7488d7513e Merge pull request #230 from helmfile/dependabot/go_modules/k8s.io/apimachinery-0.24.3
Bump k8s.io/apimachinery from 0.23.4 to 0.24.3
2022-08-06 16:54:16 +08:00
yxxhero 8beb69d08e fix cobra flag default value
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-06 15:04:34 +08:00
yxxhero 005ce66afa Merge pull request #268 from axioscode/serge/fix-context-slash
fix: needs error with context that includes slash
2022-08-05 07:14:25 +08: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 913a22e9aa update doccs/index.md about CLI ref (#264)
* update doccs/index.md about CLI ref

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

* update docs/index.md about Getting Started

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-03 10:59:44 +09:00
yxxhero 329ec766fe Merge pull request #266 from jouve/jouve-patch-1
remove selector override in cmd/apply
2022-08-01 17:35:07 +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 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
yxxhero 70d2dd653b Merge pull request #257 from xiaomudk/patch-2
test: Add unit tests for ChartPull
2022-07-23 18:53:48 +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
yxxhero 72579d9386 Merge pull request #256 from xiaomudk/patch-1
test: Add unit tests for ChartExport
2022-07-23 17:36:56 +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 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
yxxhero 7417da6d98 Merge pull request #252 from jouve/fix-help
correct --help cli arg regression
2022-07-22 06:29:22 +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 d27765148e Merge pull request #245 from helmfile/local-chart-repo-server-integration-test
E2E helmfile-template testing with local chart repo server
2022-07-20 21:47:25 +08:00
Yusuke Kuoka 098684c136 E2E helmfile-template testing with local chart repo server
This similar to #239, but different in that it involves a local helm chart repo server instead of a local OCI registry as the container of the chart used in tests.

This also adds a new `localChartRepoServer.enabled` config to the `config.yaml` of each test case directory to enable the local helm repo server in the test, which might be useful when you want to add another test case that involes a remote chart(which is hosted in the local chart repo server).

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-07-20 11:59:32 +00:00
dependabot[bot] 5e0368451e Bump k8s.io/apimachinery from 0.23.4 to 0.24.3
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.23.4 to 0.24.3.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.23.4...v0.24.3)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 12:07:55 +00:00
yxxhero 85ade797ab Use cobra (#234)
switch to cobra

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-19 21:06:18 +09:00
yxxhero 35453566df Merge pull request #240 from xiaomudk/doc
doc: getting start adds repositories configuration
2022-07-19 10:29:57 +08:00
xiaomudk cdea0ff080 doc: getting start adds repositories configuration
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
2022-07-19 10:28:01 +08:00
yxxhero 3a5d4cb62f Merge pull request #241 from toVersus/test/cleanup-snapshot
chore: clean up snapshot test
2022-07-19 06:48:46 +08:00
Tsubasa Nagasawa ac1edafe9a chore: clean up snapshot test
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2022-07-19 00:08:09 +09:00
yxxhero 93b1ac2b19 Merge pull request #239 from helmfile/local-oci-integration-test
Add integration test for #238 with local docker registry as a OCI-based helm chart repo
2022-07-18 22:32:06 +08:00
Yusuke Kuoka 48ae800f79 Add integration test with local oci repo
Follow-up for #238

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-07-18 13:43:01 +00:00
yxxhero eb0415b139 Merge pull request #162 from helmfile/qtran/version-dev
on canary build, version should show "0.0.0-dev"
2022-07-18 19:25:13 +08: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 a4b914abc7 Merge pull request #238 from toVersus/feat/bump-chartify-v0.10.0
feat: bump chartify to v0.10.0 to support OCI registry for adhoc dependencies
2022-07-18 16:12:53 +08:00
Tsubasa Nagasawa 7141003106 feat: bump chartify to v0.10.0 to support OCI registry for adhoc dependencies
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>

This adds OCI registry support for adhoc dependencies.
The users can now add their OCI hosted charts as dependencies to helm releases:

* Bump chartify version to v0.10.0
* Add an example helmfile to advanced usage section
2022-07-18 15:58:39 +09:00
yxxhero b3f4b78cd9 update Readmd.md (#236)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-18 14:06:25 +09:00
yxxhero 122cb25b6a Merge pull request #237 from helmfile/bug-report-improvement-working-ver
Include the working helmfile ver in the bug report
2022-07-18 11:46:25 +08:00
Yusuke Kuoka 866f424578 Include the working helmfile ver in the bug report
so that it might be even more clear if the reported problem has been introduced by the prev release or a long-standing one which existed for longer time period.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-07-18 03:06:11 +00:00
yxxhero f00a8194e0 Merge pull request #169 from yxxhero/add_golang_ci
add Go lint
2022-07-16 20:43:25 +08: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
yxxhero 1d61d7d3e7 Merge pull request #224 from helmfile/update_readme_about_image_repo
update readme about image repo and fix link error
2022-07-14 09:45:19 +08:00
yxxhero 95c444a6cd fix readme.md and index.md for doc link
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-14 09:27:16 +08:00
yxxhero 4e49ed9a1f Merge pull request #228 from lemeurherve/patch-1
fix(doc): add missing version field in the release template example
2022-07-14 06:36:54 +08:00
Hervé Le Meur 9e3f0a3ba3 fix(doc): add missing version in the release template example
Signed-off-by: Hervé Le Meur <hlemeur@cloudbees.com>
2022-07-13 17:45:11 +02:00
yxxhero 008f4906aa Merge pull request #217 from helmfile/fix_doc
Fix doc link error and style error
2022-07-12 07:33:46 +08:00
yxxhero 65fae9c52c Merge pull request #183 from helmfile/dependabot/go_modules/github.com/hashicorp/go-version-1.6.0
Bump github.com/hashicorp/go-version from 1.4.0 to 1.6.0
2022-07-11 13:35:48 +08: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 f0662f2ebe fix docs site issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-08 08:36:02 +08:00
yxxhero fba8b63eac fix link issue for paths.md
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-07 13:42:14 +08:00
yxxhero 603d305194 fix paths.md link error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-07 13:36:16 +08:00
yxxhero 96174e4229 Merge pull request #214 from helmfile/fix_deps_update_issue
Fix helmfile-deps issue that it is unable to find the chartify output
2022-07-06 08:54:14 +08:00
yxxhero 9179cfb55f fix deps issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-06 08:37:19 +08:00
yxxhero 31d3d3fad7 Merge pull request #212 from helmfile/mumoshu-patch-1
The image publishing workflow should trigger on version tags
2022-07-05 21:01:25 +08:00
Yusuke Kuoka 1e5d309e68 The image publishing workflow should trigger on version tags
Ref https://github.com/helmfile/helmfile/discussions/211
2022-07-05 21:29:09 +09: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 a5b7c2b08d fix bug.yaml (#198)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-30 08:56:05 +09:00
yxxhero bf3ce285ec Merge pull request #188 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.8.0
Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
2022-06-30 07:32:41 +08:00
dependabot[bot] e0e49813f2 Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.5...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 15:34:47 +00:00
dependabot[bot] 367b5bbc9b Bump github.com/spf13/cobra from 1.4.0 to 1.5.0 (#175)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-29 20:35:11 +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
dependabot[bot] c9cc2556be Bump github.com/hashicorp/go-version from 1.4.0 to 1.6.0
Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.4.0 to 1.6.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-version/compare/v1.4.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 15:51:03 +00:00
yxxhero c85a085e4d Merge pull request #180 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.7.5
Bump github.com/stretchr/testify from 1.7.4 to 1.7.5
2022-06-25 08:13:08 +08:00
dependabot[bot] 9671bfb2ab Bump github.com/stretchr/testify from 1.7.4 to 1.7.5
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.4 to 1.7.5.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.4...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-24 15:39:04 +00:00
yxxhero 505fff245c Merge pull request #179 from jduepmeier/update-dockerfile
Update alpine base image to 3.16
2022-06-24 16:01:43 +08:00
Jan Düpmeier b4b0763cdf Update alpine base image to 3.16
Signed-off-by: Jan Düpmeier <j.duepmeier@googlemail.com>
2022-06-24 09:33:56 +02:00
yxxhero 219671b54c Merge pull request #176 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.7.4
Bump github.com/stretchr/testify from 1.7.3 to 1.7.4
2022-06-24 07:48:30 +08:00
dependabot[bot] fae23fe380 Bump github.com/stretchr/testify from 1.7.3 to 1.7.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 23:31:45 +00:00
yxxhero 91aea33350 Merge pull request #177 from kobtea/fix/typo
Fix typo in README
2022-06-24 07:30:16 +08:00
Hiroaki Kobayashi 26e0a4a482 Fix typo in README
Signed-off-by: Hiroaki Kobayashi <kobtea9696@gmail.com>
2022-06-23 23:48:22 +09:00
yxxhero 3f48b295d3 update Readme.md (#170)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-21 10:55:01 +09:00
yxxhero 1996304880 fix ci test error (#167)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-21 10:53:19 +09:00
yxxhero 3bf4744049 Merge pull request #172 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.7.3
Bump github.com/stretchr/testify from 1.7.2 to 1.7.3
2022-06-21 08:47:44 +08:00
dependabot[bot] 7cc23f1ee8 Bump github.com/stretchr/testify from 1.7.2 to 1.7.3
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.3)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-20 15:44:07 +00: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 3e60f72d1f docker build test on ci (#164)
* docker build test on ci

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

* fix issue

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

* fix issue

Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-18 18:13:32 +09:00
yxxhero 092c4ed671 Merge pull request #163 from Jasstkn/bump-helm-3.9.0
feat(dockerfile): update helm to 3.9.0
2022-06-16 16:00:36 +08:00
Jasstkn 4fa305c38a fix: build of Dockerfile.ubuntu
Signed-off-by: Jasstkn <mariia.kotliarevskaia@gmail.com>
2022-06-16 09:48:56 +02:00
Jasstkn 724c8eea09 fix: arg helm_version in Dockerfile.ubuntu
Signed-off-by: Jasstkn <mariia.kotliarevskaia@gmail.com>
2022-06-15 15:44:49 +02:00
Jasstkn 2230022ad0 feat(dockerfile): update helm to 3.9.0
Signed-off-by: Jasstkn <mariia.kotliarevskaia@gmail.com>
2022-06-15 15:03:23 +02:00
yxxhero 7183bc5044 Merge pull request #159 from helmfile/dependabot/go_modules/github.com/hashicorp/go-getter-1.6.2
Bump github.com/hashicorp/go-getter from 1.6.1 to 1.6.2
2022-06-15 20:29:17 +08:00
dependabot[bot] a6f1d7c8cf Bump github.com/hashicorp/go-getter from 1.6.1 to 1.6.2
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.6.1...v1.6.2)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-14 15:37:16 +00:00
yxxhero 21b2248d19 Merge pull request #158 from helmfile/dependabot/go_modules/github.com/variantdev/vals-0.18.0
Bump github.com/variantdev/vals from 0.17.1 to 0.18.0
2022-06-14 08:46:39 +08:00
dependabot[bot] e642094ead Bump github.com/variantdev/vals from 0.17.1 to 0.18.0
Bumps [github.com/variantdev/vals](https://github.com/variantdev/vals) from 0.17.1 to 0.18.0.
- [Release notes](https://github.com/variantdev/vals/releases)
- [Changelog](https://github.com/variantdev/vals/blob/main/.goreleaser.yml)
- [Commits](https://github.com/variantdev/vals/compare/v0.17.1...v0.18.0)

---
updated-dependencies:
- dependency-name: github.com/variantdev/vals
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 16:00:26 +00:00
yxxhero 1da88b829c Merge pull request #153 from yxxhero/move_all_subcommand_to_sigle
move all subcommand to sigle file
2022-06-11 16:09:21 +08: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 ec1661c7ac Merge pull request #152 from helmfile/dependabot/go_modules/github.com/variantdev/vals-0.17.1
Bump github.com/variantdev/vals from 0.16.2 to 0.17.1
2022-06-10 11:43:49 +08:00
yxxhero d4160ebc59 Merge pull request #141 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.7.2
Bump github.com/stretchr/testify from 1.7.1 to 1.7.2
2022-06-10 10:37:58 +08:00
yxxhero fb8a7f0bf4 Merge pull request #151 from helmfile/release-automation
Release automation and release build testing
2022-06-10 10:37:40 +08:00
dependabot[bot] 4220f2e3a9 Bump github.com/variantdev/vals from 0.16.2 to 0.17.1
Bumps [github.com/variantdev/vals](https://github.com/variantdev/vals) from 0.16.2 to 0.17.1.
- [Release notes](https://github.com/variantdev/vals/releases)
- [Changelog](https://github.com/variantdev/vals/blob/master/.goreleaser.yml)
- [Commits](https://github.com/variantdev/vals/compare/v0.16.2...v0.17.1)

---
updated-dependencies:
- dependency-name: github.com/variantdev/vals
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-10 02:25:53 +00:00
dependabot[bot] 7a63f8b031 Bump github.com/stretchr/testify from 1.7.1 to 1.7.2
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-10 02:25:43 +00:00
yxxhero 261b311af6 Merge pull request #150 from helmfile/go-1.18
Bump module Go version to 1.18
2022-06-10 10:24:26 +08:00
Yusuke Kuoka 0948bbae1c Release automation and release build testing
We will be using this automation which is triggered on every new tag created in this repo for the upcoming helmfile 0.145.0 release.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-10 02:15:40 +00:00
Yusuke Kuoka 4071f6aa99 Bump module Go version to 1.18
Our CI workflows and docker builds already use 1.18 but our go.mod was left with 1.17. This bumps it to 1.18.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-10 02:09:09 +00: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 ef812d1227 Merge pull request #144 from helmfile/add-args-flag-removal-to-1.0-proposal
proposal: Drop --args in Helmfile 1.0
2022-06-08 12:10:24 +08:00
Yusuke Kuoka 9abcc1f413 proposal: Drop --arsg in Helmfile 1.0
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-08 03:43:30 +00:00
yxxhero e182e9e775 Merge pull request #140 from ogugu9/fix-getting-started-chart
Fix deprecated chart in Getting Started
2022-06-06 20:21:29 +08:00
ogugu (Riku Ogura) c897a10dce Fix deprecated chart in Getting Started
Signed-off-by: ogugu (Riku Ogura) <e.cos.isin@gmail.com>
2022-06-06 20:59:34 +09:00
yxxhero fef447ddec Merge pull request #136 from helmfile/towards-1.0
Add proposals about two breaking changes before we cut Helmfile 1.0
2022-06-06 09:43:56 +08: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 9032395818 Merge pull request #138 from stoned/doc-xref
Minor documentation fixes
2022-06-05 21:20:33 +08:00
Stoned Elipot 214d06e5cd Whitespace fixes
Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
2022-06-05 14:14:34 +02:00
Stoned Elipot 6ea940e50f Fix documentation link
Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
2022-06-05 14:14:34 +02:00
Yusuke Kuoka bf9eeba544 Add proposals about two breaking changes before we cut Helmfile 1.0
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 08:32:54 +00:00
Yusuke Kuoka 173767d2c5 Create SECURITY.md (#135)
Probably this is the best we can currently offer. Any suggestions are welcomed though.

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

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 17:11:54 +09:00
Yusuke Kuoka 83a7245d0f Enhance the bug report form (#134)
It turned out we lack some important information that is necessary to make it a real bug without guesswork.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 16:16:17 +09:00
Yusuke Kuoka 58721ab1fc Add yxxhero as a maintainer (#132)
I've asked a few times by @yxxhero if he deserves a seat as a maintainer of the Helmfile project.
Seeing the amount and the number of his recent contributions, and the nature of his contributions (add tests and fix bugs and CI issues, review PRs), I think he is in a relatively unique position compared to existing maintainers, and we can work better together!

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 16:04:36 +09:00
yxxhero 6e5a726ae5 fix ci issue (#131)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-06-05 15:31:36 +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 TRANandYusuke Kuoka 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
DominicandYusuke Kuoka 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
Yusuke Kuoka b6f3972381 Merge pull request #130 from yxxhero/little_code_opt
little code optimize
2022-06-05 14:46:55 +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 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
Quan TRAN e73fb21a84 Merge pull request #114 from helmfile/dependabot/go_modules/github.com/imdario/mergo-0.3.13
Bump github.com/imdario/mergo from 0.3.12 to 0.3.13
2022-05-31 15:37:36 +02:00
dependabot[bot] f8597c564e Bump github.com/imdario/mergo from 0.3.12 to 0.3.13
Bumps [github.com/imdario/mergo](https://github.com/imdario/mergo) from 0.3.12 to 0.3.13.
- [Release notes](https://github.com/imdario/mergo/releases)
- [Commits](https://github.com/imdario/mergo/compare/0.3.12...v0.3.13)

---
updated-dependencies:
- dependency-name: github.com/imdario/mergo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-31 15:14:45 +02:00
Quan TRAN 736edf89fe Merge pull request #122 from philippeckel/update-Helm-diff-in-Dockerfile
Update Helm diff plugin to version 3.5.0 in Dockerfile
2022-05-31 15:13:10 +02:00
Quan TRAN 9580c8863d Merge pull request #123 from rodrigodc07/fix_CVE-2020-26160
Update sops version on dockerfile
2022-05-31 14:38:40 +02:00
Philipp Eckel 73b7243f94 Update Helm diff plugin to version 3.5.0 in Dockerfile
Signed-off-by: Philipp Eckel <philipp.eckel@coyoapp.com>
2022-05-31 11:33:02 +02:00
Rodrigo Dantas 86eff8e2ed Update sops version on Dockerfile.debian and Dockerfile.ubuntu
Signed-off-by: Rodrigo Dantas <rodrigodc07@gmail.com>
2022-05-30 19:03:32 -03:00
Rodrigo Dantas 6ca79ef7f1 Update sops version on dockerfile
Signed-off-by: Rodrigo Dantas <rodrigodc07@gmail.com>
2022-05-30 19:03:32 -03: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
Quan TRAN f16001e61a Merge pull request #118 from yxxhero/fix_integration_tests_error
fix intergration test for argo-cd form master to main branch
2022-05-30 10:07:56 +02:00
yxxhero 070ed0dd47 fix intergration test for argo-cd form master to main branch
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-30 07:45:01 +08:00
yxxhero 9011d2dd15 fix import path name error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
yxxhero c34c7c87a1 add get tpl e2e test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
yxxhero 23b6429f33 add toYaml and fromYaml
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
yxxhero 33c66a6f46 add readfile e2e test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
yxxhero 70b874a596 add more testcases
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
yxxhero 80457d964c add e2e tmpl test
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-24 07:50:08 +08:00
Quan TRAN a993b2af3f Merge pull request #85 from itscaro/qtran/helm3.9
add helm 3.9 to tests
2022-05-23 11:44:29 +02:00
Quan TRAN c32689e779 Merge pull request #104 from yxxhero/update_envExec_doc
update envExec docs
2022-05-23 10:58:03 +02:00
yxxhero 8a2fe28bbf update envExec docs
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-23 16:46:29 +08:00
Quan TRAN 2e58c01ced add helm 3.9 to tests
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-05-23 10:44:57 +02:00
Quan TRAN 26b4be3b5d Merge pull request #106 from helmfile/dependabot/go_modules/github.com/hashicorp/go-getter-1.6.1
Bump github.com/hashicorp/go-getter from 1.6.0 to 1.6.1
2022-05-23 10:39:59 +02:00
Quan TRAN 30f53b914e rename stage/job in github actions 2022-05-23 10:15:49 +02:00
Quan TRAN 3b27243ec6 fix typo in github actions 2022-05-23 10:12:47 +02:00
Quan TRAN d9143f55ce fix image build on tag / main 2022-05-23 10:12:12 +02:00
Yusuke Kuoka 7e2462ed62 Merge pull request #40 from itscaro/qtran/build-tag
build image on tag
2022-05-22 15:25:35 +09: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
dependabot[bot] e67203ac9d Bump github.com/hashicorp/go-getter from 1.6.0 to 1.6.1
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-20 15:27:40 +00:00
Quan TRAN eddb9eec45 Merge pull request #97 from yxxhero/rename_execEnvs_to_-envExec
rename execEnvs to envExec
2022-05-20 09:52:26 +02:00
Quan TRAN d10a64ccf6 Merge pull request #103 from helmfile/dependabot/go_modules/github.com/hashicorp/go-getter-1.6.0
Bump github.com/hashicorp/go-getter from 1.5.11 to 1.6.0
2022-05-20 09:47:37 +02:00
dependabot[bot] eace00f3db Bump github.com/hashicorp/go-getter from 1.5.11 to 1.6.0
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.5.11 to 1.6.0.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.5.11...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-19 15:34:33 +00: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 dec10eb9d9 fix: fix lint error
Signed-off-by: Grégory SANCHEZ <gregory.sanchez@icloud.com>
2022-05-17 14:03:32 +02:00
Grégory SANCHEZandYusuke Kuoka 3978767ca7 Update main.go
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
Signed-off-by: Grégory SANCHEZ <gregory.sanchez@icloud.com>
2022-05-17 14:00:55 +02: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 2dff652862 Merge pull request #96 from helmfile/dependabot/go_modules/github.com/urfave/cli-1.22.9
Bump github.com/urfave/cli from 1.22.5 to 1.22.9
2022-05-16 18:24:18 +02:00
dependabot[bot] af497ae73a Bump github.com/urfave/cli from 1.22.5 to 1.22.9
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.5 to 1.22.9.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.5...v1.22.9)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 15:47:12 +00:00
Quan TRAN d5f37b0e35 build image on tag
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-05-16 17:18:49 +02:00
Quan TRAN 4959c5bdde Merge pull request #84 from itscaro/qtran/docs
fix old URLs in docs and fix Dockerfile
2022-05-16 17:17:34 +02:00
Quan TRAN 3f14cb1d00 fix Dockerfile
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-05-16 17:17:26 +02:00
Quan TRAN 35bd7c1349 update urls in docs & CONTRIBUTING.md
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-05-16 17:17:26 +02:00
Quan TRAN dccaa6ac4f Merge pull request #87 from helmfile/dependabot/go_modules/go.uber.org/zap-1.21.0
Bump go.uber.org/zap from 1.19.0 to 1.21.0
2022-05-16 17:15:41 +02: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
Quan TRAN ad4039e2bc Merge pull request #76 from carnei-ro/chore/bump-variantdev-vals
chore: bump variantdev/vals to support remote secret tfstateremote
2022-05-16 16:34:00 +02:00
Quan TRAN a942f12d36 Merge pull request #81 from yjqg6666/readme
[#80] README, update release tag url
2022-05-16 14:27:19 +02:00
Quan TRAN 490fa01247 Merge pull request #74 from yxxhero/update_template_func_doc
update doc for template func
2022-05-16 14:26:12 +02:00
Quan TRAN 7bc8ae585a Merge pull request #94 from helmfile/dependabot/go_modules/github.com/hashicorp/go-version-1.4.0
Bump github.com/hashicorp/go-version from 1.2.1 to 1.4.0
2022-05-16 14:22:12 +02:00
Quan TRAN a4c2a341bc Merge pull request #93 from helmfile/dependabot/go_modules/github.com/google/go-cmp-0.5.8
Bump github.com/google/go-cmp from 0.5.7 to 0.5.8
2022-05-16 14:21:14 +02:00
yxxhero ba5bea17d7 update Readme.md for execEnvs
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-14 10:13:09 +08:00
yxxhero 1258c9ed10 add execEnvs
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-05-14 09:59:08 +08:00
dependabot[bot] aed75091fa Bump github.com/hashicorp/go-version from 1.2.1 to 1.4.0
Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.2.1 to 1.4.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-version/compare/v1.2.1...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-13 15:27:25 +00:00
dependabot[bot] d2498d10cc Bump github.com/google/go-cmp from 0.5.7 to 0.5.8
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.7 to 0.5.8.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.7...v0.5.8)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-13 15:27:16 +00:00
Leandro Carneiro 7d74ebb16e Merge branch 'main' into chore/bump-variantdev-vals 2022-05-10 13:25:44 -03:00
Quan TRAN 21b9cc027c Merge branch 'main' into dependabot/go_modules/go.uber.org/zap-1.21.0 2022-05-10 12:42:30 +02:00
Quan TRAN 29d40d9d9c Merge pull request #59 from helmfile/dependabot/go_modules/github.com/spf13/cobra-1.4.0
Bump github.com/spf13/cobra from 1.3.0 to 1.4.0
2022-05-10 12:41:37 +02:00
dependabot[bot] f93647be60 Bump go.uber.org/zap from 1.19.0 to 1.21.0
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.19.0 to 1.21.0.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/zap/compare/v1.19.0...v1.21.0)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-10 10:26:09 +00:00
Quan TRAN 78de70349a Merge branch 'main' into dependabot/go_modules/github.com/spf13/cobra-1.4.0 2022-05-10 12:25:27 +02:00
Quan TRAN 341d81a3f3 Merge pull request #60 from helmfile/dependabot/go_modules/github.com/go-test/deep-1.0.8
Bump github.com/go-test/deep from 1.0.7 to 1.0.8
2022-05-10 12:24:48 +02:00
Quan TRAN f384fa8819 Merge pull request #56 from helmfile/dependabot/go_modules/github.com/stretchr/testify-1.7.1
Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
2022-05-10 12:24:26 +02:00
dependabot[bot] 62653032eb Bump github.com/go-test/deep from 1.0.7 to 1.0.8
Bumps [github.com/go-test/deep](https://github.com/go-test/deep) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/go-test/deep/releases)
- [Changelog](https://github.com/go-test/deep/blob/master/CHANGES.md)
- [Commits](https://github.com/go-test/deep/compare/v1.0.7...v1.0.8)

---
updated-dependencies:
- dependency-name: github.com/go-test/deep
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-10 12:14:06 +02:00
dependabot[bot] 548e66a118 Bump github.com/spf13/cobra from 1.3.0 to 1.4.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/v1.4.0/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-10 12:13:49 +02:00
dependabot[bot] e06e7f6d7f Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-10 12:13:29 +02:00
King Jin 1adcbc152c update README, update release download url, tags used
Signed-off-by: King Jin <jinking.this@gmail.com>
2022-05-10 09:23:21 +08:00
Leandro Carneiro d018b581a9 chore: bump variantdev/vals to support remote secret tfstateremote
Signed-off-by: Leandro Carneiro <leandro@carnei.ro>
2022-05-09 20:29:17 -03:00
King Jin fda29a639f [#80] README, update release tag url
Signed-off-by: King Jin <jinking.this@gmail.com>
2022-05-06 13:33:36 +08:00
yxxhero 761b12e120 update doc for template func
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-30 14:58:38 +08:00
Yusuke Kuoka 34a431f5f2 Merge pull request #71 from yxxhero/add_unittest_for_errors_go
add unittest for error.go in pkg/app
2022-04-29 14:29:19 +09: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
Yusuke Kuoka e4f57718e1 Merge pull request #68 from yxxhero/add_unittest_for_context
add unittest for context.go
2022-04-28 06:05:34 +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
Yusuke Kuoka 85671c4dc1 Merge pull request #67 from yxxhero/add_unittest_for_ValidateConfig
add unittest for ValidateConfig
2022-04-27 09:30:52 +09: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
Yusuke Kuoka e0a618d0cc Merge pull request #54 from helmfile/qtran/dependabot
Create dependabot.yml
2022-04-22 09:09:18 +09:00
Yusuke Kuoka df6ec3a82e Merge pull request #55 from itscaro/image/qtran/helm-3.8.2
(feat) update helm to v3.8.2 in container images
2022-04-22 09:08:37 +09:00
Yusuke Kuoka e1d8cea8cc Merge pull request #53 from itscaro/qtran/ssh-client-in-image
feat: Add openssh-client to images
2022-04-22 09:08:11 +09:00
Quan TRAN 617121e761 (feat) update helm to v3.8.2 in container images
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-21 23:15:45 +02:00
Quan TRAN b9a69696ac Create dependabot.yml
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-21 23:10:05 +02:00
Quan TRAN 8304d49cc3 remove pip from debian-based images
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-21 23:01:34 +02:00
Quan TRAN c6920363d1 (feat) add openssh-client to images (closes #41)
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-21 22:40:42 +02: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
Yusuke Kuoka fc3f468a81 Merge pull request #48 from yxxhero/fix_golint_warn
fix go lint warn
2022-04-21 18:31:37 +09: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
Yusuke Kuoka eee5f834c6 Merge pull request #46 from helmfile/mumoshu-patch-1
Update README.md
2022-04-19 09:49:21 +09:00
Yusuke Kuoka feb2bc9589 Update README.md 2022-04-19 09:48:54 +09:00
Yusuke Kuoka f8f50c8bcd Merge pull request #45 from yxxhero/remove_gotest
remove gotest deps
2022-04-19 09:24:46 +09:00
yxxhero a0d4047cc7 remove gotest deps
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-19 08:02:21 +08:00
Yusuke Kuoka 9e9567ed7d Merge pull request #44 from yxxhero/add_unittest_for_constants
add unittest for constants.go
2022-04-19 08:51:41 +09: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 21ab18b906 Merge pull request #39 from itscaro/qtran/helm382
(test) update helm to 3.8.2
2022-04-15 07:25:09 +09: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
Quan TRAN dad58533b5 (test) update helm to 3.8.2
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-14 10:13:24 +02:00
Quan TRAN 86c9a1ae3d Fix canary image publication 2022-04-14 10:04:26 +02: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
Yusuke Kuoka b5480123a2 Merge pull request #31 from yxxhero/fix_outout_dir
fix output-dir issue
2022-04-14 08:20:14 +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
yxxhero ec648c4011 use os.PathSeparator replace /
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-12 13:13:53 +08:00
Quan TRAN c7b23a67cb Merge pull request #32 from yxxhero/fix_typo_state
(fix) typo in state.go
2022-04-11 23:47:59 +02:00
Quan TRAN 3cae3f4f89 add integration test
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-11 23:41:28 +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
yxxhero 7743f317d1 fix output-dir issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-11 12:57:09 +08:00
Yusuke Kuoka f1a250cab3 Merge pull request #28 from itscaro/qtran/image
[Dockerfile] only use image alpine for compilation, add sops & age to pre-built image, remove helm v2 image
2022-04-08 11:20:05 +09:00
Yusuke Kuoka 89a00ca3e3 Merge pull request #25 from helmfile/bump-go-getter
Bump go-getter to 1.5.11
2022-04-08 11:18:20 +09:00
Yusuke Kuoka b672af6c06 Bump go-getter to 1.5.11
Ref https://github.com/roboll/helmfile/issues/2106

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-04-08 02:03:40 +00:00
Quan TRAN a4555f34ff test build image without publication
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-06 11:30:10 +02:00
Quan TRAN 570a2c22e9 [Dockerfile] only use image alpine for compilation, add sops & age to pre-built image, remove helm v2 image
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-06 10:59:24 +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 8fb418e3c9 Merge pull request #21 from itscaro/qtran.fix-golang1.18
[fix] bump go 1.18 & optional TAG definition in makefile
2022-04-06 08:39:14 +09: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 f7eb4a9e3e Merge pull request #19 from itscaro/qtran/badge
Update badge to reflect Github Action status
2022-04-06 08:36:23 +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 03cbf5f9f4 [fix] bump go 1.18 & optional TAG definition in makefile
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-06 00:35:23 +02: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
Quan TRAN eed489efc1 Update badge to reflect Github Action status
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-05 21:16:52 +02:00
yxxhero 5cb82ec3d1 add unittest for RequiredEnv func
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-05 22:53:07 +08:00
Yusuke Kuoka 4247b97eb1 Merge pull request #2 from itscaro/qtran/go1.18
bump go 1.18 & remove .circleci
2022-04-05 08:51:15 +09:00
Yusuke Kuoka 4480ec2cdc Merge pull request #11 from yxxhero/add_unittest_for_apptest
add unittest for load_opts.go
2022-04-05 08:50:11 +09:00
Yusuke Kuoka 7cc9778a13 Merge pull request #16 from itscaro/qtran/helm-3.8.1
[test] update helm 3.8.0 to 3.8.1
2022-04-05 08:49:38 +09:00
yxxhero 8e5c779626 update args_test.go unittest
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-05 06:26:42 +08:00
Quan TRAN b2798315b1 [test] update helm 3.8.0 to 3.8.1
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-04 16:39:06 +02:00
Quan TRAN a1dfcb3480 bump go 1.18 & remove .circleci
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-04-04 16:33:48 +02:00
yxxhero 02058cc1f5 add unittest for load_opts.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-04 17:20:54 +08:00
Yusuke Kuoka 4a52ce0ac2 Merge pull request #13 from yxxhero/mv_captureStdout_as_public_func
mv captureStdout as public func
2022-04-04 10:06:03 +09:00
yxxhero e0244bc341 mv captureStdout as public func
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 22:24:38 +08:00
Yusuke Kuoka 01b5b79a01 Merge pull request #9 from yxxhero/unit_formatters
add unittest for formatters.go
2022-04-03 19:22:32 +09:00
yxxhero 7f70138b5f add unit for formatters.go
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 17:31:59 +08:00
Yusuke Kuoka ed27147cac Add more links to the new-issue page 2022-04-03 08:35:22 +00:00
Yusuke Kuoka 137afa3f35 Merge pull request #5 from yxxhero/replace_ioutil
remove ioutil usage in all project
2022-04-03 17:16:46 +09:00
Yusuke Kuoka 6c258af4b6 Encourage users to sponsor the project 2022-04-03 08:09:15 +00:00
Yusuke Kuoka 31c68607ac Fix bug report issue form 2022-04-03 08:03:31 +00:00
Yusuke Kuoka 4bafeab2fe Merge pull request #4 from helmfile/issue-form-bug
Add an issue form for bug report
2022-04-03 17:00:31 +09:00
Yusuke Kuoka 4567a643a5 Skip CI for changes in issue templates 2022-04-03 07:58:13 +00:00
Yusuke Kuoka 81cc843710 Add an issue form for bug report
Ref https://github.com/roboll/helmfile/issues/1824
2022-04-03 07:56:34 +00:00
yxxhero 303ef9cd80 remove ioutil usage in all project
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 15:53:19 +08:00
Yusuke Kuoka 1aa87538a7 Publish canary container images via ghcr.io
Ref https://github.com/roboll/helmfile/issues/1824
2022-04-03 07:25:28 +00:00
Yusuke Kuoka 11ab0cb8c8 Lock issues and pull requests after close
Ref https://github.com/roboll/helmfile/issues/1824
2022-04-03 05:19:22 +00:00
Yusuke Kuoka e561e9bc06 Add a documentation badge to README 2022-04-03 05:11:01 +00:00
Yusuke Kuoka 3267484f47 Documentation site based on mkdocs and Read the Docs
Ref https://github.com/roboll/helmfile/issues/1824
Ref https://github.com/roboll/helmfile/issues/1755
2022-04-03 05:04:54 +00:00
Yusuke Kuoka 498a976efb Add stale bot config
Ref https://github.com/roboll/helmfile/issues/1824
2022-04-03 02:48:01 +00:00
Yusuke Kuoka f6fac3ff32 Add an experimental GitHub Actions workflow for CI
All the credits goes to @itscaro's work at https://github.com/roboll/helmfile/pull/2084. The only change I made is related to the main branch rename.
2022-04-03 02:29:34 +00:00
Yusuke Kuoka 19ba9d2c4d Merge remote-tracking branch 'origin/master' into main 2022-04-03 02:26:35 +00:00
Yusuke Kuoka 1e41817c63 Create FUNDING.yml 2022-04-03 11:18:04 +09: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
qb-abdul 4716320d99 Update README.md (#2105)
Added examples in Readme.md for fetching values from Remote
2022-03-31 10:54:25 +09:00
Yusuke Kuoka 9b621b3d21 Bump chartify to v0.9.5 (#2119)
This release of chartify fixes a single bug in chartify that resulted in a few issues when your chart had dependencies. One of issues is the mysterious "no cached repository for helm-manager-HASH found" error mentioned in https://github.com/variantdev/chartify/pull/31. Another is #2117 which was due to the bug resulted in rendering some resources, CRDs in the case, twice.

See https://github.com/variantdev/chartify/releases/tag/v0.9.5 for more information.
2022-03-29 09:45:00 +09:00
yxxhero a8784a17ed precheck for make test (#2116)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-03-27 12:21:36 +09:00
yxxhero cabaf15a1a update go for 1.14 to 1.17 (#2115)
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-03-27 12:21:00 +09:00
Yusuke Kuoka 04c379b284 Bump chartify to v0.9.4 (#2114)
This release fixes an issue when you tried to chartify a local chart whose directory name does not match the name of the chart defined in Chart.yaml.

See https://github.com/variantdev/chartify/releases/tag/v0.9.4 for more information.
2022-03-25 09:37:31 +09:00
Yusuke Kuoka 742391357a Fix release job by limiting gox parallelism 2022-03-24 02:18:27 +00:00
Yusuke Kuoka f65d1e6b05 Bump chartify to v0.9.3 (#2113)
This release fixes a few issues, including a regression introduced in the previous version of chartify v0.9.2.

See https://github.com/variantdev/chartify/releases/tag/v0.9.3 for more information.
2022-03-24 10:36:01 +09:00
Yusuke Kuoka 185bc82992 Bump chartify to v0.9.2 (#2102)
This should fix a few issues, most notably that adhoc dependencies breaks when some of original chart dependencies are unresolvable with `helm dep up` and/or `helm dep build`.

https://github.com/variantdev/chartify/releases/tag/v0.9.2
2022-03-14 19:25:08 +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
Yohan Belval 1d4d67fd56 Update USERS.md (#2089)
Added ShareGate to the list of companies that happily use helmfile in production 👍
2022-03-09 20:35:42 +09:00
Quan TRAN 700a89f3ff add integration tests for helm v3.8.0 (#2085) 2022-02-15 09:37:09 +09:00
Anton Bretting 2f04831817 Fix various golangci-lint errors (#2059) 2022-02-12 20:28:08 +09:00
Quan TRAN 9a2df3c0a2 add example to demonstrate remote helmfiles & remote charts
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-02-12 17:52:52 +09:00
Quan TRAN baafe702b2 use user cache directory for remote helmfiles
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-02-12 17:52:52 +09:00
Quan TRAN 242e601898 add subcommands cache info cache cleanup
Signed-off-by: Quan TRAN <account@itscaro.me>
2022-02-12 17:52:52 +09:00
Quan TRAN cf02442591 goGetterChart() downloads to user cache dir instead of working dir 2022-02-12 17:52:52 +09:00
Quan TRAN 766b03047c Enable get() to be used with alias $.StateValues (#2081) 2022-02-09 09:18:46 +09:00
Sören Jentzsch 19927fc147 feat: Add --suppress option for diff and apply commands (#2077) 2022-02-03 08:46:39 +09:00
Yusuke Kuoka 061644c5d0 Fix readdir regression while merging (#2061)
Ref https://github.com/roboll/helmfile/pull/2058#issuecomment-1019439394
2022-01-23 20:37:46 +09:00
Nils 1d70130ab9 Fix ReadDir templating function to respect base path (#2058)
Ref https://github.com/roboll/helmfile/pull/1934#issuecomment-1018663764
2022-01-23 12:20:56 +09:00
drivelikebrazil debd3c0eea Add --skip-tests to helmfile template command (#2057)
* Add skip-tests to helmfile template command

* Fix formatting
2022-01-22 15:26:17 +09:00
Yusuke Kuoka 87e5903705 Stop infinite loop of deleting/creating tag on release 2022-01-10 09:07:06 +00:00
Yusuke Kuoka 9e9a90f8ef Fix panic on normalizing path containing .. (#2042)
Fixes #2039
2022-01-10 17:45:44 +09:00
Quan TRAN c069fbf268 add cleanup to write-values & lint to harmonise this flag (#2021) 2022-01-10 17:32:02 +09:00
Christoph PetrauschandYusuke Kuoka 346e318fd0 Correct enabled property in helmfile list (#1921)
Use the value of the `condition` field instead of the `installed` field of a release in the `enabled` column of helmfile list.
The value of the `installed` field is shown in a new `installed` column.

Fixes #1920

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-01-10 17:24:07 +09:00
Nils 753de35ee0 Add readDir as a templating function (#1934)
Adds a new templating function called `readDir`. With `readDir` users can read the contents of a specified directory and get a list of all contained files. This is useful when reading a bunch of files from a directory. The following example shows a snippet of a values file for configuring a Logstash deployment. Using only `readFile`, a user must specify each file by hand and adjust this list as the number of files to be read grows.
```yaml
logstash:
  configs:
    logstash.yml: |
      {{- tpl (readFile "config/logstash.yml.gotmpl") . | nindent 6 }}
    jvm.options: |
      {{- readFile "config/jvm.options" | nindent 6 }}
    pipelines.yml: |
      {{- readFile "config/pipelines.yml" | nindent 6 }}
  pipelines:
    beats-log4j.conf: |
      {{- readFile "config/pipelines/beats-log4j.conf" | nindent 6 }}
    nginx-access.conf: |
      {{- readFile "config/pipelines/nginx-access.conf" | nindent 6 }}
    nginx-error.conf: |
      {{- readFile "config/pipelines/nginx-error.conf" | nindent 6 }}
    syslog-logs.conf: |
      {{- readFile "config/pipelines/syslog-logs.conf" | nindent 6 }}
    tcp-logs.conf: |
      {{- readFile "config/pipelines/tcp-logs.conf" | nindent 6 }}
    udp-debug.conf: |
      {{- readFile "config/pipelines/udp-debug.conf" | nindent 6 }}
    udp-logs.conf: |
      {{- readFile "config/pipelines/udp-logs.conf" | nindent 6 }}
  certificates:
    ca.crt: |
      {{- readFile "config/certificates/ca.crt" | nindent 6 }}
    logstash.crt: |
      {{- readFile "config/certificates/logstash.crt" | nindent 6 }}
    logstash.key: |
      {{- readFile "config/certificates/logstash.key" | nindent 6 }}
```
With `readDir` the above snippet can be rewritten as follows:
```yaml
logstash:
  configs:
  {{- range readDir "config" }}
    {{ base . }}: |
      {{- if hasSuffix "gotmpl" . }}
          {{- tpl (readFile .) $ | nindent 6 }}
      {{- else }}
          {{- readFile . | nindent 6 }}
      {{- end }}
  {{- end }}
  pipelines:
  {{- range readDir "config/pipelines" }}
    {{ base . }}: |
      {{- readFile . | nindent 6 }}
  {{- end }}
  certificates:
  {{- range readDir "config/certificates" }}
    {{ base . }}: |
      {{- readFile . | nindent 6 }}
  {{- end }}
```
2022-01-10 17:22:24 +09:00
Samo Jelovšek 16f19613fb Set postsync and cleanup error (#2009)
Fixes #1272
2022-01-10 17:11:13 +09:00
Graeme GilliesandGraeme Gillies 8bdf377be0 Bump sprig library to v3.2.1 (#1880)
Fixes #1646

This will allow us to use the new `fromJson` and `mustFromJson` functions
among others.

Co-authored-by: Graeme Gillies <ggillies@gitlab.com>
2022-01-10 17:04:08 +09:00
aperigaultandAntony Perigault 9e58082342 Allow users other than root to use helm plugins (#1766)
Resolves #1134

Co-authored-by: Antony Perigault <antony.perigault@cpexterne.org>
2022-01-10 16:55:00 +09:00
Luke Plausin 4d01eddd3d Added example ArgoCD + helmfile deployment (#1882) 2022-01-10 16:44:47 +09:00
Yusuke Kuoka 91aa0acddb Update README.md
Relates to #2002
2022-01-10 16:37:02 +09:00
Yusuke Kuoka 1735fb5bed Bump helm-diff to version 3.3.1 (#2041)
helm-diff 3.3.1 adds a new option `HELM_DIFF_THREE_WAY_MERGE=true` which enables the use of there-way merge for diff, which is expected to fix #2013
2022-01-10 16:21:14 +09:00
Mårten Svantesson fe8a176db5 feat: Option to pass kubeVersion to helm template (#2002) 2022-01-07 09:05:03 +09:00
Micah Huber 94f99536c6 support apple silicon builds (#2032) 2022-01-07 09:02:30 +09:00
Simon CaronandSimon Caron 578c559640 Bumped go-getter to v1.5.9 (#1982)
Co-authored-by: Simon Caron <simon.caron@protonmail.com>
2022-01-07 09:00:29 +09:00
Travis Truman b101f9ff8d Fix capitalization of disableOpenAPIValidation config in README (#2003)
See https://github.com/roboll/helmfile/blob/master/pkg/state/state.go#L220
2022-01-07 08:59:49 +09:00
Quan TRAN 170e29a558 bump to go 1.17.3 with alpine 3.13 (#2024)
* bump to go 1.17.5

* bump to go 1.17.3 for circleci

* use alping 3.15 & helm 3.7.2

* use golang 1.17.3 and alpine 3.13 instead

because of this issue: https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2
2022-01-07 08:58:54 +09:00
Ian Muge 554cbc19f5 upgrade vals allowing for the use of the AzureRM terraform backend (#2029) 2022-01-07 08:57:33 +09:00
Babis K d34dc7bb64 Add support for --insecure-skip-tls-verify flag on helm repo add command (#1990)
Parses a new field in repositories named `skipTLSVerify` and if set to `true`, it appends `--insecure-skip-tls-verify` in `helm repo add` command.

This should be useful with internal self-signed repos, mitm proxies etc.

Resolves #1871
2021-12-21 09:18:57 +09:00
Jonas Rutishauser 1986cb37aa feat: Add go-getter support to load base helmfiles (#1998)
Resolves #1193
2021-12-21 09:16:24 +09:00
Yusuke Kuoka 9efb7afb47 Do fail on a possible typo in needs entries (#2026)
* Do fail on a possible typo in `needs` entries

Helmfile kindly fails with a friendly error when you made a typo in a `needs` entry, i.e. a `needs` entry included a reference to a release that is not defined in the helmfile config.

Example Output:

```
in ./helmfile.needs.yaml: release(s) "app" depend(s) on an undefined release "infrastructure/cert-manager2". Perhaps you made a typo in `needs` or forgot defining a release named "cert-manager2" with appropriate `namespace` and `kubeContext`?
```

This prevents issues like #1959

* Fix regression in helmfile-diff (This may break when you had two or more duplicated releases that are intended to be de-duplicated before DAG calculation using selectors

* Fix regression when you used selector to deduplicate releases before DAG calculation

* Comments

* Fix regressions in helmfile-apply and helmfile-sync

* Fix regression in duplicate release detection
2021-12-18 17:44:55 +09:00
Anatoly Medvedkov 3d7b4287b3 Fix typo in README (#2006) 2021-12-16 09:55:24 +09:00
pjotre86andPeter Aichinger ca6dd7a60f Make .Environment values available in .gotmpl files. (#2000)
Currently it's not possible to use `.Environment` values in `*.gomtpl` files. The documentation states the opposite: 
https://github.com/roboll/helmfile#environment (2nd paragraph).
The problem is already described in #1090.
This PR fixes this bug.
Fixes #1090

Co-authored-by: Peter Aichinger <petera@topdesk.com>
2021-11-04 10:04:01 +09:00
pjotre86andPeter Aichinger 9354c38a0a Process feedback for pr 1983 (#1992)
* Guard collectNeeds-method against infinite recursion.

* Also check for namespace and kubecontext when collecting needs.

Co-authored-by: Peter Aichinger <petera@topdesk.com>
2021-10-22 08:29:33 +09:00
pjotre86andPeter Aichinger c0668874e3 Add documentation for needs parameterization. (#1987)
* Add documentation for needs parameterization.

Co-authored-by: Peter Aichinger <petera@topdesk.com>
2021-10-21 08:36:00 +09:00
pjotre86andPeter Aichinger 77e6268bcb Add support for transitive dependencies. (#1983)
Co-authored-by: Peter Aichinger <petera@topdesk.com>
2021-10-20 17:55:08 +09:00
Aditya Menon 9a0ce53608 Support Helm 3.7.0's reworked OCI support (#1970)
Signed-off-by: Aditya Menon <aditya.menon@spin.pm>
2021-10-04 09:19:15 +09:00
vseryozhenkoandValera Seryozhenko 787e6c80d1 ubuntu docker based image for helmfile (#1863)
Co-authored-by: Valera Seryozhenko <vseryozhenko@healthjoy.com>
2021-09-14 16:01:34 +09:00
Nicolas Sterchele 724b4b36f3 readme: fix wrong paths for environments on conf example (#1885)
As we are using "environments" all over the place this allows to add
clarity
2021-09-14 15:58:53 +09:00
James Christian 2792ef75d1 bug: write-values deletes provided --values files. (#1905)
This fixes the bug by not including provided values files in the array of generated values, which is evalutated in a defered block.
Resolves #1904
2021-09-14 14:51:22 +09:00
Yusuke Kuoka f57b510d01 Fix json patches and strategic patches to do work when there was only one resource in the targeted chart/directory (#1962)
Ref https://github.com/roboll/helmfile/issues/1954
2021-09-14 14:48:20 +09:00
Yusuke Kuoka 7845cccd23 Stop integration test for Helm 2.17.0 (#1961)
It turned out the Helm 2.17.0 binary is nowhere now. I considered a bit about checking for a newer Helm 2.x releases as an alternative but I resisted as it is almost a year since EoL of Helm 2. Thanks Helm 2. Long live Helm 3!
2021-09-14 05:19:53 +09:00
Yusuke Kuoka e1cabc82e3 Add support for --validate on chartify (#1960)
Apparently we needed to pass `--validate` on helm-template run by chartify when the targeted chart contains Capabilities.APIVersions in a chart template. Otherwise, you can never make such chart work with chartify, as at apply time helm template expressions that involved Capabilities.APIVersions are already nowhere.
2021-09-14 04:48:21 +09:00
Alex Meddin 0f91f2c9cf Add IKEA to users. (#1925) 2021-09-14 04:41:19 +09:00
George Gaál 8594944f63 Update writing-helmfile.md (#1937)
fix small typo
2021-09-14 04:36:40 +09:00
Rei ae438c8e9e Add more examples for remote env value files (#1938) 2021-09-14 04:36:05 +09:00
Jake Hill ad2f8e87e6 Add debian docker image, drop helm2, upgrade packages. (#1956)
- Add debian image based on `stable-slim`, desire for this is largely
  around my use case using Azure DevOps which makes it challenging to
  use images which are not glibc based.
- Drop support for helm2 in the docker images. This is a tricky one but
  given that I was having errors during the docker build for helm2 and
  the fact that it has been EoL for a long time now made me think that
  this was the correct move.
- As a "while I'm in here" I've upgraded kubectl and helm. I've popped
  on the most current patch of the last release (v1.20.3) to give a
  slightly broader support for different Kubernetes versions.
- Reworked CI to support pushing a debian and alpine base, and dropped
  support for the helm2 versions.
2021-09-14 04:30:32 +09:00
Yusuke Kuoka ccd81de77e Set longer no_output_timeout for release
Ref https://support.circleci.com/hc/en-us/articles/360007188574-Build-has-hit-timeout-limit
2021-07-26 00:04:11 +00:00
Evgenii Tereshkov d8247e6543 Update writing-helmfile.md: fix typos (#1892) 2021-07-02 07:31:47 +09:00
Alex Meddinandalmed4 46b17e2cdb feat: pass-credentials to repo (#1899)
This adds the ability to include the --pass-credentials flag to the helm add repo command by:

- Adding repo.passCredentials to the helmfile yaml
- Changing state, helmexec, and app to include RepositorySpec.PassCredentials

Resolves #1898

Co-authored-by: almed4 <alexandre.meddin@ingka.ikea.com>
2021-07-02 07:31:16 +09:00
Yusuke Kuoka c623730374 Bump golang.org/x/crypto (#1877)
Resolves #1876
2021-06-10 09:16:11 +09:00
Yusuke Kuoka 72e71608b1 Fix chartify regression of missing chart dependencies (#1869)
* Fix chartify regression of missing chart dependencies

Fixes https://github.com/roboll/helmfile/issues/1867

* Add integration test cases for issues #1857 and #1867
2021-06-08 13:06:26 +09:00
dudicoco 0d4adfedab Document hooks events expressions (#1870)
Docs for https://github.com/roboll/helmfile/pull/882

Ref https://github.com/roboll/helmfile/issues/1868#issuecomment-854530386
2021-06-08 10:59:21 +09:00
Yusuke Kuoka 1a109f7400 Fix chartify inability to disable chart dependency (#1861)
Fixes #1857
2021-05-24 08:31:09 +09:00
Yusuke Kuoka 97bab23e0c Fix --skip-cleanup to work with chartify (#1860) 2021-05-24 08:30:58 +09:00
Yusuke Kuoka c881544255 Update README.md 2021-05-22 18:17:28 +09:00
dudicoco 92ba347d6f Add --skip-diff-on-install to helmfile diff (#1841)
* Add --skip-diff-on-install to helmfile diff
2021-05-16 14:02:53 +09:00
Yusuke Kuoka f502a0a779 fix: Do not fail on deps when chart is fetched by go-getter (#1852)
Fixes #1847
2021-05-16 13:43:59 +09:00
Radon Rosborough 77241607fa Fix Helmfile swallowing secrets decryption errors (#1849) 2021-05-14 09:19:32 +09:00
Quan TRAN f38958d6d7 Fix cache path issue on Windows (#1846) 2021-05-13 09:00:43 +09:00
Yusuke Kuoka 212e6acf23 Fix helmfile-lint not to stop on fisrt error (#1836)
Fixes #1826
2021-05-09 13:33:36 +09:00
Yusuke Kuoka efa404e275 Make --skip-needs=true the default option (#1835)
Ref https://github.com/roboll/helmfile/issues/1830#issuecomment-835632716
Ref #1692
Follow-up for #1772
2021-05-09 12:09:58 +09:00
Yusuke Kuoka 794ab9fc66 Fix lint and status not to fail with selector and needs (#1834)
Fixes #1830
2021-05-08 21:23:09 +09:00
Yusuke Kuoka 48bd5c0979 Update go.sum for successful build 2021-05-08 08:49:57 +00:00
Quan TRAN e39a0b3639 bump Go to 1.16.3 and cover helm 3.5.4 (#1825)
* bump go to 1.16.3

* add helm 3.5.4 to integration tests
2021-05-08 17:37:58 +09:00
katsew 58954109fb fix kubeContext does not globally defaulting its value (#1829)
Ref #1810
2021-05-08 17:35:46 +09:00
Yusuke Kuoka cb7fa6bf63 Bump vals to 0.14.0 (#1832)
This release includes new `ref+tfstates3://` and `ref+tfstategs://` backends for reading terraform states stored in s3 and google cloud storage, and features a new aws-sdk-go that supports AWS SSO, and the fix to allow referencing a local tfstate file by the absolute path.

See https://github.com/variantdev/vals/releases/tag/v0.14.0 for all the changes.
2021-05-08 17:33:37 +09:00
Yusuke Kuoka 44fb68b7e0 Use the incubator chart repo instead of chartcenter (#1833)
As ChartCenter has been shut down.

Ref https://github.com/roboll/helmfile/pull/1829#issuecomment-833330609
2021-05-08 17:33:24 +09:00
Quan TRAN ded0f1049a Fix filepath handling on Windows (#1754) 2021-05-02 09:22:25 +09:00
Yusuke Kuoka 08db073958 Fix broken selector and DAG calculation logic after --{include,skip}-needs addition with correct Release IDs (#1823)
#1772 broke `--selector` with `needs` in many ways.

The two biggest problems I've encountered were:

- duplicate releases even if you've provided a proper `selector` to deduplicate
- sync/deletion ordering broken when you have `needs`

For the first issue, we had to update `getSelectedReleases` function to also calculate the "selected releases and releases needed by the selected releases", and use that to calculate the DAG. That should have been done in #1772.

The latter started happening after I've fixed the first issue. The source of the issue was that `needs` turned out to be ambiguous in a few cases.

Previously, `needs: ["foo/bar"]` had two meanings. One for "needs release bar in kubecontext foo", another for "needs release bar in namespace foo".

Moreover, `needs: ["foo/bar/baz"]` had three meanings.

- `needs release baz in tiller namespace foo and namespace baz`
- `needs release baz in namespace bar in kubecontext foo`
- `needs release baz in tiller namespace bar in kubecontext foo`.

Especially, the first meaning doesn't make sense at all. Helm 2 solely use tillerNamespace for namespacing the release and Helm 3 uses namespace for that.

This fix sorts all the bugs and issues I've found so far around that, by changing the meanings of the above two examples as follows:

- `foo/bar` means `namespace=foo,name=bar` for Helm 3 and `tillerNamespace=foo,name=bar` for Helm 2
  - `needs release bar in kubecontext foo` is now `foo//bar`. Notice the extra `/` between `foo` and `bar`.
- `foo/bar/baz` means `kubecontext=foo,namespace=bar,name=baz` for Helm 3 and `kubecontext=foo,tillerNamespace=bar,name=baz` in Helm 2

Fixes #1818
2021-05-01 21:59:25 +09:00
Yusuke Kuoka de8644a504 Fix --selector results to correctly deduplicate releases (#1822)
Fixes #1818
2021-05-01 15:06:07 +09:00
katsew f28ad5af23 Fix defaulting and overriding kubeContext (#1814)
Ref #1810

* fix defaulting and overriding kubeContext

* make defaulting kubeContext side-effect free

* checkDuplicates should check releases with overriden values
2021-05-01 12:42:29 +09:00
dudicoco 77ee239db2 Lock helm plugin versions in Dockerfile (#1821) 2021-05-01 12:26:54 +09:00
d9e15754b7 Add documentation about re-using the environment state from parent in sub-helmfile (#1808)
Ref #762

Co-authored-by: Vladimir Avdoshka <vavdoshka@kyriba.com>
Co-authored-by: Quan TRAN <itscaro@users.noreply.github.com>
2021-05-01 12:26:00 +09:00
Yusuke Kuoka dabd7ad99f Fix repo sync to work on repos duplicated between helm v2 and v3 (#1816)
Fixes #1815
2021-04-30 09:27:23 +09:00
Yusuke Kuoka 204f78c8ff Fix --set and --set-file flags are not passed to chartify (#1803)
Fixes #1681
Ref https://github.com/variantdev/chartify/commit/286ed08a273d4229989aea5ac5c901612b43944c
2021-04-24 22:27:53 +09:00
Yusuke Kuoka 59b91a45a0 Fix adhoc dependencies not working with remote chart (#1802)
Fixes #1680

Ref https://github.com/variantdev/chartify/commit/8ff30374cb2a65af5167f3d47df81fe45d37b01d
2021-04-24 21:11:07 +09:00
Yusuke Kuoka 5a3bd7d649 Fix destory, delete, and test to work with chartify on local chart with dependencies that are not yet downloaded (#1801)
Fixes #1800
2021-04-24 20:50:16 +09:00
Yusuke Kuoka ce6a621414 Bump chartify to 0.8.3 to fix it not to break when two or more releases sharing the same chart and the namespace, but kubeContext (#1799)
Fixes #1695
2021-04-24 19:03:13 +09:00
Yusuke Kuoka 20f6c68108 Fix code format 2021-04-24 07:47:27 +00:00
astorathandAndrey Tuzhilin 3367822e89 feat: Move chartify logs to Debug (#1794)
Co-authored-by: Andrey Tuzhilin <andrey@zelf.co>
2021-04-24 16:06:21 +09:00
katsew 8702639510 fix: spec.KubeContext does not fallback to HelmDefaults.KubeContext (#1789)
* fix: spec.KubeContext does not fallback to HelmDefaults.KubeContext

Fixes #1782

* Add testcases to test without default kubecontext
2021-04-24 16:02:58 +09:00
katsew 41cbc25c35 fix: can't evaluate field KubeContext in type state.releaseTemplateDataRelease (#1797)
Fixes #1796
2021-04-24 15:28:20 +09:00
astorathandAndrey Tuzhilin 83189dbad3 Enable helmfile-diff to pass the output format to helm-diff (#1784)
* tests: fix vagrant test run

* feat: added an option to specify the different diff output format

* renamed diff-output to output

* renamed diff-output to output

Co-authored-by: Andrey Tuzhilin <andrey@zelf.co>
2021-04-24 08:07:24 +09:00
Yusuke Kuoka 28ade19419 Bump chartify to 0.8.2 (#1793)
* Bump chartify to 0.8.2

This version fixes charitfy not to fail when you used the combination of (1)helm 3 and (2)strategicMergePatches/jsonPatches/transformers etc that triggers chartify on (3)a chart that contains CRDs.

See https://github.com/roboll/helmfile/issues/1778#issuecomment-824451990 for details of the issue.

The chartify-side of this fix is https://github.com/variantdev/chartify/commit/55b23f9e9d43ae1105a536a659fa35f004806b2a

Fixes #1778
2021-04-23 09:53:52 +09:00
Yujun Zhang 378ae4ad72 Fix typo (#1788) 2021-04-23 09:27:37 +09:00
Yusuke Kuoka 30e0356ad6 Bump chartify to 0.8.1 (#1787)
This version fixes that chartify not to fail when the target chart misses `templates` directory.
2021-04-23 09:16:59 +09:00
Yusuke Kuoka eabda4cf28 Fix delete on release of uninstalling status (#1786)
* Fix helmfile destroy/delete not deleting `uninstalling` release

Ref https://github.com/roboll/helmfile/issues/1750#issuecomment-823677950

* Cover helm3 in helmfile-destroy test
2021-04-21 09:39:14 +09:00
Yusuke Kuoka 5617b593c8 Add test for helmfile-destroy with selector (#1785)
* Add test for helmfile-destroy with selector

I was curious if destroy with a selector is working at all while reading https://github.com/roboll/helmfile/issues/1750#issuecomment-823521572. So I added this test for verification. From the test result, it is working, though.

* Add one more test case for destroying disabled but installed release
2021-04-21 09:07:08 +09:00
Yusuke Kuoka 5d43b30a7c Add --{include,skip}-needs to various helmfile commands (#1772)
* Add --{include,skip}-needs to helmfile-sync and helmfile-apply

* Add --include-needs to helmfile-template

* Add TODO related to #1018

* Add a few new test files to cover new functionalities

* Update apply test to incorporate the change that the destroy and sync steps target affected releases only
2021-04-20 23:06:51 +09:00
K1Hyve d6db4b53e7 Added The Hyve to USERS.md (#1779) 2021-04-20 13:29:44 +09:00
Yusuke Kuoka 368dd13e16 Fix destroy not reversing the order of releases (#1777)
Fixes #1775
2021-04-20 13:27:45 +09:00
Yusuke Kuoka ae942c5288 Fix --skip-crds not working with chartify (#1774)
Follow-up for #1771
Ref #1770
Ref https://github.com/roboll/helmfile/pull/1771#issuecomment-817399338
2021-04-13 09:09:58 +09:00
Yusuke Kuoka a111e89b27 Add --skip-crds to helmfile sync and helmfile apply (#1771)
Resolves #1770
2021-04-11 10:38:23 +09:00
Yusuke Kuoka 589b26aaad Fix some hook log not honoring log level (#1769)
Fixes #1742
2021-04-10 16:50:42 +09:00
Yusuke Kuoka 1d7608f42c Fix helmfile repos to not fail with forceNamespace
Fixes #1752
2021-04-10 16:26:40 +09:00
Yusuke Kuoka efad26641d Add documentation about adhoc chart dependencies 2021-04-10 16:09:27 +09:00
Yusuke Kuoka 81b04fcb8b Add support for adhoc dependency to local chart
Helmfile has been providing a feature called "adhoc chart dependency" that basially enabled you to add Chart.yaml `dependencies` entry adhocly without forking or modifying the chart.

It was missing the support for using a local chart as the adhoc dependency. This patch adds that.

Usage:

`releases[].dependencies[].chart` is enhanced to accept the fs path to the local chart:

```
releases:
- name: foo
  chart: ./path/to/foo
  dependencies:
  - chart: ./path/to/bar
```

Resolves #1762
2021-04-10 16:09:27 +09:00
Yusuke Kuoka 74cd2bc147 Enable helmfile-deps to limit helm-dep-up by selector (#1764)
Ref https://github.com/roboll/helmfile/issues/809#issuecomment-814423653

This is not what had been requested originally in #809 but anyway- This enables you to limit helm-dep-up run by helmfile-deps by selector. For example, `helmfile -l name=foo deps` should result in only the release named `foo` to be helm-dep-uped.
2021-04-09 09:49:57 +09:00
Yusuke Kuoka 2ff06a8abd Fix chartify to take --include-crds into account (#1761)
Fixes #1760
2021-04-08 10:06:34 +09:00
Yusuke Kuoka d703e17239 Fix chartify not to fail on a chart with dependencies (#1759)
Manually verified to work by using the following example from @damoon (https://github.com/roboll/helmfile/issues/1655#issuecomment-801122431):

```
repositories:
  - name: prometheus-community
    url: https://prometheus-community.github.io/helm-charts
releases:
- name: metrics
  namespace: monitoring
  chart: prometheus-community/kube-prometheus-stack
  version: 13.13.0
  jsonPatches:
    - target:
        version: v1
        kind: Service
        name: metrics-kube-prometheus-st-kube-etcd
        namespace: kube-system
      patch:
        - op: replace
          path: /spec/ports/0/port
          value: "2381"
        - op: replace
          path: /spec/ports/0/targetPort
          value: "2381"
```

Before this fix:
```
$ helmfile template
(snip)
COMBINED OUTPUT:
  Error: found in Chart.yaml, but missing in charts/ directory: kube-state-metrics, prometheus-node-exporter, grafana
```

After this fix:

```
$ helmfile template | grep 2381
(snip)
Removing /tmp/chartify718204429/monitoring-metrics-f5479c8b8/kube-prometheus-stack/strategicmergepatches
Removing /tmp/chartify718204429/monitoring-metrics-f5479c8b8/kube-prometheus-stack/kustomization.yaml
Templating release=metrics, chart=/tmp/chartify718204429/monitoring-metrics-f5479c8b8/kube-prometheus-stack
    port: "2381"
    targetPort: "2381"
```

Fixes #1655

Ref https://github.com/variantdev/chartify/commit/07c3054d66021fa190464a998ade18607312c715
2021-04-08 07:03:18 +09:00
Yusuke Kuoka 3bfcc1ea42 Add support for kustomize v4 (#1758)
We use kustomize in two places. One for turning kustomize into a chart, and another for patching manifests and the chart.

This fixes the former to work with kustomize v4.

Fixes #1688
2021-04-08 06:15:16 +09:00
Quan TRANandYusuke Kuoka c65bdff62c Respect release filter in lint and status (#1672)
Ref #1190
Fixes #1651

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2021-04-06 15:47:29 +09:00
Yusuke Kuoka f614e8b1bf feat: Helmfile renders *.yaml.gotmpl in a K8s manifests/kustomization directory (#1745)
Related to #494

This feature is mostly a built-in alternative to the `incubator/raw` chart without external dependency and has
access to helmfile's own template functions and template data.

The expected use-case of this feature is to add arbitrary K8s resources to your deployment.

Unlike the original issue raised in #494 this doesn't enable you to add arbitary resources to a release. That's another story. But this would be a good foundation for that, too.
2021-04-06 14:22:34 +09:00
Philipp HossnerandYusuke Kuoka 85accf7330 Add helm-secrets-encrypted values template file (#1701)
Secret files ending with .gotmpl are now also rendered as a gotemplate.

```
releases:
- name: myapp
  secrets:
  - secrets.yaml.gotmpl
```

Note that currently, .gotmpl files must be valid YAML files as well.

The expected use-case of this feature is to compose a YAML array from values and encrypted secrets.

Without this feature, you would have tried to do something like the below, which didn't work.

**Example (doesn't work!)**

`values.yaml.gotmpl`:

```
environment:
  -   name: MY_EXTERNAL_IP
      value: |
          {{ exec "./get-external-ip.sh" (list "") }}
```

`secrets.yaml`:
```
_sops:
  #...
environment:
  - name: MY_SECRET_VALUE
    value: (encrypted by sops)
```

`helmfile.yaml`:

```
releases:
- name: foo
  values:
  - values.yaml
  secrets:
  - secrets.yaml
```

This doesn't work because `values.yaml` and the decrypted `secrets.yaml` are passed to `helm` to be merged, and helm overrides the array instead of merging or concatenating the arrays.

**Example (works!)**

Instead of `values.yaml` and `secrets.yaml`, you provide a single `secrets.yaml.gotmpl` that is a valid YAML and encrypted by sops:

```
_sops:
  #...
environment:
  -   name: MY_EXTERNAL_IP
      value: |
          {{ exec "./get-external-ip.sh" (list "") }}
  - name: MY_SECRET_VALUE
    value: (encrypted by sops)
```

`helmfile.yaml`:

```
releases:
- name: foo
  secrets:
  - secrets.yaml.gotmpl
```

Helmfile decrypts the gotmpl by handing it over to helm-secrets and then renders the result as a gotmpl file. The end result is that you have a two-element array `environments` that can be just passed to helm.

Resolves #1700

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2021-04-06 14:20:42 +09:00
Yujun Zhang a161796dc4 feat: Allow overriding chart via flag (#1751)
Adds `--chart` flag for overriding the selected release's chart ad-hoc-ly like `helmfile --chart $CHART template`.
This is handy when e.g. you want to have an ArgoCD application per each release in your helmfile.yaml, while also providing the ability to customize the release's chart without touching helmfile.yaml.

See https://github.com/roboll/helmfile/issues/1690#issuecomment-812321354 for more context.

Closes #1690
2021-04-06 13:20:41 +09:00
Javier Palacios 261367e7e9 Add kubectl hooks for applying file(s) or kustomize (#1736)
This enables you to write a `kubectl-apply` hook more declaratively than writing `command` and `args`:

```
releases:
- name: myapp
  chart: mychart
  hooks:
  - events: ["presync"]
    kubectlApply:
      filename: path/to/manifests
      #kustomize: path/to/kustomize
```
2021-04-06 13:16:35 +09:00
Quan TRAN 5cd0afcfa0 Add documentation about helmfile-fetch and StateValues alias (#1746)
Ref #1743, #1744, #1734
2021-04-01 09:48:58 +09:00
Quan TRAN 1748cbfcea Add .StateValues as alias of .Values in releaseTemplateDataRelease (#1744)
Ref #1743
2021-04-01 09:47:12 +09:00
Nenad Strainovic 200cae2a68 feat: --show-secrets on diff and apply commands (#1749)
Resolves #1674
2021-04-01 09:41:53 +09:00
astorathandAndrey Tuzhilin b1b7831a90 feat: make --kube-context override helmDefaults (#1673)
This would allow cli flag `--kube-context` to override value in helmDefaults allowing to use different values in local development and CI context.

Co-authored-by: Andrey Tuzhilin <andrey@3adigital.ru>
2021-03-30 16:53:19 +09:00
Quan TRAN 53c6d2f988 Add helmfile-fetch command to downloading and generating charts (#1734) 2021-03-30 16:26:31 +09:00
Yusuke Kuoka faa74962e6 Fix helmfile-template not writing to stdout (#1737)
This fixes #1691 by redirecting helm-template output to our logger when and only when --output-dir is being passed to helm-template.

See https://github.com/roboll/helmfile/pull/1691#issuecomment-805636021 for more context.
2021-03-25 10:16:52 +09:00
Gregoire MenuelandGregoire Menuel 28cf300ef2 Add support for kubeContext in environments (#1675)
Resolves #898
Resolves #1689

Co-authored-by: Gregoire Menuel <gregoire.menuel@veolia.com>
2021-03-23 18:06:53 +09:00
Chris Mellard e9d1c8534c feat: change to helmfile template so it respects logging levels (#1691) 2021-03-23 18:02:13 +09:00
astorath aafe74a3e1 Fix/secrets ordering (#1726)
Fixes issue introduced in #790: the order of secrets merged is not defined now, leading to unpredictable results in `helmfile apply`.
2021-03-23 18:00:57 +09:00
Andrey Tuzhilin db9d31ac06 test: fix DecryptSecret output 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 4a9d753441 feat: make integration/vagrant 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 4efaa656f9 test: return all tests 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 59f4043fc5 fix: fixed secrets decryption failed issue 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin d04cd1b1a7 test: fix "Ensure helmfile fails when no helm-secrets is installed" test 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 781c4e9ebe test: fix "Ensure helmfile fails when no helm-secrets is installed" test 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 0c9934c357 test: ensure bash -eo pipefail (as in circleci) 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 2983f5cd28 test: fix vault provisioning code 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 7610d8d3c6 test: add secrets integration tests 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 5cd853b773 test: add vault and sops for integration secret testing 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin f1c07879ad ci: simplify integration tests ci code for helm2 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin d1a2435ce1 ci: simplify integration tests ci code 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 45b8eb6942 test: fix helm2 integration tests 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 17a969ce83 ci: verify new integration tests 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 4f02196dad test: reusable integration test 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 85f19b6abd fix: gitignore *.lock 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 42138d88bf test: vagrant for integration tests 2021-03-23 17:19:40 +09:00
Andrey Tuzhilin 2ef09d45ee test: sync HELM_VERSION and KUSTOMIZE_VERSION for tests 2021-03-23 16:58:56 +09:00
Andrey Tuzhilin 9b2a770dbe feat(Dockerfile): pin helm-secrets version 2021-03-23 16:58:56 +09:00
Andrey Tuzhilin 6085730a91 fix(Makefile): static-linux mod 2021-03-23 16:58:56 +09:00
Andrey Tuzhilin 94a8658635 feat(Dockerfile): bump helm version 2021-03-23 16:58:56 +09:00
Jason Witkowski 2618cfb38b Enable --wait-for-jobs flag introduced in helm 3.5 (#1715)
Fixes #1650
Fixes #785

This change introduces:

- `--wait-for-jobs` CLI override option to helmfile binary
- `waitForJobs` helmDefaults parameter (default `false`)
- `waitForJobs` release parameter (default `false`)

Note that `--wait-for-jobs` was introduced in Helm 3.5 (https://github.com/helm/helm/pull/8363)
2021-03-23 16:53:57 +09:00
Rein van 't Veer fcf9a7273f Improve error message on deps resolution error (#1727)
Fixes #1356
2021-03-23 16:44:59 +09:00
Quan TRAN 5ce755e4d8 Add chart & version to list cmd output (#1731) 2021-03-23 16:29:48 +09:00
Quan TRAN b7d6639b25 (fix) remove usage of charts.yaml in error message (#1732) 2021-03-23 16:27:51 +09:00
Nick Perry 95759958b5 Add William Hill to USERS.md (#1735) 2021-03-23 16:03:48 +09:00
kupnu4xandYusuke Kuoka 8ed8a9eab3 allow to access oci repos without auth (#1711)
* allow to access oci repos without auth

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2021-03-09 10:23:36 +09:00
14a83e7cbe Update reference for helm-secrets to latest maintained fork (#1676)
* Update referance for helm-secrets to latest maintained fork

* Missed a referance in the docs to an older edition of helm secrets

* Removed docker2 changes back to original method

Co-authored-by: Nathan Flynn <nflynn@williamhill.co.uk>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2021-03-09 10:17:16 +09:00
Thomas Loubiou bf9f36b2bb refactor: simplify pull channel from #1706 (#1707) 2021-03-09 10:16:04 +09:00
Quan TRAN 3215eaf710 panic with clear message (#1709) 2021-03-09 10:13:24 +09:00
Justin Chizer 927bd30fa0 Update README.md to show current CLI Output (#1712) 2021-03-09 10:12:41 +09:00
Yusuke Kuoka 247ae9108c Disable darwin/386 build to avoid release failure 2021-03-04 10:27:39 +09:00
Nathan Flynn 97f0e59cfd Update README.md (#1677)
Added docs to Readme for disableValidationOnInstall
2021-03-04 09:33:22 +09:00
Quan TRAN 56405e7445 panic with a clear message (#1693) 2021-03-04 09:32:50 +09:00
Mark Ayers 42c97cd919 Update README.md (#1696)
- replace deprecated helm-secrets with the currently active helm-secrets
```plain
Deprecation Info
  Please note, this project is no longer being maintained.
  Link to active helm-secret plugin could be found in helm documentation: https://helm.sh/docs/community/related/#helm-plugins
```
2021-03-04 09:31:40 +09:00
Thomas Loubiou 65317e96f6 Fix incorrect chart bug in multi-cluster setup (#1698)
When the same release name is used accross namespaces/kubecontexts
a bad chart name could be used

Fixes #1694
2021-03-04 09:29:44 +09:00
Thomas Loubiou 453b498ccb fix: pull OCI charts one by one (#1706)
* fix: pull OCI charts one by one

* fix: gofmt
2021-03-04 09:24:22 +09:00
RaymondKYLiu 19cbea49f7 Update USERS.md (#1702)
Add Trend Micro to user list
2021-03-02 14:28:54 +09:00
Jason Witkowski bd3838c059 Add ability to specify and override helmDefaults.wait via cli (#1678) 2021-02-24 12:47:27 +09:00
Yusuke Kuoka f24b61f100 Fix error on concurrent go-getter on same URL (#1669)
Fixes #1660
2021-02-05 09:02:21 +09:00
Yusuke Kuoka 257c1f62d2 Fix OCI support (#1667)
* Fix OCI support

I have seen various issues related to the OCI repository support recently added to Helmfile.
This is the patch that should fix all the issues Im aware of until now.
2021-02-04 09:33:35 +09:00
Yusuke Kuoka 4e1ecb5890 Bump variantdev/vals to 0.13.0 (#1666)
Ref https://github.com/variantdev/vals/pull/42
2021-02-03 09:00:46 +09:00
Wi1dcard ad5fba56e0 Bump Helm to v3.5.0. (#1656) 2021-01-29 09:06:29 +09:00
Caleb Collins-Parks 0ad62b504a docs: update helm command name (#1635)
helm delete is now helm uninstall. See https://helm.sh/docs/helm/helm_delete/
2021-01-29 09:05:55 +09:00
Cameron Braid 8487970a2e fix: dont sent RegistryLogin password via args (#1662) 2021-01-29 09:05:03 +09:00
Chris Mellard 8212b630ff fix: fixed up OCI repos so they support paths and URLs that differ from chart names contained there (#1661) 2021-01-28 19:11:12 +09:00
Chris Mellard 2a71640095 feat: added in oci repository flag and added helm methods to pull and export charts (#1629) 2021-01-28 09:02:00 +09:00
Shunsuke Suzuki 33880dab77 docs: fix typo (#1645)
* docs: fix typo

* docs: syntax highlight
2021-01-12 10:23:21 +09:00
Sven Schliesing 87fcd83275 Fix typo "verion" (#1641) 2021-01-12 10:22:35 +09:00
jjangga0214 600721ca09 docs(readme): fix typo (#1633) 2021-01-12 10:22:04 +09:00
Yusuke Kuoka f7a1d09be7 Bump variantdev/vals to 0.12.0 (#1644)
For Azure KeyVault support for the fix for AWS SSM provider.
2021-01-12 10:20:57 +09:00
Yusuke Kuoka e5d982ed33 Fix "No valid platforms to build for" build error on release
Follow-up for #1612
May be related to https://github.com/mitchellh/gox/issues/92
2021-01-01 21:23:04 +09:00
Yusuke Kuoka c815d0192a Bump helm versions in Dockerfile to deal with stable and incubator repositories change 2021-01-01 12:16:41 +09:00
Yusuke Kuoka 9569d73e2f Bump helm versions in CI to deal with stable and incubator repositories change 2021-01-01 10:44:46 +09:00
Damiano AlbaniandDamiano Albani dd5bc46ead Include kustomize binary in helm3-based Docker image (#1626)
Co-authored-by: Damiano Albani <damiano.albani@geodan.nl>
2020-12-28 09:28:59 +09:00
Gastón Acosta Ramas fc3567ddda Adding documentation for PR #6819 (#1623)
Adding documentation for this feature: https://github.com/helm/helm/pull/6819
not being aware of this, make turn helm2 to 3 migrations very complicated.
2020-12-28 09:24:38 +09:00
Yusuke Kuoka 9b64d65d94 feat: Stabilize helmfile-diff output (#1622)
This finishes the work started at #1619 by introducing the following changes:

- You can now set `HELMFILE_TEMPDIR` and `CHARTIFY_TEMPDIR` as the directory to persist temporary values files rendered by helmfile and temporary charts generated by chartify. Note that chartify is used internally when you use kustomize integration or raw K8s manifests as a chart.
- Helmfile uses the hash sum of the release config and the values file content in the file name of the temporary values file.

  In combination with `HELMFILE_TEMPDIR` and `CHARTIFY_TEMPDIR`, this enables helmfile to use the stable file names for temporary values files, which contribute to stabilize log messages like `Comparing release=appset, chart=PATH/TO/TEMPORARY/CHART`, where the `PATH/TO/TEMPORARY/CHART` had been randomized due to formerly random helmfile tempdir and temporary values file names, and random chartify tempdir.

You can try this feature with a script like:

```
tempdir=$(mktemp -d -t helmfile)

HELMFILE_TEMPDIR=${tempdir} CHARTIFY_TEMPDIR=${tempdir} helmfile diff

rm -rf ${tempdir}
```
2020-12-15 10:24:27 +09:00
54eb73b423 Use ghodss/yaml for yaml marshaling & unmarshaling in template (#1556)
Fixes #1555

Co-authored-by: Yoann Ciabaud <yoann@linxo.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2020-12-13 11:03:20 +09:00
jayme-github 4c0987a618 Don't append --tiller-namespace flag when running helm3 (#1594) 2020-12-13 10:21:12 +09:00
Chris Mellard 0637973e40 fix: allow helmfiles to be corrected marshalled to YAML so they can be manipulated by other programs (#1604) 2020-12-13 10:08:03 +09:00
Felipe Santos 3690bde94c Add documentation on how to use the docker image (#1607)
* Add documentation on how to use the docker image

* Remove default workdir and add it to snippet
2020-12-13 10:00:36 +09:00
Life ChristianandLife Lofranco b92ff2baff Fix selector syntax example (#1614)
Co-authored-by: Life Lofranco <life@dealgrocer.com>
2020-12-13 09:58:24 +09:00
Chris Mellard afe82f6453 chore: suppress empty values on serializing several helmfile values (#1616) 2020-12-13 09:57:35 +09:00
Yusuke Kuoka 1c7b872476 Stabilize helmfile-diff output (#1619)
`helmfile-diff` sorts multiple and concurrent helm-diff outputs and stabilizes writes to stdout.

It's required to use the stdout from helmfile-diff to detect if there was another change(s) between 2 points in time.

For example, terraform-provider-helmfile runs a helmfile-diff on `terraform plan` and another on `terraform apply`. `terraform`, by design, fails when helmfile-diff outputs were not equivalent. Stabilized helmfile-diff output rescues that.
2020-12-11 09:51:26 +09:00
James Strachan 28e7ebb4a4 fix: support arm64 images (#1612) 2020-12-11 09:44:07 +09:00
Yusuke Kuoka 1ef9b29f6d Improve handling of releases being newly installed by helmfile-apply (#1618)
This improves helmfile-apply with two things:

- Some users had timing-out issues or annoyed by huge output from helm-diff run as part of helmfile-apply on first install. `--skip-diff-on-install` skips running helm-diff for releases being newly installed, so that you can avoid those issues.
- Some users had difficultly or found it not straight-forward to install CRDs and custom resources from separate charts in one helmfile-apply (#1353). The new helmfile.yaml release field `disableValidationOnInstall: true` adds `--disable-validation` to helm-diff only for releases being newly released, which should mostly resolve the issue.

Resolves #1353
2020-12-11 09:09:35 +09:00
Yusuke Kuoka b910591e1d Add support for Kustomize Transformers (#1592)
Please see the updated `advanced-features.md` for more details.

This is often used for adding common labels and annotations to any resources rendered from a Helm chart.
2020-11-19 09:33:05 +09:00
Krzysztof Pawlik d807510dd7 Enable shell completion (#1559)
* feat: enable EnableBashCompletion to get --generate-bash-completion command line flag

* feat: add scripts for bash and zsh

* feat: document shell completion
2020-11-19 09:32:33 +09:00
Wi1dcard 4e485219d7 Fix the logic of helmfile deps and add tests. (#1588) 2020-11-19 09:29:59 +09:00
Wi1dcard b0e042988c Fix incorrect help text of some CLI options. (#1587) 2020-11-19 07:20:08 +09:00
manfred-h f877de7778 Fix openSUSE repo URL. (#1584) 2020-11-19 07:19:00 +09:00
Baryczka 655d5934a2 Mention about helmBinary in readme (#1590) 2020-11-19 07:17:55 +09:00
Yusuke Kuoka f6bf885fb7 Fix helmfile template --include-crds not to break with chartify (#1583)
* Fix `helmfile template --include-crds` not to break with `chartify`

This bumps variantdev/chartify to 0.4.9 so that we can incorporate https://github.com/variantdev/chartify/commit/fed8bb29533904b1af3044a266220652231afe87

* Fix integration test
2020-11-12 09:26:43 +09:00
James Strachan 2857382006 fix: support arm binaries (#1580)
fixes #1433
2020-11-12 08:58:54 +09:00
manfred-h 972667f115 Mention openSUSE packages for helmfile (#1581)
* Mention openSUSE.

* Add example how to add a repo.
2020-11-12 08:57:26 +09:00
Brian Choy 3c88145329 Update readme stable/incubator URLs (#1582)
Small update to the readme repository examples since Google is no longer officially supporting hosting the stable/incubator helm charts. The official helm docs are using these repos now, eg. https://helm.sh/docs/intro/quickstart/.
2020-11-12 08:56:34 +09:00
Yusuke Kuoka 709913b5ea Bump dependencies (#1573)
Bumps dependencies mainly to fix possible go mod error that is fixed via https://github.com/variantdev/vals/commit/0edd5343228b96e1ca5f3599f923fee0ff1fd0cb, but also bumps all the other dependencies because they looked very outdated :)
2020-11-09 08:50:00 +09:00
Yusuke Kuoka 88884b68dc feat: helmfile template --skip-cleanup (#1570)
* feat: `helmfile template --skip-cleanup`

Resolves #1517
2020-11-06 09:23:49 +09:00
Yusuke Kuoka 5a15b65b94 feat: Add helmfile apply --skip-cleanup (#1571)
This deprecates the old `--retain-values` which was not working as intended.

Also see #1570 - there's now `--skip-cleanup` for `helmfile-template`, too.
2020-11-05 10:18:30 +09:00
Yusuke Kuoka 3899680672 feat: Add helmfile test --logs (#1569)
When `--logs` is provided, Helmfile runs `helm test --logs` so that it can stream test logs

Ref #1541
2020-11-05 10:17:18 +09:00
Yusuke Kuoka 6b86408500 feat: Add helmfile template --include-crds (#1568)
This allows you to use helmfile-template output as a GitOps source, when the template output contains CRDs and you use Helm 3.

Helm 3 by default removes CRDs from the template output. If you want to git-commit helmfile-template containing CRDs for GitOps and you use Helm 3 for templating, the only way is provide this newly added `--include-crds` flag.
2020-11-05 10:13:25 +09:00
Yusuke Kuoka bdbaa00628 Fix redundant helm-dep-build and prepare hook regression (#1566)
Fixes #1511
Fixes #1497
2020-11-05 09:43:42 +09:00
Yusuke Kuoka 87e86dcfd2 Fix helmfile --selector x=y template with needs (#1564)
I had mistakenly inverted the necessary flag to turn off the legacy processing on selectors that should be used only for helmfile commands that does not support DAGs/needs.

Fixes #1552
2020-11-04 09:29:23 +09:00
Christian Rebischke 995b201e47 mention Arch Linux support (#1549) 2020-10-26 08:59:05 +09:00
Yusuke Kuoka 0663831dd5 Disable dependency update while running helm-x/chartify in more cases (#1548)
`helm dep up` is now skipped while running helm-x/chartify when the chart/directory is obtained by running go-getter, or `skipDeps` is configured using a command-line flag, helmDefaults, or release configuration.

Resolves #1547
2020-10-25 11:25:59 +09:00
isindir afb2653452 fix: printing error to stdout together with templated resources (#1550)
Fixes #1551
2020-10-25 09:14:07 +09:00
isindir 9ec4a85821 Minor README improvement (#1543)
Fixes #1544
2020-10-19 08:48:39 +09:00
Wi1dcard 4d868794fd Improve capitalization and formats of README.md. (#1545) 2020-10-19 08:47:19 +09:00
Jake Hill 1aca099457 feat: Upgrade to kubectl version supported by latest stable release and upgrade helm3 to 3.3.4 (#1498)
Changes:

* Bump helm to v3.3.4.
* Bump kubectl to v1.18.9
* Update Dockerfile to be a little more verbose to help understand which command in a chain failed.

Signed-off-by: Jake Hill <jake@naphta.uk>
2020-10-19 08:45:44 +09:00
Wi1dcard f5d098876a Retain the option helm repo add --force-update when Helm is v3.3.4 or above. (#1546)
See: https://github.com/roboll/helmfile/pull/1542#issuecomment-710082201
2020-10-19 08:44:09 +09:00
Yusuke Kuoka 080080f57f Bump chartify to 0.4.4 (#1540)
To incorporate the fix for unconventional chart templates like seen in the Datadog chart https://github.com/variantdev/chartify/commit/5443ca1a1db36d2626522f39130ac1157a69c3f7
2020-10-15 10:17:37 +09:00
Wi1dcard cd4afc3269 Remove duplicated logs from helm.exec. (#1538)
While using the `--debug` option, the output of helm seems to be printed triple times:

```
Templating release=test, chart=charts/test
exec: helm template test charts/test --namespace staging --values /tmp/values266548685 --output-dir outputs//helmfile-test-staging-ed5e3c94-test --debug
helm:MRAjW> install.go:172: [debug] Original chart version: ""
helm:MRAjW> install.go:189: [debug] CHART PATH: /app/charts/test
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/secret.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/configmap.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/health-configmap.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/headless-svc.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-svc.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-svc.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-statefulset.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/ingress.yaml
helm:MRAjW> wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-prometheus.yaml
helm:MRAjW>
exec: helm template test charts/test --namespace staging --values /tmp/values266548685 --output-dir outputs//helmfile-test-staging-ed5e3c94-test --debug: wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/secret.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/configmap.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/health-configmap.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/headless-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-statefulset.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/ingress.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-prometheus.yaml


wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/secret.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/configmap.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/health-configmap.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/headless-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-svc.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/redis-master-statefulset.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/templates/ingress.yaml
wrote outputs//helmfile-test-staging-ed5e3c94-test/test/charts/redis/templates/metrics-prometheus.yaml
```

- The first with the prefixes `helm:MRAjW>` comes from <https://github.com/roboll/helmfile/blob/563fce4adf7abf759ec31b3971d1195704621052/pkg/helmexec/runner.go#L59-L65>

- The second one with the format `exec: helm ... --debug: ...` comes from <https://github.com/roboll/helmfile/blob/563fce4adf7abf759ec31b3971d1195704621052/pkg/helmexec/exec.go#L369>

- And the last are the logs of non-debug mode.

It sometimes makes the log a bit confusing, while I first time read the log, I thought helmfile executed helm command multiple times 😅.

Since we already piped helm outputs to stdout (the first), we remove the second logs.
2020-10-15 08:50:56 +09:00
Javier Palacios 8f8669778c Support for azure acr helm repositories (#1526)
Adds a basic support for Helm repositories hosted on Azure Container Registry (not OCI but classic ones). Add a new field to RepositorySpec to state that is externally managed and runs the `az-cli` command instead of the helm one to manage the repository.
2020-10-15 08:45:45 +09:00
Yusuke Kuoka 563fce4adf Bump vals (#1537)
To incorporate unexpected SSM secret exposure issue when the parameter version is specified.
See https://github.com/variantdev/vals/pull/37
2020-10-14 09:56:17 +09:00
Karl Stoney b287101625 Update USERS.md (#1535)
Adding AT as a User :-) 
Thanks for your OSS efforts!
2020-10-14 08:38:30 +09:00
Yusuke Kuoka ab9fb2c9dc Fix concurrent-map-iteration-and-write errors while running release hooks (#1534)
Fixes #1495
2020-10-13 14:49:01 +09:00
Yusuke Kuoka c170b5a621 Minor tweaks for helmfile write-values (#1533)
See 1 and 3 in https://github.com/roboll/helmfile/issues/1460#issuecomment-691863465
2020-10-13 09:33:49 +09:00
Yusuke Kuoka d9286ed8f6 Fix intermittent failures while building deps on local chart (#1532)
Fixes #1521
2020-10-13 09:14:45 +09:00
Yusuke Kuoka 3018e82902 Fix multiple --set in --args messed up in helmfile template (#1529)
Fixes #1520
2020-10-13 08:38:06 +09:00
Yusuke Kuoka 34acf14d7c Bump chartify to v0.4.3 (#1528)
This fixes the bug that generated Chart.yaml misses the `apiVersion` field which resulted in `helm lint` always failing on the generated chart.

Fixes #1527
2020-10-12 09:23:58 +09:00
Wi1dcard 5d8eba9b29 Append --force-update for specific helm versions. (#1494)
* Parse and process helm version using github.com/Masterminds/semver/v3.

* Add --force-update only when Helm version >= 3.3.2, < 3.3.4.

See: https://github.com/helm/helm/pull/8777.

* Add test cases.
2020-10-12 09:20:55 +09:00
Roderik van der Veer b284b7be83 chore: add SettleMint to the USERS list (#1516) 2020-10-12 09:11:14 +09:00
Allie b293ac1f83 Fix typo (#1523) 2020-10-12 08:58:05 +09:00
Matthias Baur 8d9d635b8b Clarify namespace prefix in needs (#1500)
Before this, the documentation didn't mention that the release needs to
be prefixed with the namespace if the release had a namespace configured.
2020-10-05 08:51:39 +09:00
mdaisuke 954673d742 Fix: forceNamespace needs shouldRun is true (#1510) 2020-10-02 08:27:39 +09:00
Yusuke Kuoka 942b9a64c0 Add support for ChartCenter (#1492)
Resolves #1326
2020-09-21 15:31:24 +09:00
Yusuke Kuoka b176408eb2 Enable helmfile test testing only enabled and selected releases (#1486)
Resolves #1483
2020-09-21 09:44:05 +09:00
Yusuke Kuoka ff81b2f279 Enable release hook template to access .Values (#1485)
Fixes #1484
2020-09-21 09:43:30 +09:00
Andrii Dembitskyi 8db03f979c Drop duplicated entry in extra functions list from readme (#1490) 2020-09-21 09:42:47 +09:00
Wi1dcard 988c218096 Support the latest Helm (>=v3.3.2) and bump the Helm version in Docker image. (#1488)
Changes:

* Bump Helm to v2.16.12 and v3.3.3.
* Add --force-update only when using Helm 3.
2020-09-21 09:41:49 +09:00
Yusuke Kuoka 028bcc51dc Treat selector with multiple conditions an AND (#1478)
Fixes #1477
2020-09-15 09:56:05 +09:00
Yusuke Kuoka 5dd65e8d9a Bump vals (#1475)
Ref https://github.com/variantdev/vals/issues/34
2020-09-14 20:37:51 +09:00
Or Biran 134d5beba2 Add tailormed to users (#1467)
* Update USERS.md
2020-09-13 09:47:18 +09:00
Jason Witkowski 87d04f0202 Append KubeContext to temporary directory path (#1471)
Fix bug where KubeContext is not taken into account in temporary directories
2020-09-13 09:46:08 +09:00
vugardzhamalov 2d7c8e7525 Update README.md (#1472)
Made a small change to Global Hooks example in order to remove release name reference - this was probably copy/pasted from Hooks section
2020-09-13 09:41:21 +09:00
Yusuke Kuoka 0fad9f0544 Add experimental write-values command for writing values files only (#1469)
Ref #1460
2020-09-11 22:19:36 +09:00
Yusuke Kuoka 832dcf47a5 Re-add Release.Namespace in release values.yaml templates (#1466)
It was accidentally removed in #1424, and had been unexpectedly unavailable between v0.126.0 and v0.128.1.

Fixes #1464
2020-09-10 21:08:20 +09:00
Harshal Shah 1d2c8b8a3a Adding hellofresh as a helmfile user (#1465) 2020-09-10 09:41:53 +09:00
Yusuke Kuoka 0482ba3b6f Fix index out of range [1] with length 1 error on env2map (#1463)
This happened only when helmfile is run in an environment that any environment variable definition does not include `=` and the right side.
2020-09-08 11:23:36 +09:00
9d2c0d4285 Bump sprig to v3.1.0 and mergo 3.11 (#1456)
* Bump sprig to v3.1.0
test for mergeOverwrite

* Let mergo not (accidentally) try to merge unexported fields

This is also a good chance separate `HelmState` with the config loaded from YAML, which I had been wanting to do for a long time.

Co-authored-by: Johannes Alkjær <johannes.alkjaer@wunderman.com>
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2020-09-04 09:58:54 +09:00
Yusuke Kuoka efd26f288a Bump sprig to v3 (#1452)
Resolves #1294
Resolves #1447
2020-09-01 19:10:29 +09:00
Yusuke Kuoka 5f1698d0ed Fix wrong deletion order (#1451)
Fixes #1450
2020-09-01 17:36:11 +09:00
Yusuke Kuoka 2ecf5780f3 Revise GitOps doc a bit 2020-09-01 12:11:26 +09:00
Yusuke Kuoka 3e6542e341 Fix test flake for commonLabels (#1449)
Ref https://github.com/roboll/helmfile/pull/1415#issuecomment-684139831
2020-09-01 10:52:08 +09:00
Yusuke Kuoka d3daea3137 Fix panic on hook since v0.126.0 (#1448)
Fixes #1445
2020-09-01 10:37:21 +09:00
Yusuke Kuoka 19d79427a1 Add experimental "forceNamespace" in helmfile.yaml (#1444)
This is an experimental feature to support a potential use-case that you need to set namespaces in manifests rendered by `helmfile template`, WHEN the chart is unconventional hence does not have `namespace: {{ .Namespace }}`.
Rather than using this, you should usually fork/maintain or update/pull-request the chart to have `namespace: {{ .Namespace }}`.
Use this only when you CAN NOT do so, but still need to use `helmfile template`.
2020-09-01 10:13:27 +09:00
Yusuke Kuoka cd0ecc5263 Fix build error after helmfile build --embed-values addition
This is a follow-up for #1436
2020-08-29 15:01:22 +09:00
AdamClarkandYusuke Kuoka dc6c59dc14 Print command output in line (#1354)
This is an attempt to log helm exec output as the helm exec command is running. It only prints if the --debug flag is set.

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2020-08-29 14:47:22 +09:00
Yusuke Kuoka 0fc0869671 feat: helmfile build --embed-values to embed release values and secrets into the output (#1436) 2020-08-29 13:18:17 +09:00
Maksym Lushpenko 5ca7ce15bc feat: common labels for all releases in a helmfile (#1415)
This adds `comonLabels` option to helmfile by:

- Adding `CommonLabels` to HelmState
- Changing `markExcludedReleases` and `ListReleases` functions to merge common labels into release labels

Resolves #1266
2020-08-29 13:14:58 +09:00
Pawel PrzeszloandPawel Przeszlo 6b4b76e2bc HELMFILE_ENVIRONMENT variable (#1425)
Co-authored-by: Pawel Przeszlo <pawel.przeszlo@comarch.pl>
2020-08-29 13:10:07 +09:00
Joshua HansenandYusuke Kuoka 7b11ce851a feat: Allow .Release.Name to be used in gotmpl values templates (#1424)
This adds the ability to utilize `.Release` inside of gotmpl files as discussed [here](https://github.com/roboll/helmfile/issues/760).

Resolves: https://github.com/roboll/helmfile/issues/760

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2020-08-29 13:07:46 +09:00
Yusuke Kuoka c575587e1f Merge pull request #1442 from roboll/fix-duplicate-with-kubectx-per-release
Fix kubeContext not taken into account for release uniqueness
2020-08-29 11:45:13 +09:00
Yusuke Kuoka f2dfa7ce64 Fix kubeContext not taken into account for release uniqueness
Fixes #1440
2020-08-29 11:33:05 +09:00
Yusuke Kuoka 41cd1fe4a6 Fix race while running helm dep build on local chart (#1439)
* Fix race while running `helm dep build` on local chart

Fixes #1438
2020-08-29 10:24:48 +09:00
Yusuke Kuoka 9e54af5c2c fixup! fixup! Fix race while running helm dep build on local chart 2020-08-29 10:14:42 +09:00
Yusuke Kuoka 8a43e8f782 fixup! Fix race while running helm dep build on local chart 2020-08-29 10:04:09 +09:00
Yusuke Kuoka 94e01b79e0 Bump chartify to 0.4.2 (#1437)
To fix the issue that adhoc json patches were not working on kustomize/raw manifests.

Note that regular kustomize project was working. In other words, this only affetcts `chart: path/to/dir` combined with `jsonPatches: ...` when the `path/to/dir` points to a kustomize project or a local directory containing raw K8s manifests.

Ref https://github.com/roboll/helmfile/issues/1434#issuecomment-682247709
2020-08-28 21:13:04 +09:00
Ben Mathews 85e77982bf Update to the latest version of helm-diff plugin (#1430)
This is needed to support the --disable-validation flag added into
helmfile
2020-08-28 21:12:44 +09:00
Yusuke Kuoka b42e847154 Fix race while running helm dep build on local chart
Resolves #1438
2020-08-28 20:08:44 +09:00
Yusuke Kuoka 14e2b9ed93 Fix regression in helmfile deps (#1431)
Fixes #1421
2020-08-27 09:22:02 +09:00
Anatoly Rugalev 90a41222e6 fix: panic when using helm v3.3 (#1427) (#1428) 2020-08-24 08:57:17 +09:00
KUOKA Yusuke a9aa7af572 Fix regression installing raw K8s manifests (#1417)
Fixes #1413
2020-08-14 19:52:00 +09:00
KUOKA Yusuke 738409ee0e Fix regression for helmfile template with helm v2 since v0.125.4 (#1416)
This fixes the regression introduced by #1406 that resulted in `helmfile template` with helm v2 failing when there is any release with `version`.

Fixes #1414
2020-08-14 09:57:10 +09:00
KUOKA Yusuke ec87a39015 Revert filtering on repositories to be updated (#1412)
This reverts a part of #1383 so that repository updates are done in the pre-0.125.0 way, which tries to update any repositories only once regardless of they are referenced by selected releases or not.

Ref #1404
2020-08-13 10:10:30 +09:00
KUOKA Yusuke ab1c118022 Bump chartify to v0.4.0 (#1409)
* Bump chartify to v0.4.0

Should fix #1338

* Bump minimum Helm 3 version to v3.1.0 for `helm template --include-crds`
2020-08-12 09:52:51 +09:00
KUOKA Yusuke c8c444debc Add test case (#1410)
To ensure that `helmfile -l foo!=bar` does match against release without the label at all.
2020-08-12 09:07:22 +09:00
KUOKA Yusuke 9a03d79a84 Fix chart fetched by go-getter not to fail due to missing dependencies (#1408)
Ref https://github.com/roboll/helmfile/issues/1401#issuecomment-670915272
2020-08-08 21:22:57 +09:00
KUOKA Yusuke 0ef7e65f02 Fix race on/sometimes missing postsync and cleanup hooks (#1407)
So that those hooks are fully executed as intended. The documentation about hooks are updated as well to clarify the intended behaviour.

Fixes #1398
2020-08-08 16:45:21 +09:00
KUOKA Yusuke 61b61d3009 Fix helmfile template with Helm 3 ignoring chart version (#1406)
This fixes a regression introduced in #1399
Fixes #1377
2020-08-08 15:26:40 +09:00
KUOKA Yusuke 2710cb382f Fix go-getter URL in chart to actually work (#1405)
Fixes #1401
2020-08-08 11:01:47 +09:00
KUOKA Yusuke 4d7fcd846e doc: ArgoCD integration (#1402)
Relates to #1110
Relates to #1060
Relates to #780
2020-08-06 09:51:11 +09:00
KUOKA Yusuke b85243a6b4 Fix various issues in chart preparation (#1400)
In #1172, we accidentally changed the meaning of prepare hook that is intended to be called BEFORE the pathExists check. It broke the scenario where one used a prepare hook for generating the local chart dynamically. This fixes Helmfile not to fetch local chart generated by prepare hook.

In addition to that, this patch results in the following fixes:

- Fix an issue that `helmfile template` without `--skip-deps` fails while trying to run `helm dep build` on `helm fetch`ed chart, when the remote chart has outdated dependencies in the Chart.lock file. It should be up to the chart maintainer to update Chart.lock and the user should not be blocked due to that. So, after this patch `helm dep build` is run only on the local chart, not on fetched remote chart.
- Skip fetching chart on `helmfile template` when using Helm v3. `helm template` in helm v3 does support rendering remote charts so we do not need to fetch beforehand.

Fixes #1328
May relate to #1341
2020-08-06 09:06:25 +09:00
KUOKA Yusuke 53c3fe9f37 Add support for selector on helmfile template (#1399)
Fixes #1377
2020-08-05 09:31:58 +09:00
Kyrylo Lebediev 2ce57ba2ee Handle --disable-openapi-validation parameter in helm upgrade (#1396) 2020-08-04 08:36:18 +09:00
KUOKA Yusuke cc9b7f3942 Fix regression on template failing due to duplicate fetch target (#1395)
This fixes a regression introduced in #1388
Fixes #1394
2020-08-04 02:28:58 +09:00
KUOKA Yusuke 85a2024669 Fix helmfile lint failure when installed: false (#1391)
Fixes #1344
2020-08-01 13:47:57 +09:00
KUOKA Yusuke 87573089e8 Fix false-positive duplicate release with kubeContext (#1390)
Helmfile has been incorrectly showing releases with the same name but in different kubeContexts as duplicates. This fixes that.
2020-08-01 12:12:54 +09:00
KUOKA Yusuke 4fb47a833a Add version sub-command (#1389)
Resolves #1369
2020-08-01 10:37:34 +09:00
KUOKA Yusuke 9cffef50b0 Update documentation to mention Renovate integration (#1387) 2020-08-01 10:36:15 +09:00
KUOKA Yusuke b4857937fb Fix lint to not fail for duplicate release names across ns (#1388)
Fixes #1384
2020-08-01 10:36:01 +09:00
KUOKA Yusuke 1e260e4a5e Fix and enhancement to repository update (#1383)
Changes:

- Prevent Helmfile from unnecessarily running `helm repo add` and `helm repo up` against repositories for unused repositories(repositories of releases filtered out by selector)
- Fixes #1330
2020-07-28 10:17:43 +09:00
KUOKA Yusuke ee8ea507a6 Add pre/postuninstall hooks (#1375)
Exmple:

```
releases:
- name: test2
  chart: stable/mysql
  installed: false
  hooks:
  - events:
    - prepare
    - preuninstall
    - postuninstall
    - cleanup
    showlogs: true
    command: "echo"
    args:
    - "event name = {{` {{ .Event.Name `}} }}"
```

Output:

```
helmfile apply
Listing releases matching ^test2$
test2   default         1               2020-07-23 00:51:44.975478 +0900 JST    deployed        mysql-1.6.6     5.7.30

helmfile.yaml: basePath=.

hook[preuninstall] logs | event name =  preuninstall
hook[preuninstall] logs |
Deleting test2
release "test2" uninstalled

helmfile.yaml: basePath=.

hook[postuninstall] logs | event name =  postuninstall
hook[postuninstall] logs |
helmfile.yaml: basePath=.

hook[cleanup] logs | event name =  cleanup
hook[cleanup] logs |

DELETED RELEASES:
NAME
test2
```

Resolves #802
2020-07-23 01:09:36 +09:00
KUOKA Yusuke b5830a3011 Add ability to use go-getter for fetching remote manifests directory as chart (#1374)
This, in combination with #1172, allows you to use `go-getter`-supported URL for K8s manifests on `chart`, so that Helmfile automatically fetches it and then turning it into a temporary local chart, which is then installed by Helmfile as similar as standard Helm charts.

An example usecase of this is to install cert-manager CRDs which is distributed separately from the chart:

```
releases:
- name: cert-manager-crds
  chart: git::http://github.com/jetstack/cert-manager.git@deploy/crds?ref=v0.15.2
```

I'm adding this based on discussion with @lukasmrtvy. He was trying to install cert-manager and prometheus-opreator with Helmfile, and this combined with #1373 should do the job. Thanks for the input!
2020-07-23 00:30:16 +09:00
KUOKA Yusuke 4fde6e13db Add disableValidation and disableOpenAPIValidation per release (#1373)
`disableOpenAPIValidation: true` might be useful for workaround for broken CRDs that is known to be exist in older OpenShift versions, and `disableValidation: true` is confirmed to allow installing charts like prometheus-operator that tries to install CRDs and CRs in the same chart.

Strictly speaking, for the latter case I believe you only need `disableValidation: true` set during the first installation, but for the ease of operation I shall suggest you to always set it.

Obviously turning validation mostly(disableOpenAPIValidation) or entirely(disableValidation) result in deferring any real error until sync time. We need completely client-side validation that is able to read CRDs and use it for validating any CRs to catch any error before sync. But it worth an another (big) issue.

Fixes #1124
2020-07-22 23:10:22 +09:00
Olblak a5e790caf1 Add Jenkins OSS to the list of users (#1372) 2020-07-22 22:34:44 +09:00
KUOKA Yusuke 1e956ae8a5 Fix list failure when patches are used (#1371)
Fixes #1368
2020-07-22 22:33:45 +09:00
KUOKA Yusuke 1671b8ba7d Bump variantdev/vals for better Variant KV v2 support (#1367)
Ref https://github.com/variantdev/vals/pull/33
2020-07-21 07:17:40 +09:00
KUOKA Yusuke 608ba19c3c Bump chartify to 0.3.11 (#1366)
Fixes #1365
2020-07-21 04:56:27 +09:00
Prasanna daf7d3b876 fix the issue in the documentation (#1364) 2020-07-20 10:09:54 +09:00
KUOKA Yusuke 34f6d4d568 Bump chartify to 0.3.10 (#1363)
Fixes #1360
2020-07-19 20:08:18 +09:00
Yusuke Kuoka 1784b02d03 Add --retry-connrefused for reliable image builds 2020-07-18 22:29:58 +09:00
KUOKA Yusuke 68c51d8c16 Bump variantdev/vals to 0.9.3 (#1361) 2020-07-18 22:28:37 +09:00
KUOKA Yusuke 4bbb1699a3 Bump variantdev/chartify to 0.3.8 (#1359)
Fixes #1335
2020-07-17 09:41:05 +09:00
Sergei Ryabkov 753f65a56d Add Cherre to USERS.md (#1358)
We have been meaning to create this PR for a while now...
2020-07-17 09:28:07 +09:00
Yusuke Kuoka 43adbeaaca Update README about loading remote environment values 2020-07-16 09:33:09 +09:00
KUOKA Yusuke df6489ab43 feat: helmfile template --output-dir-template for customizing output dirs (#1357)
This is useful for e.g. removing state file names and their hash values out of output dirs so that it can be used easily in a gitops setup. For example, `--output-dir-template mybasedir/{{.Release.Name}}` produces `mybasedir/RELEASE/CHART/templates/*.yaml` for each release in your helmfile.yaml.
2020-07-16 09:02:26 +09:00
Santiago Hernandez 31d0fce6fd Update USERS.md (#1352) 2020-07-14 08:44:24 +09:00
KUOKA Yusuke cd427d9714 Bump variantdev/vals to 0.7.1 (#1332)
To incorporate the tfstate provider fix

Ref https://github.com/roboll/helmfile/issues/505#issuecomment-653848769
2020-07-06 08:30:19 +09:00
Alex VoronaandAlex Vorona 6d4f0984b6 Fix kubeContext per release override (#1312)
* Move kube-context from helmDefaults to 1'st argument to let kube-context per release override it

* fix tests

Co-authored-by: Alex Vorona <av@dysnix.com>
2020-06-27 17:19:05 +09:00
Santiago Hernandez ac40eec423 Add PedidosYa :) (#1322) 2020-06-27 17:17:30 +09:00
KUOKA Yusuke 8de9b70b33 Bump variantdev/vals to 0.6.0 (#1311)
- Add `version` parameter for Vault provider
- Add `profile` parameter for AWS SSM/SecretsManager provider
= Add `version` parameter for AWS SSM Parameter Store provider
- Add support for app-role authentication when using Vault provider
2020-06-16 09:07:04 +09:00
ento face92536c Add integration test for Kustomize inetgration (#1288)
Summary of changes:

* Output any error from Mkdir in `helmfile template`

* Add failing test for .Release.Name interpolation

* Add golden files for testing

* Parse resources with kustomize to compare them structure by structure

* Decode resources into plain maps

The RNode type from kustomize uses yaml.Node under the hood,
which carries extra information like line numbers, which
become noisy when comparing with deep.Equal.
2020-06-16 09:06:52 +09:00
KUOKA Yusuke 3a2a460fe7 Do cleanup decrypted env secrets files (#1304)
* Do cleanup decrypted env secrets files

Resolves #503
2020-06-16 08:59:48 +09:00
Max Audron f16d96bc8f Add global hooks (#1301)
Changes:

* Add global hooks
* Add top level hooks field to yaml spec
* Add functions for global prepare and cleanup events
* Call global prepare and cleanup events in withPreparedCharts function
* Update README
* Add helmfileCommand variable to withPreparedCharts
  Pass the information on what helmfileCommand has been run down from the
  top level functions through withReposAndPreparedCharts and withPreparedCharts.
2020-06-11 10:05:38 +09:00
Kevin J. Qiu 0f86cc9b87 Add the ability to load a remote environment values file (#1296)
Enables the user to specify a remote path for an environment values file, e.g.,

```yaml
environments:
  cluster-azure-us-west:
    values:
      - git::https://git.company.org/helmfiles/global/azure.yaml?ref=master
      - git::https://git.company.org/helmfiles/global/us-west.yaml?ref=master
  cluster-gcp-europe-west:
    values:
      - git::https://git.company.org/helmfiles/global/gcp.yaml?ref=master
      - git::https://git.company.org/helmfiles/global/europe-west.yaml?ref=master

releases:
  - ...
```

This is particularly useful when you co-locate helmfiles within your project repo but want to reuse the definitions in a global repo.
2020-06-11 10:04:01 +09:00
KUOKA Yusuke ca844aa044 Fix patching not using release namespace (#1300)
Ref #1299
2020-06-09 16:40:13 +09:00
Rene HernandezandRene Hernandez Remedios 604af3f1d2 Replace getOrNil with get function in documentation (#1268)
* New output flag for list command

Support output as json
Add new formatters file to handle extrac formatting to its own concern
New config interface to support list command specification

* Fix usage message

* Add error handling for formatters

* Replace usage of getOrNil with get function

* Add nil in get function

Co-authored-by: Rene Hernandez Remedios <rene.hernandez@fullscript.com>
2020-06-08 08:10:27 +09:00
Ilya Vassyutovich 28e13c3a18 typo: Fix message for detected diff (#1284) 2020-06-06 09:31:25 +09:00
KUOKA Yusuke 7db31846cf fix: Do not include stderr content in result of {{ exec }} (#1298)
Seems like this was a regression since https://github.com/roboll/helmfile/commit/f676c6142520364553c6a574fb976eeb0c31a456 and #1159

Fixes #1258
2020-06-06 09:29:12 +09:00
KUOKA Yusuke 63c8df9873 Fix missing resources in hemlfile template with jsonPatches (#1290)
Probably this has been affecting strategicMergePatches and dependencies as well, as the source of the problem is the underlying common feature called helm-x that previsouly used `helm template --output-dir`, which turned out to be not working as intended.

Ref #1279
2020-06-01 22:54:11 +09:00
KUOKA Yusuke eff2a7bf84 Fix repo update timing (#1287)
Fixes #1283
2020-05-30 18:01:14 +09:00
KUOKA Yusuke 3284df2752 Bump variantdev/chartify to fix kustomize support (#1280)
Fixes #1279
2020-05-29 10:08:09 +09:00
KUOKA Yusuke e607bae5ff Fix ignored chart version on patched release (#1276)
See https://sweetops.slack.com/archives/CE5NGCB9Q/p1590607083301900?thread_ts=1590237129.290300&cid=CE5NGCB9Q
2020-05-28 20:52:56 +09:00
KUOKA Yusuke 930f91a70d Merge pull request #1273 from roboll/fix-chartify
fix: Follow-up fixes for #1172
2020-05-27 22:15:41 +09:00
Yusuke Kuoka 1cfce32e0d Add documentation for releases[].{strategicMergePatches,jsonPatches} 2020-05-27 22:15:12 +09:00
Yusuke Kuoka 29fdb57add fix: Support for kustomization as chart
A kustomization has not been properly chartified when a kustomization is specified on `releases[].chart` but there were no `releases[].strategicMergePatches` and `jsonPatches` specified.
This fixes that.
2020-05-27 22:07:52 +09:00
Yusuke Kuoka 68432b1848 fix: Do not skip passing values files when adhocDependencies/jsonPatches/jsonPatches exist
This is a follow-up for #1172
2020-05-27 21:13:05 +09:00
KUOKA Yusuke 16288dfa7d feat: GA of Kustomize and K8s manifests support (#1172)
This is the GA version of the helm-x integration #673 developed last year.

You get all the following benefits without an extra helm plugin:

- Ability to add ad-hoc chart dependencies/aliases, without forking the chart (Fixes #876 )
- Ability to patch resulting K8s resources before installing the helm chart
- Ability to install a kustomization as a chart (Requires `kustomize` binary to be available in `$PATH`
- Ability to install a directory of K8s manifests as a chart
- etc.
2020-05-27 11:42:43 +09:00
Brian Choy 969de1ebc9 Fix typo in writing-helmfiles.md example (#1263) 2020-05-19 10:04:38 +09:00
Danny Shemesh ceb108a24f Fixed part splitting for CLRF separated files (#1265)
Fixes https://github.com/roboll/helmfile/issues/1142

desired_state_file_loader.go
- Will now normalize the content before splitting it to parts

context:
Me & and a fellow dev have tried to figure out why helmfile didn't fill in certain values on his machine; 
turns out, he'd mistakenly checked out our project w/ CRLF line endings, which had caused part splitting to not work (as it's hard coded to look for '\n').

The following was acted on as a single part, causing values from the bases not to be available in the next yaml part:

```
bases:\r\n
  - base.yaml\r\n
---\r\n

releases:
  - name: external-secrets-crd
    ... some templated yaml ...
```

I've thought about regex-ing it out instead of replace-all, but benchmarks had shown that a plain replace is faster.

I've also considered splitting by "\n---" instead of "\n---", but that would break if the dashes were to continue with some other text.
2020-05-19 10:04:12 +09:00
hacker65536 576a07f497 fix: typo in README (#1254) 2020-05-12 09:42:07 +09:00
Craig Furman eb8ab54865 Optionally error when subhelmfiles do not exist (#1245)
This prevents typos in helmfiles from silently preventing operations
from running. The default behavior is to print a warning, to preserve
backwards compatibility.
2020-05-12 09:41:39 +09:00
Yusuke Kuoka 9e4bc6e7fc chore: Add retries for downloading kubectl in docker builds 2020-05-09 14:31:52 +09:00
James F McMahon ef2d8853c2 README: Add note about environment variable types (#1251)
Fixes https://github.com/roboll/helmfile/issues/1248
2020-05-09 14:12:52 +09:00
machine424andayoub mrini 66f34580c3 feat: Add global --debug flag for passing --debug to helm (#1236)
Add a global flag --debug that sets the logging level to debug and passes the global flag --debug to Helm through the implementation of subcommands’ --args.

Resolves #1104

Co-authored-by: ayoub mrini <amrini@wiremind.fr>
2020-05-09 14:11:54 +09:00
Guillaume Perrin 6d5f8c71cb Allow skipping chart-related operations when installed: false (#1233)
Resolves #1232

CHANGES:

* Disable repo update when installed is false

When install is false, we do not need to update the repositories and get
the chart.

Signed-off-by: Guillaume Perrin <guillaume28.perrin@gmail.com>
2020-05-09 14:03:56 +09:00
刘相轩 23be9af2db Show executed command when errors occurred (#1252) 2020-05-09 13:35:31 +09:00
Cédric de Saint Martin 1e9e228a9a Dockerfile: Upgrade to Helm v3.2.1. (#1253) 2020-05-09 13:34:46 +09:00
Rick StokkingreefandRick Stokkingreef c72cab80b5 Bump variantdev/vals for Vault AppRole support (#1239)
Co-authored-by: Rick Stokkingreef <rick.stokkingreef@takeaway.com>
2020-05-02 09:40:16 +09:00
Victor Noël 923bd54db0 Use namespace for release unicity with helm3 (#1213) (#1235)
This is for #1213 so that the releases are considered scoped to their namespace and not to tiller namespace.

Fixes #1213
2020-05-02 09:35:51 +09:00
nejtr0nandAlexey Shishkin a0e30c5193 Correct ordering between releases and sub-helmfiles on destroy/delete (#1234)
Fixes #1192

Co-authored-by: Alexey Shishkin <a.shishkin@directheroes.com>
2020-05-01 09:06:13 +09:00
Cédric Lamalle daf8c2f12b Upgrade helm to v3.2.0 (#1231)
* Upgrade helm to v3.2.0
2020-04-29 15:00:49 +09:00
Craig Dunford d71ac15748 Enhance createNamespace error handling (#1227)
- An error is raised if createNamespace is set explicitly and the
  helm version being used is not 3.2+
2020-04-27 08:59:44 +09:00
Craig Dunford eeb61e6174 Support for createNamespace (#1226)
- createNamespace is a new attribute that can be added to helmDefaults
  or an individual release to enforce the creation of a release namespace
  during sync if the namespace does not exist. This leverages helm's
  (3.2+) --create-namespace flag for the install/upgrade command. If
  running helm < 3.2, the createNamespace attribute has no effect.

Resolves #891
Resolves #1140
2020-04-26 10:41:40 +09:00
Marcin Kaciuba b1190508b2 feat(template): added secret template function (#1221)
* feat(tmpl): added fetchSecretValue template function

This adds a tmpl `fetchSecretValue` and `expandSecretRefs` function by:
- Adding:
    - `expandSecretRefs` function in tmpl package that uses vals
    package to fetch secrets
    - `fetchSecretValue` function in tmpl package like below but for
    single string value
    - gomock for tests purpose
- Changing:
    - move init of vals package to function (so the same instance can be used for template values and rendering the whole template)

* doc(secret): added doc how to use new tmpl methods

Added example usage of `fetchSecretValue` and `expandSecretRefs`
2020-04-25 21:10:02 +09:00
Ash Caire 3a19a394ab Add condition release attribute (#1190) 2020-04-23 08:43:34 +09:00
Jesse Glick dcb19f942b Typo: kustommize (#1224) 2020-04-23 08:38:33 +09:00
Eric Bailey 458385d971 Amend examples which broke lock files in README.md (#1225)
Prior to this change, these two examples suggested enclosing a release spec in
an if expression, which breaks the lock file when switching environments.

This change parameterizes `installed` instead of the entire release, thus
preserving the dependency locking functionality.
2020-04-23 08:38:01 +09:00
chenrui b89fba1cc2 Bump golang to v1.14.2 (#1132)
* Bump golang to v1.14.2

* Use gotest.tools/v3
2020-04-21 09:06:29 +09:00
KUOKA Yusuke 6b6b86a0b5 Bump variantdev/vals to v0.4.0 (#1217)
For GCP Secrets Manager support
2020-04-18 23:22:23 +09:00
Rene Hernandez e0a793b7c5 New output flag for list command (#1215)
* New output flag for list command

Support output as json
Add new formatters file to handle extrac formatting to its own concern
New config interface to support list command specification

* Fix usage message

* Add error handling for formatters
2020-04-18 21:11:12 +09:00
Danny Shemesh 71bb7354e7 Fix: populate .Values regardless of prestate success (#1202)
This commit proposes a potential solution for
https://github.com/roboll/helmfile/issues/1201

The gist is that, if prestate rendering fails, for any reason,
we do not populate the .Values in the second pass renderer.

I think that what have been expected in this case is to populate the
.Values irregardless.

pkg/app/two_pass_renderer.go
- Migrated to use finalEnv.GetMergedValues()

pkg/environment/environment.go
- Introduced GetMergedValues, which merges the environment's defaults
and current values, and then casts the keys to string;
This was previously defined in HelmState.Values() - however, as this
method is only concerned with the environment, I think it's more
appropriate for it to sit here.

pkg/state/state_exec_tmpl.go
- Extracted out HelmState.Values() to environment.go, see above
2020-04-17 09:18:01 +09:00
KUOKA Yusuke 3a34d28d7c fix: helmDefaults.timeout and releases[].timeout not working for helmfile test (#1211)
Fixes #1191
2020-04-17 09:08:21 +09:00
Douglas Hellinger f39d7928bf Put tiller on path for use in helm-tiller plugin (#1198)
Put tiller binary on the path in helm v2.X container image so that helm-tiller plugin will use it instead of duplicating the download of helm tarball and performing version check.
2020-04-14 09:18:18 +09:00
Vadim Bauer e0811dffa2 Update helmfile.yaml example in README (#1189)
- Adds default comments into helmfile.yaml example

- Fixes some typos

Signed-off-by: Vadim Bauer <vb@8gears.com>
2020-04-10 08:27:09 +09:00
RaymondKYLiuandRaymond Liu 7d11f5dedc feat: add tmpl function required (#1188)
Co-authored-by: Raymond Liu (RD-TW) <raymond_liu@trend.com.tw>
2020-04-10 08:23:42 +09:00
KUOKA Yusuke 870cc03c70 feat: helmfile diff --detailed-exitcode should also detect deletions (#1186)
Resolves #499
Resolves #1072
2020-04-10 08:22:33 +09:00
KUOKA Yusuke 98886df5d2 fix: .Values is missing keys with zero values (#1185)
Ref #1184
2020-04-10 08:21:23 +09:00
RaymondKYLiuandRaymond Liu 71635caace feat: add option --include-tests for diff and apply command (#1179)
Co-authored-by: Raymond Liu (RD-TW) <raymond_liu@trend.com.tw>
2020-04-05 17:43:54 +09:00
KUOKA Yusuke 486be0970d Bump vals to 0.3.0 (#1175)
vals v0.3.0 introduces the terraform output source that can be accessed by `ref+tfstate://path/to/tfstatefile/type.resourcename.prop` syntax. Please see the updated README section of vals for more info.
2020-04-04 19:50:01 +09:00
KUOKA Yusuke 9d7d2de6f5 Fix misleading helmfile diff output (#1174)
Fixes #749
2020-04-04 17:39:20 +09:00
KUOKA Yusuke 04c963d050 feat: Complete helmfile diff output when diff exists (#1173)
Fixes #874
2020-04-04 16:24:01 +09:00
KUOKA Yusuke a2c62c9e73 feat: Emit clear error message instead of panic on empty chart name (#1171)
Resolves #999
2020-04-04 15:32:22 +09:00
KUOKA Yusuke 1654ce4c18 Add regression tests for environment values merge (#1170)
This is a follow-up for #1169 and it also relates to #1168
2020-04-04 14:27:29 +09:00
KUOKA Yusuke 25aae679b1 Merge pull request #1169 from elodani/master
fix: empty map merge was not working after mergo bump
2020-04-04 14:00:41 +09:00
Daniel Elo d404356230 feat: fix empty map merge after mergo bump
since mergo had been bumped to 0.3.9 an environment value like:
```
affinity: {}
```
was not merged properly (not merged at all) instead it threw an error
that it cannot find the key "affinity" in the environment values even
though it was outputted in debug output as read in properly.
2020-04-03 15:01:27 +02:00
KUOKA Yusuke 51ecd12360 Fix panic while loading environment secrets (#1164)
This fixes a regression in #1160
2020-03-30 20:13:40 +09:00
KUOKA Yusuke 6643a41ea3 fix: merge environment values by ovewriting with empty values (#1162)
Fixes #1154
2020-03-29 20:47:23 +09:00
KUOKA Yusuke 35e5454994 Change the helmfile list header "INSTALLED" -> "ENABLED" (#1161)
Resolves #1076
2020-03-29 19:11:58 +09:00
KUOKA Yusuke 69feadc360 feat: helmBinary in helmfile.yaml (#1160)
* feat: `helmBinary` in helmfile.yaml

Resolves #1083

* Add regression test for `helmfile destroy`
2020-03-29 17:51:07 +09:00
KUOKA Yusuke f676c61425 feat: Better exec error reporting (#1159)
Enhances Helmfile to print more helpful message on error while calling `exec` template function.

Helmfile has been printing error messages like the below:

```
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:5:8: executing "stringTemplate" at <exec "./exectest.sha" (list)>: error calling exec: exit status 1
```

Adding captured stdout and stderr, with some indentation to make it readable, it now produces the following message on missing executable:

```
$ make build && ./helmfile build
go build
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:5:8: executing "stringTemplate" at <exec "./exectest.sha" (list)>: error calling exec: fork/exec ./exectest.sha: no such file or directory

COMMAND:
  ./exectest.sha

ERROR:
  fork/exec ./exectest.sha: no such file or directory
```

On non-zero exit status without output:

```
$ make build && ./helmfile build
go build
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:5:8: executing "stringTemplate" at <exec "./exectest.sh" (list)>: error calling exec: exit status 1

COMMAND:
  ./exectest.sh

ERROR:
  exit status 1
```

On non-zero exit status with output:

```
$ make build && ./helmfile build
go build
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:5:8: executing "stringTemplate" at <exec "./exectest.sh" (list)>: error calling exec: exit status 2

COMMAND:
  ./exectest.sh

ERROR:
  exit status 2

COMBINED OUTPUT:
  out1
  err1
```

Resolves #1158
2020-03-29 10:49:02 +09:00
KUOKA Yusuke 20a39e9412 Bump mergo to 0.3.8 (#1153)
Fixes #1150
2020-03-20 18:56:43 +09:00
KUOKA Yusuke 048c79ad34 Bump variantdev/vals to 0.2.0 (#1152)
For support for the advanced AWS profile usage in retrieving AWS SSM params/secrets https://github.com/variantdev/vals/issues/19
2020-03-20 16:00:21 +09:00
KUOKA Yusuke 994e4b66fc fix: exec template func should not throw away stdout when stdin is non empty (#1151)
Fixes #1149
2020-03-20 12:23:34 +09:00
KUOKA Yusuke 499f6ec6e3 Add Sportradar to USERS.md (#1133) 2020-03-05 08:09:17 +09:00
KUOKA Yusuke bf22502a2f feat: add helmfile template --validate (#1135)
This adds the ability for helmfile to call `helm template --validate` introduced in helm 3.

fixes #1105
2020-03-05 08:07:02 +09:00
Eric Bailey 7c80a859fa Fix awkward dependency error message (#1130) 2020-03-02 08:23:03 +09:00
Gleidson Nascimento 00c4422a64 Add validation for empty repository names (#1128)
Resolves #1112
2020-02-28 19:42:15 +09:00
KUOKA Yusuke af44965949 feat: helmfile --log-level=debug apply --retain-values-files (#1127)
`--retain-values-files` prevents temporary values files that were passed to Helm commands run by Helmfile for debugging purpose.

With that, you can manually rerun helm commands that were logged when `--log-level=debug` is enabled.

Resolves ##1117
2020-02-28 19:39:01 +09:00
KUOKA Yusuke 0186254e79 feat: --detailed-exitcode for helmfile apply (#1120)
Resolves #1113
2020-02-26 21:09:05 +09:00
jfreeland 8acbbc596d new here, fixing very minor typo (#1121) 2020-02-26 10:33:35 +09:00
532 changed files with 51184 additions and 7028 deletions
-207
View File
@@ -1,207 +0,0 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.13.7
environment:
GOPATH: /go
working_directory: /home/circleci/workspace/helmfile
steps:
- checkout
- restore_cache:
keys:
- go-mod-cache-v1-{{ checksum "./go.sum" }}
- go-mod-cache-v1-
- run: go env
- run: make build
- save_cache:
key: go-mod-cache-v1-{{ checksum "./go.sum" }}
paths:
- /go/pkg/mod
- persist_to_workspace:
root: ./
paths:
- .
image:
docker:
- image: circleci/golang:1.13.7
working_directory: /home/circleci/workspace/helmfile
steps:
- checkout
- restore_cache:
keys:
- go-mod-cache-v1-{{ checksum "./go.sum" }}
- go-mod-cache-v1-
- setup_remote_docker
- run:
command: |
make tools
go mod vendor
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make image
image_helm3:
docker:
- image: circleci/golang:1.13.7
working_directory: /home/circleci/workspace/helmfile
steps:
- checkout
- restore_cache:
keys:
- go-mod-cache-v1-{{ checksum "./go.sum" }}
- go-mod-cache-v1-
- setup_remote_docker
- run:
command: |
make tools
go mod vendor
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make image/helm3
test:
environment:
GOPATH: /go
docker:
- image: circleci/golang:1.13.7
working_directory: /home/circleci/workspace/helmfile
steps:
- checkout
- restore_cache:
keys:
- go-mod-cache-v1-{{ checksum "./go.sum" }}
- go-mod-cache-v1-
- run: make check
- run: make pristine
- run: make test
# thanks to https://raw.githubusercontent.com/weaveworks/launcher/master/.circleci/config.yml
integration_tests:
machine:
image: circleci/classic:201808-01
environment:
CHANGE_MINIKUBE_NONE_USER: true
MINIKUBE_WANTUPDATENOTIFICATION: false
MINIKUBE_WANTREPORTERRORPROMPT: false
steps:
- checkout
- run: mkdir ~/build
- attach_workspace:
at: ~/build
- run: cp ~/build/helmfile ~/project/helmfile
- run:
name: Install helm
environment:
HELM_VERSION: v2.16.1
command: |
HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
curl -Lo ${HELM_FILENAME} "https://kubernetes-helm.storage.googleapis.com/${HELM_FILENAME}"
tar zxf ${HELM_FILENAME} linux-amd64/helm
chmod +x linux-amd64/helm
sudo mv linux-amd64/helm /usr/local/bin/
- run:
name: Deploy minikube
environment:
CHANGE_MINIKUBE_NONE_USER: true
K8S_VERSION: v1.12.3
MINIKUBE_VERSION: v0.30.0
command: |
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
chmod +x minikube && sudo mv minikube /usr/local/bin/
sudo -E minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION}
sudo -E minikube update-context
- run:
name: Wait for nodes to become ready
command: JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
- run:
name: Execute integration tests
command: |
export TERM=xterm
make integration
integration_tests_helm3:
machine:
image: circleci/classic:201808-01
environment:
CHANGE_MINIKUBE_NONE_USER: true
MINIKUBE_WANTUPDATENOTIFICATION: false
MINIKUBE_WANTREPORTERRORPROMPT: false
steps:
- checkout
- run: mkdir ~/build
- attach_workspace:
at: ~/build
- run: cp ~/build/helmfile ~/project/helmfile
- run:
name: Install helm
environment:
HELM_VERSION: v3.0.0
command: |
HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
curl -Lo ${HELM_FILENAME} "https://get.helm.sh/${HELM_FILENAME}"
tar zxf ${HELM_FILENAME} linux-amd64/helm
chmod +x linux-amd64/helm
sudo mv linux-amd64/helm /usr/local/bin/
- run:
name: Deploy minikube
environment:
CHANGE_MINIKUBE_NONE_USER: true
K8S_VERSION: v1.12.3
MINIKUBE_VERSION: v0.30.0
command: |
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
chmod +x minikube && sudo mv minikube /usr/local/bin/
sudo -E minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION}
sudo -E minikube update-context
- run:
name: Wait for nodes to become ready
command: JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
- run:
name: Execute integration tests
command: |
export TERM=xterm
HELMFILE_HELM3=1 make integration
# GITHUB_TOKEN env var must be setup in circleci console
release:
docker:
- image: circleci/golang:1.13.7
working_directory: /home/circleci/workspace/helmfile
steps:
- checkout
- restore_cache:
keys:
- go-mod-cache-v1-{{ checksum "./go.sum" }}
- go-mod-cache-v1-
- setup_remote_docker
- run:
command: |
docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io
make tools
go mod vendor
ORG=roboll BUILD_URL="$CIRCLE_BUILD_URL" make push push/helm3 release
workflows:
version: 2
build_and_test:
jobs:
- build
- image
- image_helm3
- test
- integration_tests:
requires:
- build
- integration_tests_helm3:
requires:
- build
- release:
filters:
branches:
ignore: /.*/
tags:
only: /v.*/
+1
View File
@@ -0,0 +1 @@
Dockerfile*
+5
View File
@@ -0,0 +1,5 @@
root = true
[*.md]
insert_final_newline = true
trim_trailing_whitespace = true
+3
View File
@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: mumoshu
+81
View File
@@ -0,0 +1,81 @@
name: Bug
description: File a bug report
body:
- type: markdown
attributes:
value: |
Before opening a bug report, please search for the behaviour in the existing issues.
Go ahead to https://github.com/helmfile/helmfile/search?q=&type= and fill in the error message you received from Helmfile or the keywords you think appropriate.
- type: markdown
id: thankyou
attributes:
value: |
Thank you for taking your time to file a bug report! To confirm it's a bug, we need some information to reproduce it.
- type: input
id: os
attributes:
label: Operating system
description: "Which operating system do you use? Please provide the version as well."
placeholder: "ex. Ubuntu 20.04.4 LTS"
validations:
required: true
- type: input
id: helmfile
attributes:
label: Helmfile Version
description: "Please provide the version number of Helmfile you used. If it isn't the latest, please upgrade first."
placeholder: "Run `helmfile version` to print it."
validations:
required: true
- type: input
id: helm
attributes:
label: Helm Version
description: "Please provide the version number of Helm you used. If it isn't the latest, please upgrade first."
placeholder: "Run `helm version` to print it."
validations:
required: true
- type: textarea
id: bug-description
attributes:
label: Bug description
description: What happened?
validations:
required: true
- type: textarea
id: helmfile-yaml
attributes:
label: Example helmfile.yaml
description: "Please provide an example helmfile.yaml that can be used to reproduce the issue locally."
validations:
required: true
- type: textarea
id: helmfile-error
attributes:
label: "Error message you've seen (if any)"
description: "Please provide the error message emitted by Helmfile."
validations:
required: true
- type: input
id: repo
attributes:
label: Steps to reproduce
description: Please provide the URL to a GitHub repository that contains a helmfile.yaml, other companion files, and a README.md with the steps to reproduce the bug.
validations:
required: true
- type: input
id: helmfile_working_ver
attributes:
label: Working Helmfile Version
description: "Please provide the highest version number of Helmfile that doesn't result in the above problem."
placeholder: "Run `helmfile version` to print it."
validations:
required: true
- type: input
id: discussion
attributes:
label: Relevant discussion
description: Please provide the URL to a relevant GitHub Discussion.
validations:
required: false
+14
View File
@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Sponsor Helmfile Maintainers
about: If your business relies on the continued maintainance of Helmfile, please consider sponsoring maintainers.
url: https://github.com/helmfile/helmfile/tree/main/CODEOWNERS
- name: Ideas and Feature Requests
about: Wanna request a feature? Create a discussion and collect :+1:s first.
url: https://github.com/helmfile/helmfile/discussions/new?category=ideas
- name: Questions and User Support
about: Need support using Helmfile? We use Discussions as the place to provide community support.
url: https://github.com/helmfile/helmfile/discussions/new?category=questions
- name: Need Paid Support?
about: Consider contracting with any of the Helmfile maintainers.
url: https://github.com/helmfile/helmfile/tree/main/CODEOWNERS
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
+18
View File
@@ -0,0 +1,18 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 14
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- in progress
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+68
View File
@@ -0,0 +1,68 @@
HELM_VERSION ?= v3.7.2
KUSTOMIZE_VERSION ?= v4.5.7
K8S_VERSION ?= v1.13.12
MINIKUBE_VERSION ?= v0.30.0
SOPS_VERSION ?= v3.6.1
# ---
CHANGE_MINIKUBE_NONE_USER ?= true
MINIKUBE_WANTUPDATENOTIFICATION ?= false
MINIKUBE_WANTREPORTERRORPROMPT ?= false
VAULT_ADDR := http://127.0.0.1:8200
VAULT_TOKEN := toor
tmp := $(shell mktemp -d)
HELM_FILENAME := helm-${HELM_VERSION}-linux-amd64.tar.gz
KUSTOMIZE_FILENAME := kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
all: vault sops helm kustomize minikube/destroy minikube
helm:
curl -sSLo $(tmp)/${HELM_FILENAME} "https://get.helm.sh/${HELM_FILENAME}"
tar zxf $(tmp)/${HELM_FILENAME} --directory ${tmp} linux-amd64/helm
chmod +x ${tmp}/linux-amd64/helm
sudo mv ${tmp}/linux-amd64/helm /usr/local/bin/
.PHONY: helm
kustomize:
curl -sSLo $(tmp)/${KUSTOMIZE_FILENAME} "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/${KUSTOMIZE_FILENAME}"
tar zxf $(tmp)/${KUSTOMIZE_FILENAME} --directory ${tmp} kustomize
chmod +x ${tmp}/kustomize
sudo mv ${tmp}/kustomize /usr/local/bin/
.PHONY: kustomize
minikube/destroy:
sudo -E minikube delete || true
sudo -E rm -rf /etc/kubernetes || true
sudo -E rm -rf $$HOME/.minikube/* || true
.PHONY: minikube/destroy
.EXPORT_ALL_VARIABLES: minikube/destroy
minikube:
curl -sSLo ${tmp}/kubectl https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/amd64/kubectl
chmod +x ${tmp}/kubectl && sudo mv ${tmp}/kubectl /usr/local/bin/
curl -sSLo ${tmp}/minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
chmod +x ${tmp}/minikube && sudo mv ${tmp}/minikube /usr/local/bin/
sudo -E minikube delete || true
sudo -E rm -rf /etc/kubernetes || true
sudo -E rm -rf $$HOME/.minikube/* || true
sudo -E minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION}
sudo -E minikube update-context
kubectl wait node/minikube --for=condition=Ready
.PHONY: minikube
.EXPORT_ALL_VARIABLES: minikube
vault:
docker kill $$(docker ps -a --filter "name=vault" -q) || true
docker run -d -p8200:8200 --rm --name vault vault:1.2.0 server -dev -dev-root-token-id=toor
docker run --rm --network="host" -e VAULT_ADDR=$$VAULT_ADDR -e VAULT_TOKEN=$$VAULT_TOKEN vault:1.2.0 secrets enable -path=sops transit
docker run --rm --network="host" -e VAULT_ADDR=$$VAULT_ADDR -e VAULT_TOKEN=$$VAULT_TOKEN vault:1.2.0 write sops/keys/key type=rsa-4096
.PHONY: vault
sops:
curl -sSLo $(tmp)/sops "https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}.linux"
chmod +x $(tmp)/sops
sudo mv ${tmp}/sops /usr/local/bin/
.PHONY: sops
+171
View File
@@ -0,0 +1,171 @@
name: Go
on:
push:
branches: [ main ]
paths-ignore: [ '**.md', '**/docs/**' ]
pull_request:
branches: [ main ]
paths-ignore: [ '**.md', '**/docs/**' ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache libraries
uses: actions/cache@v2
env:
cache-name: cache-go
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Env
run: go env
- name: Build
run: make build build-test-tools
- name: Test
run: make check test
- name: Prepare tar to upload built binaries
run: tar -cvf built-binaries.tar helmfile diff-yamls dyff
- name: Upload built binaries
uses: actions/upload-artifact@v2
with:
name: built-binaries-${{ github.run_id }}
path: built-binaries.tar
retention-days: 1
- name: Display built binaries
run: ls -l helmfile diff-yamls dyff
integration_tests:
needs: tests
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Helm maintains the latest minor version only and therefore each Helmfile version supports 2 Helm minor versions.
# That's why we cover only 2 Helm minor versions in this matrix.
# See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context.
- helm-version: v3.11.3
kustomize-version: v4.4.1
plugin-secrets-version: 3.15.0
plugin-diff-version: 3.5.0
extra-helmfile-flags:
v1mode:
- helm-version: v3.11.3
kustomize-version: v4.5.7
# We assume that the helm-secrets plugin is supposed to
# work with the two most recent helm minor versions.
# Once it turned out to be not practically true,
# we will mark this combination as failable,
# and instruct users to upgrade helm and helm-secrets at once.
plugin-secrets-version: 4.0.0
plugin-diff-version: 3.6.0
extra-helmfile-flags:
v1mode:
- helm-version: v3.12.0
kustomize-version: v4.4.1
plugin-secrets-version: 3.15.0
plugin-diff-version: 3.5.0
extra-helmfile-flags:
v1mode:
- helm-version: v3.12.0
kustomize-version: v4.5.7
plugin-secrets-version: 4.0.0
plugin-diff-version: 3.6.0
extra-helmfile-flags:
v1mode:
# Helmfile v1
- helm-version: v3.12.0
kustomize-version: v4.5.7
plugin-secrets-version: 4.0.0
plugin-diff-version: 3.6.0
extra-helmfile-flags:
v1mode: "true"
# In case you need to test some optional helmfile features,
# enable it via extra-helmfile-flags below.
- helm-version: v3.12.0
kustomize-version: v4.5.7
plugin-secrets-version: 4.0.0
plugin-diff-version: 3.6.0
extra-helmfile-flags: "--enable-live-output"
v1mode:
steps:
- uses: actions/checkout@v2
- name: Cache libraries
uses: actions/cache@v2
env:
cache-name: cache-go
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Env
run: go env
- name: Download built binaries
uses: actions/download-artifact@v2
with:
name: built-binaries-${{ github.run_id }}
- name: Extract tar to get built binaries
run: tar -xvf built-binaries.tar
- name: Display built binaries
run: ls -l helmfile diff-yamls dyff
- name: Install test dependencies
env:
HELM_VERSION: ${{ matrix.helm-version }}
KUSTOMIZE_VERSION: ${{ matrix.kustomize-version }}
run: make -C .github/workflows helm vault sops kustomize
- name: Start minikube
uses: medyagh/setup-minikube@master
- name: Execute integration tests
env:
HELM_SECRETS_VERSION: ${{ matrix.plugin-secrets-version }}
HELM_DIFF_VERSION: ${{ matrix.plugin-diff-version }}
HELMFILE_HELM3: 1
TERM: xterm
EXTRA_HELMFILE_FLAGS: ${{ matrix.extra-helmfile-flags }}
HELMFILE_V1MODE: ${{ matrix.v1mode }}
run: make integration
e2e_tests:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install package
run: |
sudo apt-get -y install expect
- name: Download built binaries
uses: actions/download-artifact@v2
with:
name: built-binaries-${{ github.run_id }}
- name: Extract tar to get built binaries
run: tar -xvf built-binaries.tar
- name: Display built binaries
run: ls -l helmfile diff-yamls dyff
- name: Run helmfile init
env:
TERM: xterm
run: bash test/e2e/helmfile-init/init_linux.sh
+83
View File
@@ -0,0 +1,83 @@
name: Images
on:
pull_request:
branches: [ main ]
push:
branches:
- main
- "image/**"
- "*image"
- "image*"
tags:
- 'v*'
paths-ignore:
- .github/workflows/ci.yml
- .github/workflows/lock.yml
- ".github/ISSUE_TEMPLATE/**"
- "docs/**"
- "hack/**"
- "**.md"
- ".gitignore"
- "Makefile"
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- dockerfile: Dockerfile
suffix: ""
- dockerfile: Dockerfile.debian-stable-slim
suffix: "-debian-stable-slim"
- dockerfile: Dockerfile.ubuntu
suffix: "-ubuntu"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}${{ matrix.image.suffix }}
flavor: latest=false
tags: |
type=raw,value=canary,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=ref,event=pr
type=semver,pattern={{raw}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build / Push
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.image.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
+30
View File
@@ -0,0 +1,30 @@
name: Lint
on:
push:
branches: [ main ]
paths-ignore: [ '**.md', '**/docs/**' ]
pull_request:
branches: [ main ]
paths-ignore: [ '**.md', '**/docs/**' ]
env:
GO_VERSION: 1.20
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Checkout code
uses: actions/checkout@v3
- name: Golangci lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.0
+30
View File
@@ -0,0 +1,30 @@
# Copyright 2022 The Helmfile Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: 'Lock closed'
on:
schedule:
- cron: '0 0 * * *'
jobs:
lock:
runs-on: 'ubuntu-latest'
steps:
- uses: 'dessant/lock-threads@v2'
with:
github-token: '${{ github.token }}'
issue-lock-inactive-days: 1
issue-lock-reason: 'resolved'
pr-lock-inactive-days: 1
pr-lock-reason: 'resolved'
+29
View File
@@ -0,0 +1,29 @@
name: Publish v0.x Binaries
on:
push:
branches:
- "!*"
tags:
- "v0*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+33
View File
@@ -0,0 +1,33 @@
name: Publish v1.x Binaries
on:
push:
branches:
- "!*"
tags:
- "v1*"
env:
# This is referenced from .goreleaser.yml
HELMFILE_V1MODE: "true"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+26
View File
@@ -0,0 +1,26 @@
name: Test Binary Builds
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist --snapshot
+10 -2
View File
@@ -1,5 +1,13 @@
dist/
.idea/
helmfile
helmfile.lock
/helmfile
/helmfile.lock
/diff-yamls
/dyff
test/integration/tmp$
vendor/
*.log
.vagrant/
*.lock
test/integration/.gnupg/
.vscode/launch.json
+360
View File
@@ -0,0 +1,360 @@
# This file contains all available configuration options
# with their default values.
# options for analysis running
run:
# default concurrency is a available CPU number
# concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 30m
# exit code when at least one issue was found, default is 1
issues-exit-code: 1
# include test files or not, default is true
tests: true
# list of build tags, all linters use it. Default is empty list.
# build-tags:
# - mytag
# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# skip-dirs:
# - src/external_libs
# - autogenerated_by_my_lib
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# skip-files:
# - ".*\\.my\\.go$"
# - lib/bad.go
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
# modules-download-mode: readonly|release|vendor
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: line-number
# print lines of code with issue, default is true
print-issued-lines: true
# print linter name in the end of issue text, default is true
print-linter-name: true
# all available settings of specific linters
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/helmfile/helmfile)
errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
# ignore: fmt:.*
# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
# exclude: /path/to/file.txt
# Disable error checking, as errorcheck detects more errors and is more configurable.
gosec:
exclude:
- "G104"
govet:
# report about shadowed variables
check-shadowing: false
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable or disable analyzers by name
# enable:
# - atomicalign
# enable-all: false
# disable:
# - shadow
# disable-all: false
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
# local-prefixes: github.com/org/project
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 100
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
goconst:
# minimal length of string constant, 3 by default
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 8
# depguard:
# list-type: blacklist
# include-go-root: false
# packages:
# - github.com/sirupsen/logrus
# packages-with-error-messages:
# # specify an error message to output when a blacklisted package is used
# github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
ignore-words:
- GitLab
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# tab width in spaces. Default to 1.
tab-width: 1
unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
prealloc:
# XXX: we don't recommend using this linter before doing performance profiling.
# For most programs usage of prealloc will be a premature optimization.
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
gocritic:
# Which checks should be enabled; can't be combined with 'disabled-checks';
# See https://go-critic.github.io/overview#checks-overview
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
# By default list of stable checks is used.
# enabled-checks:
# - rangeValCopy
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
# disabled-checks:
# - regexpMust
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
# enabled-tags:
# - performance
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
# rangeValCopy:
# sizeThreshold: 32
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- TODO
- BUG
- FIXME
- NOTE
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
strict-append: true
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.
allow-cuddle-declarations: false
# Allow trailing comments in ending of blocks
allow-trailing-comment: false
# Force newlines in end of case at this limit (0 = never).
force-case-trailing-whitespace: 0
revive:
ignore-generated-header: true
severity: warning
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines: 280
# Checks the number of statements in a function.
# If lower than 0, disable the check.
# Default: 40
statements: 140
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- depguard
- usestdlibvars
- reassign
- errcheck
- funlen
- gocognit
- goconst
- gofmt
- goimports
- revive
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- exportloopref
- staticcheck
- typecheck
- unconvert
- unparam
- unused
- whitespace
- gci
# - gocritic
# - godox
# - gosec
# - interfacer
# - stylecheck
# - dogsled
# - dupl
# don't enable:
# - deadcode
# - gochecknoglobals
# - gochecknoinits
# - gocyclo
# - lll
# - maligned
# - prealloc
# - varcheck
issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
# exclude:
# - abcdef
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl
- gosec
- funlen
# Exclude known linters from partially hard-vendored code,
# which is impossible to exclude via "nolint" comments.
# - path: internal/hmac/
# text: "weak cryptographic primitive"
# linters:
# - gosec
# Exclude some staticcheck messages
# - linters:
# - staticcheck
# text: "SA9003:"
# Exclude lll issues for long lines with go:generate
- linters:
- lll
source: "^//go:generate "
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
# Show only new issues: if there are unstaged changes or untracked files,
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
# It's a super-useful option for integration of golangci-lint into existing
# large codebase. It's not practical to fix all existing issues at the moment
# of integration: much better don't allow issues in new code.
# Default is false.
new: false
# Show only new issues created after git revision `REV`
# This should be passed as flag during individual CI jobs.
# new-from-rev: REV
# Show only new issues created in git patch with set file path.
# new-from-patch: path/to/patch/file
+27
View File
@@ -0,0 +1,27 @@
project_name: helmfile
env:
# We default to non-v1 mode (=helmfile v0.x behavior) when HELMFILE_V1MODE is not set
- HELMFILE_V1MODE={{ if index .Env "HELMFILE_V1MODE" }}{{ .Env.HELMFILE_V1MODE }}{{ else }}false{{ end }}
builds:
- id: helmfile
main: .
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- -X go.szostok.io/version.version={{.Version}}
- -X go.szostok.io/version.buildDate={{.Date}}
- -X go.szostok.io/version.commit={{.FullCommit}}
- -X go.szostok.io/version.commitDate={{.CommitDate}}
- -X go.szostok.io/version.dirtyBuild=false
- -X github.com/helmfile/helmfile/pkg/runtime.v1Mode={{.Env.HELMFILE_V1MODE}}
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
- "386"
changelog:
use: github-native
+9
View File
@@ -0,0 +1,9 @@
version: 2
mkdocs:
configuration: mkdocs.yml
fail_on_warning: false
python:
install:
- requirements: docs/requirements.txt
+2
View File
@@ -0,0 +1,2 @@
# Helmfile Maintainers
* @mumoshu @itscaro @yxxhero @xiaomudk
+3 -3
View File
@@ -4,16 +4,16 @@ By contributing to `helmfile`, you accept and agree to the following DCO and lic
conditions for your present and future Contributions submitted to the `helmfile` project.
[DCO](https://developercertificate.org/)
[License](https://github.com/roboll/helmfile/blob/master/LICENSE)
[License](https://github.com/helmfile/helmfile/blob/master/LICENSE)
# Developing helmfile
Locate your `GOPATH`, usually `~/go`, and run:
```console
$ go get github.com/roboll/helmfile
$ go get github.com/helmfile/helmfile
$ cd $GOPATH/src/github.com/roboll/helmfile
$ cd $GOPATH/src/github.com/helmfile/helmfile
$ git checkout -b your-shiny-new-feature origin/master
+86 -24
View File
@@ -1,44 +1,106 @@
FROM golang:1.13.7-alpine3.11 as builder
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder
RUN apk add --no-cache make git
WORKDIR /workspace/helmfile
COPY go.mod go.sum /workspace/helmfile/
RUN go mod download
COPY . /workspace/helmfile
RUN make static-linux
ARG TARGETARCH TARGETOS
RUN make static-${TARGETOS}-${TARGETARCH}
# -----------------------------------------------------------------------------
FROM alpine:3.11
FROM alpine:3.16
RUN apk add --no-cache ca-certificates git bash curl jq
LABEL org.opencontainers.image.source https://github.com/helmfile/helmfile
ARG HELM_VERSION=v2.16.1
ARG HELM_LOCATION="https://kubernetes-helm.storage.googleapis.com"
ARG HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
ARG HELM_SHA256="7eebaaa2da4734242bbcdced62cc32ba8c7164a18792c8acdf16c77abffce202"
RUN wget ${HELM_LOCATION}/${HELM_FILENAME} && \
RUN apk add --no-cache ca-certificates git bash curl jq openssh-client gnupg
ARG TARGETARCH TARGETOS TARGETPLATFORM
# Set Helm home variables so that also non-root users can use plugins etc.
ARG HOME="/helm"
ENV HOME="${HOME}"
ARG HELM_CACHE_HOME="${HOME}/.cache/helm"
ENV HELM_CACHE_HOME="${HELM_CACHE_HOME}"
ARG HELM_CONFIG_HOME="${HOME}/.config/helm"
ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}"
ARG HELM_DATA_HOME="${HOME}/.local/share/helm"
ENV HELM_DATA_HOME="${HELM_DATA_HOME}"
ARG HELM_VERSION="v3.12.0"
ENV HELM_VERSION="${HELM_VERSION}"
ARG HELM_LOCATION="https://get.helm.sh"
ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \
echo Verifying ${HELM_FILENAME}... && \
sha256sum ${HELM_FILENAME} | grep -q "${HELM_SHA256}" && \
case ${TARGETPLATFORM} in \
"linux/amd64") HELM_SHA256="da36e117d6dbc57c8ec5bab2283222fbd108db86c83389eebe045ad1ef3e2c3b" ;; \
"linux/arm64") HELM_SHA256="658839fed8f9be2169f5df68e55cb2f0aa731a50df454caf183186766800bbd0" ;; \
esac && \
echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \
echo Extracting ${HELM_FILENAME}... && \
tar zxvf ${HELM_FILENAME} && mv /linux-amd64/helm /usr/local/bin/ && \
rm ${HELM_FILENAME} && rm -r /linux-amd64
tar xvf "${HELM_FILENAME}" -C /usr/local/bin --strip-components 1 ${TARGETOS}-${TARGETARCH}/helm && \
rm "${HELM_FILENAME}" && \
[ "$(helm version --template '{{.Version}}')" = "${HELM_VERSION}" ]
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
# for now but in a future version of alpine (in the testing version at the time of writing)
# we should be able to install using apk add.
ENV KUBECTL_VERSION="v1.14.5"
ENV KUBECTL_SHA256="26681319de56820a8467c9407e9203d5b15fb010ffc75ac5b99c9945ad0bd28c"
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
sha256sum kubectl | grep ${KUBECTL_SHA256} && \
ENV KUBECTL_VERSION="v1.25.2"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUBECTL_SHA256="8639f2b9c33d38910d706171ce3d25be9b19fc139d0e3d4627f38ce84f9040eb" ;; \
"linux/arm64") KUBECTL_SHA256="b26aa656194545699471278ad899a90b1ea9408d35f6c65e3a46831b9c063fd5" ;; \
esac && \
echo "${KUBECTL_SHA256} kubectl" | sha256sum -c && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl
mv kubectl /usr/local/bin/kubectl && \
[ "$(kubectl version -o json | jq -r '.clientVersion.gitVersion')" = "${KUBECTL_VERSION}" ]
RUN ["helm", "init", "--client-only"]
RUN helm plugin install https://github.com/databus23/helm-diff && \
helm plugin install https://github.com/futuresimple/helm-secrets && \
helm plugin install https://github.com/hypnoglow/helm-s3.git && \
helm plugin install https://github.com/aslafy-z/helm-git.git && \
helm plugin install https://github.com/rimusz/helm-tiller
ENV KUSTOMIZE_VERSION="v4.5.7"
ARG KUSTOMIZE_FILENAME="kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/${KUSTOMIZE_FILENAME}" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUSTOMIZE_SHA256="701e3c4bfa14e4c520d481fdf7131f902531bfc002cb5062dcf31263a09c70c9" ;; \
"linux/arm64") KUSTOMIZE_SHA256="65665b39297cc73c13918f05bbe8450d17556f0acd16242a339271e14861df67" ;; \
esac && \
echo "${KUSTOMIZE_SHA256} ${KUSTOMIZE_FILENAME}" | sha256sum -c && \
tar xvf "${KUSTOMIZE_FILENAME}" -C /usr/local/bin && \
rm "${KUSTOMIZE_FILENAME}" && \
kustomize version --short | grep "kustomize/${KUSTOMIZE_VERSION}"
COPY --from=builder /workspace/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile
ENV SOPS_VERSION="v3.7.3"
ARG SOPS_FILENAME="sops-${SOPS_VERSION}.${TARGETOS}.${TARGETARCH}"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/${SOPS_FILENAME}" && \
chmod +x "${SOPS_FILENAME}" && \
mv "${SOPS_FILENAME}" /usr/local/bin/sops && \
sops --version | grep -E "^sops ${SOPS_VERSION#v}"
ENV AGE_VERSION="v1.0.0"
ARG AGE_FILENAME="age-${AGE_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/${AGE_FILENAME}" && \
tar xvf "${AGE_FILENAME}" -C /usr/local/bin --strip-components 1 age/age age/age-keygen && \
rm "${AGE_FILENAME}" && \
[ "$(age --version)" = "${AGE_VERSION}" ] && \
[ "$(age-keygen --version)" = "${AGE_VERSION}" ]
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.6.0 && \
helm plugin install https://github.com/jkroepke/helm-secrets --version v4.1.1 && \
helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.14.0 && \
helm plugin install https://github.com/aslafy-z/helm-git.git --version v0.12.0 && \
rm -rf ${HELM_CACHE_HOME}/plugins
# Allow users other than root to use helm plugins located in root home
RUN chmod 751 ${HOME}
COPY --from=builder /workspace/helmfile/dist/helmfile_${TARGETOS}_${TARGETARCH} /usr/local/bin/helmfile
CMD ["/usr/local/bin/helmfile"]
+111
View File
@@ -0,0 +1,111 @@
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder
RUN apk add --no-cache make git
WORKDIR /workspace/helmfile
COPY go.mod go.sum /workspace/helmfile/
RUN go mod download
COPY . /workspace/helmfile
ARG TARGETARCH TARGETOS
RUN make static-${TARGETOS}-${TARGETARCH}
# -----------------------------------------------------------------------------
FROM debian:stable-slim
LABEL org.opencontainers.image.source https://github.com/helmfile/helmfile
RUN apt update -qq && \
apt install --no-install-recommends -y \
ca-certificates \
gnupg \
git bash curl jq wget openssh-client && \
rm -rf /var/lib/apt/lists/*
ARG TARGETARCH TARGETOS TARGETPLATFORM
# Set Helm home variables so that also non-root users can use plugins etc.
ARG HOME="/helm"
ENV HOME="${HOME}"
ARG HELM_CACHE_HOME="${HOME}/.cache/helm"
ENV HELM_CACHE_HOME="${HELM_CACHE_HOME}"
ARG HELM_CONFIG_HOME="${HOME}/.config/helm"
ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}"
ARG HELM_DATA_HOME="${HOME}/.local/share/helm"
ENV HELM_DATA_HOME="${HELM_DATA_HOME}"
ARG HELM_VERSION="v3.12.0"
ENV HELM_VERSION="${HELM_VERSION}"
ARG HELM_LOCATION="https://get.helm.sh"
ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \
echo Verifying ${HELM_FILENAME}... && \
case ${TARGETPLATFORM} in \
"linux/amd64") HELM_SHA256="da36e117d6dbc57c8ec5bab2283222fbd108db86c83389eebe045ad1ef3e2c3b" ;; \
"linux/arm64") HELM_SHA256="658839fed8f9be2169f5df68e55cb2f0aa731a50df454caf183186766800bbd0" ;; \
esac && \
echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \
echo Extracting ${HELM_FILENAME}... && \
tar xvf "${HELM_FILENAME}" -C /usr/local/bin --strip-components 1 ${TARGETOS}-${TARGETARCH}/helm && \
rm "${HELM_FILENAME}" && \
[ "$(helm version --template '{{.Version}}')" = "${HELM_VERSION}" ]
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
# for now but in a future version of alpine (in the testing version at the time of writing)
# we should be able to install using apk add.
ENV KUBECTL_VERSION="v1.25.2"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUBECTL_SHA256="8639f2b9c33d38910d706171ce3d25be9b19fc139d0e3d4627f38ce84f9040eb" ;; \
"linux/arm64") KUBECTL_SHA256="b26aa656194545699471278ad899a90b1ea9408d35f6c65e3a46831b9c063fd5" ;; \
esac && \
echo "${KUBECTL_SHA256} kubectl" | sha256sum -c && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl && \
[ "$(kubectl version -o json | jq -r '.clientVersion.gitVersion')" = "${KUBECTL_VERSION}" ]
ENV KUSTOMIZE_VERSION="v4.5.7"
ARG KUSTOMIZE_FILENAME="kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/${KUSTOMIZE_FILENAME}" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUSTOMIZE_SHA256="701e3c4bfa14e4c520d481fdf7131f902531bfc002cb5062dcf31263a09c70c9" ;; \
"linux/arm64") KUSTOMIZE_SHA256="65665b39297cc73c13918f05bbe8450d17556f0acd16242a339271e14861df67" ;; \
esac && \
echo "${KUSTOMIZE_SHA256} ${KUSTOMIZE_FILENAME}" | sha256sum -c && \
tar xvf "${KUSTOMIZE_FILENAME}" -C /usr/local/bin && \
rm "${KUSTOMIZE_FILENAME}" && \
kustomize version --short | grep "kustomize/${KUSTOMIZE_VERSION}"
ENV SOPS_VERSION="v3.7.3"
ARG SOPS_FILENAME="sops-${SOPS_VERSION}.${TARGETOS}.${TARGETARCH}"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/${SOPS_FILENAME}" && \
chmod +x "${SOPS_FILENAME}" && \
mv "${SOPS_FILENAME}" /usr/local/bin/sops && \
sops --version | grep -E "^sops ${SOPS_VERSION#v}"
ENV AGE_VERSION="v1.0.0"
ARG AGE_FILENAME="age-${AGE_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/${AGE_FILENAME}" && \
tar xvf "${AGE_FILENAME}" -C /usr/local/bin --strip-components 1 age/age age/age-keygen && \
rm "${AGE_FILENAME}" && \
[ "$(age --version)" = "${AGE_VERSION}" ] && \
[ "$(age-keygen --version)" = "${AGE_VERSION}" ]
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.6.0 && \
helm plugin install https://github.com/jkroepke/helm-secrets --version v4.1.1 && \
helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.14.0 && \
helm plugin install https://github.com/aslafy-z/helm-git.git --version v0.12.0 && \
rm -rf ${HELM_CACHE_HOME}/plugins
# Allow users other than root to use helm plugins located in root home
RUN chmod 751 ${HOME}
COPY --from=builder /workspace/helmfile/dist/helmfile_${TARGETOS}_${TARGETARCH} /usr/local/bin/helmfile
CMD ["/usr/local/bin/helmfile"]
-42
View File
@@ -1,42 +0,0 @@
FROM golang:1.13.7-alpine3.11 as builder
RUN apk add --no-cache make git
WORKDIR /workspace/helmfile
COPY . /workspace/helmfile
RUN make static-linux
# -----------------------------------------------------------------------------
FROM alpine:3.11
RUN apk add --no-cache ca-certificates git bash curl jq
ARG HELM_VERSION=v3.1.0
ARG HELM_LOCATION="https://get.helm.sh"
ARG HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
ARG HELM_SHA256="f0fd9fe2b0e09dc9ed190239fce892a468cbb0a2a8fffb9fe846f893c8fd09de"
RUN wget ${HELM_LOCATION}/${HELM_FILENAME} && \
echo Verifying ${HELM_FILENAME}... && \
sha256sum ${HELM_FILENAME} | grep -q "${HELM_SHA256}" && \
echo Extracting ${HELM_FILENAME}... && \
tar zxvf ${HELM_FILENAME} && mv /linux-amd64/helm /usr/local/bin/ && \
rm ${HELM_FILENAME} && rm -r /linux-amd64
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
# for now but in a future version of alpine (in the testing version at the time of writing)
# we should be able to install using apk add.
ENV KUBECTL_VERSION="v1.14.5"
ENV KUBECTL_SHA256="26681319de56820a8467c9407e9203d5b15fb010ffc75ac5b99c9945ad0bd28c"
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
sha256sum kubectl | grep ${KUBECTL_SHA256} && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.0.0-rc.7 && \
helm plugin install https://github.com/futuresimple/helm-secrets && \
helm plugin install https://github.com/hypnoglow/helm-s3.git && \
helm plugin install https://github.com/aslafy-z/helm-git.git
COPY --from=builder /workspace/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile
CMD ["/usr/local/bin/helmfile"]
+111
View File
@@ -0,0 +1,111 @@
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder
RUN apk add --no-cache make git
WORKDIR /workspace/helmfile
COPY go.mod go.sum /workspace/helmfile/
RUN go mod download
COPY . /workspace/helmfile
ARG TARGETARCH TARGETOS
RUN make static-${TARGETOS}-${TARGETARCH}
# -----------------------------------------------------------------------------
FROM ubuntu:20.04
LABEL org.opencontainers.image.source https://github.com/helmfile/helmfile
RUN apt update -qq && \
apt install --no-install-recommends -y \
ca-certificates \
gnupg \
git bash curl jq wget openssh-client && \
rm -rf /var/lib/apt/lists/*
ARG TARGETARCH TARGETOS TARGETPLATFORM
# Set Helm home variables so that also non-root users can use plugins etc.
ARG HOME="/helm"
ENV HOME="${HOME}"
ARG HELM_CACHE_HOME="${HOME}/.cache/helm"
ENV HELM_CACHE_HOME="${HELM_CACHE_HOME}"
ARG HELM_CONFIG_HOME="${HOME}/.config/helm"
ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}"
ARG HELM_DATA_HOME="${HOME}/.local/share/helm"
ENV HELM_DATA_HOME="${HELM_DATA_HOME}"
ARG HELM_VERSION="v3.12.0"
ENV HELM_VERSION="${HELM_VERSION}"
ARG HELM_LOCATION="https://get.helm.sh"
ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \
echo Verifying ${HELM_FILENAME}... && \
case ${TARGETPLATFORM} in \
"linux/amd64") HELM_SHA256="da36e117d6dbc57c8ec5bab2283222fbd108db86c83389eebe045ad1ef3e2c3b" ;; \
"linux/arm64") HELM_SHA256="658839fed8f9be2169f5df68e55cb2f0aa731a50df454caf183186766800bbd0" ;; \
esac && \
echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \
echo Extracting ${HELM_FILENAME}... && \
tar xvf "${HELM_FILENAME}" -C /usr/local/bin --strip-components 1 ${TARGETOS}-${TARGETARCH}/helm && \
rm "${HELM_FILENAME}" && \
[ "$(helm version --template '{{.Version}}')" = "${HELM_VERSION}" ]
# using the install documentation found at https://kubernetes.io/docs/tasks/tools/install-kubectl/
# for now but in a future version of alpine (in the testing version at the time of writing)
# we should be able to install using apk add.
ENV KUBECTL_VERSION="v1.25.2"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUBECTL_SHA256="8639f2b9c33d38910d706171ce3d25be9b19fc139d0e3d4627f38ce84f9040eb" ;; \
"linux/arm64") KUBECTL_SHA256="b26aa656194545699471278ad899a90b1ea9408d35f6c65e3a46831b9c063fd5" ;; \
esac && \
echo "${KUBECTL_SHA256} kubectl" | sha256sum -c && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl && \
[ "$(kubectl version -o json | jq -r '.clientVersion.gitVersion')" = "${KUBECTL_VERSION}" ]
ENV KUSTOMIZE_VERSION="v4.5.7"
ARG KUSTOMIZE_FILENAME="kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/${KUSTOMIZE_FILENAME}" && \
case ${TARGETPLATFORM} in \
"linux/amd64") KUSTOMIZE_SHA256="701e3c4bfa14e4c520d481fdf7131f902531bfc002cb5062dcf31263a09c70c9" ;; \
"linux/arm64") KUSTOMIZE_SHA256="65665b39297cc73c13918f05bbe8450d17556f0acd16242a339271e14861df67" ;; \
esac && \
echo "${KUSTOMIZE_SHA256} ${KUSTOMIZE_FILENAME}" | sha256sum -c && \
tar xvf "${KUSTOMIZE_FILENAME}" -C /usr/local/bin && \
rm "${KUSTOMIZE_FILENAME}" && \
kustomize version --short | grep "kustomize/${KUSTOMIZE_VERSION}"
ENV SOPS_VERSION="v3.7.3"
ARG SOPS_FILENAME="sops-${SOPS_VERSION}.${TARGETOS}.${TARGETARCH}"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/${SOPS_FILENAME}" && \
chmod +x "${SOPS_FILENAME}" && \
mv "${SOPS_FILENAME}" /usr/local/bin/sops && \
sops --version | grep -E "^sops ${SOPS_VERSION#v}"
ENV AGE_VERSION="v1.0.0"
ARG AGE_FILENAME="age-${AGE_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN set -x && \
curl --retry 5 --retry-connrefused -LO "https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/${AGE_FILENAME}" && \
tar xvf "${AGE_FILENAME}" -C /usr/local/bin --strip-components 1 age/age age/age-keygen && \
rm "${AGE_FILENAME}" && \
[ "$(age --version)" = "${AGE_VERSION}" ] && \
[ "$(age-keygen --version)" = "${AGE_VERSION}" ]
RUN helm plugin install https://github.com/databus23/helm-diff --version v3.6.0 && \
helm plugin install https://github.com/jkroepke/helm-secrets --version v4.1.1 && \
helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.14.0 && \
helm plugin install https://github.com/aslafy-z/helm-git.git --version v0.12.0 && \
rm -rf ${HELM_CACHE_HOME}/plugins
# Allow users other than root to use helm plugins located in root home
RUN chmod 751 ${HOME}
COPY --from=builder /workspace/helmfile/dist/helmfile_${TARGETOS}_${TARGETARCH} /usr/local/bin/helmfile
CMD ["/usr/local/bin/helmfile"]
+58 -15
View File
@@ -1,40 +1,88 @@
ORG ?= $(shell basename $(realpath ..))
PKGS := $(shell go list ./... | grep -v /vendor/)
TAG ?= $(shell git describe --tags --abbrev=0 HEAD)
LAST = $(shell git describe --tags --abbrev=0 HEAD^)
BODY = "`git log ${LAST}..HEAD --oneline --decorate` `printf '\n\#\#\# [Build Info](${BUILD_URL})'`"
DATE_FMT = +"%Y-%m-%dT%H:%M:%S%z"
ifdef SOURCE_DATE_EPOCH
BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
else
BUILD_DATE ?= $(shell date "$(DATE_FMT)")
endif
# The ldflags for the Go build process to set the version related data
GO_BUILD_VERSION_LDFLAGS=\
-X go.szostok.io/version.version=$(TAG) \
-X go.szostok.io/version.buildDate=$(BUILD_DATE) \
-X go.szostok.io/version.commit=$(shell git rev-parse --short HEAD) \
-X go.szostok.io/version.commitDate=$(shell git log -1 --date=format:"%Y-%m-%dT%H:%M:%S%z" --format=%cd) \
-X go.szostok.io/version.dirtyBuild=false
build:
go build ${TARGETS}
go build -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: build
build-v1:
go build -ldflags="$(GO_BUILD_VERSION_LDFLAGS) -X github.com/helmfile/helmfile/pkg/runtime.v1Mode=true" ${TARGETS}
.PHONY: build-v1
generate:
go generate ${PKGS}
.PHONY: generate
fmt:
go fmt ${PKGS}
gci write --skip-generated -s standard -s default -s 'prefix(github.com/helmfile/helmfile)' .
.PHONY: fmt
check:
go vet ${PKGS}
.PHONY: check
build-test-tools:
go build test/diff-yamls/diff-yamls.go
curl --progress-bar --location https://github.com/homeport/dyff/releases/download/v1.5.6/dyff_1.5.6_linux_amd64.tar.gz | tar -xzf - -C `pwd` dyff
.PHONY: build-test-tools
test:
go test -v ${PKGS} -cover -race -p=1
@which helm &> /dev/null || (echo "helm binary not found. Please see: https://helm.sh/docs/intro/install/" && exit 1)
go build -o helmfile .
go test -v ${PKGS} -coverprofile cover.out -race -p=1
go tool cover -func cover.out
.PHONY: test
integration:
bash test/integration/run.sh
.PHONY: integration
integration/vagrant:
$(MAKE) build GOOS=linux GOARCH=amd64
$(MAKE) build-test-tools GOOS=linux GOARCH=amd64
vagrant up
vagrant ssh -c 'HELMFILE_HELM3=1 make -C /vagrant integration'
.PHONY: integration/vagrant
cross:
env CGO_ENABLED=0 gox -os '!openbsd !freebsd !netbsd' -arch '!arm !mips !mipsle !mips64 !mips64le !s390x' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X github.com/roboll/helmfile/pkg/app/version.Version=${TAG}' ${TARGETS}
env CGO_ENABLED=0 gox -parallel 4 -os 'windows darwin linux' -arch '386 amd64 arm64' -osarch '!darwin/386' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: cross
static-linux:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build -o "dist/helmfile_linux_amd64" -ldflags '-X github.com/roboll/helmfile/pkg/app/version.Version=${TAG}' ${TARGETS}
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOFLAGS=-mod=readonly go build -o "dist/helmfile_linux_amd64" -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: static-linux
static-linux-amd64:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOFLAGS=-mod=readonly go build -o "dist/helmfile_linux_amd64" -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: static-linux-amd64
static-linux-arm64:
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOFLAGS=-mod=readonly go build -o "dist/helmfile_linux_arm64" -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: static-linux-arm64
install:
env CGO_ENABLED=0 go install -ldflags '-X github.com/roboll/helmfile/pkg/app/version.Version=${TAG}' ${TARGETS}
env CGO_ENABLED=0 go install -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS}
.PHONY: install
clean:
@@ -47,7 +95,7 @@ pristine: generate fmt
.PHONY: pristine
release: pristine cross
@ghr -b ${BODY} -t ${GITHUB_TOKEN} -u ${ORG} -recreate ${TAG} dist
@ghr -b ${BODY} -t ${GITHUB_TOKEN} -u ${ORG} ${TAG} dist
.PHONY: release
image:
@@ -59,21 +107,16 @@ run: image
push: image
docker push quay.io/${ORG}/helmfile:${TAG}
image/debian:
docker build -f Dockerfile.debian -t quay.io/${ORG}/helmfile:${TAG}-stable-slim .
image/helm3:
docker build -f Dockerfile.helm3 -t quay.io/${ORG}/helmfile:helm3-${TAG} .
push/helm3: image/helm3
docker push quay.io/${ORG}/helmfile:helm3-${TAG}
push/debian: image/debian
docker push quay.io/${ORG}/helmfile:${TAG}-stable-slim
tools:
go get -u github.com/tcnksm/ghr github.com/mitchellh/gox
.PHONY: tools
TAG = $(shell git describe --tags --abbrev=0 HEAD)
LAST = $(shell git describe --tags --abbrev=0 HEAD^)
BODY = "`git log ${LAST}..HEAD --oneline --decorate` `printf '\n\#\#\# [Build Info](${BUILD_URL})'`"
release/minor:
git checkout master
git pull --rebase origin master
+116
View File
@@ -0,0 +1,116 @@
<!-- markdownlint-configure-file {
"MD013": {
"code_blocks": false,
"tables": false
},
"MD033": false,
"MD041": false
} -->
<div align="center" markdown="1">
# Helmfile
[![Tests](https://github.com/helmfile/helmfile/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/helmfile/helmfile/actions/workflows/ci.yaml?query=branch%3Amain)
[![Container Image Repository on GHCR](https://ghcr-badge.deta.dev/helmfile/helmfile/latest_tag?trim=major&label=latest "Docker Repository on ghcr")](https://github.com/helmfile/helmfile/pkgs/container/helmfile)
[![Go Report Card](https://goreportcard.com/badge/github.com/helmfile/helmfile)](https://goreportcard.com/report/github.com/helmfile/helmfile)
[![Slack Community #helmfile](https://slack.sweetops.com/badge.svg)](https://slack.sweetops.com)
[![Documentation](https://readthedocs.org/projects/helmfile/badge/?version=latest&style=flat)](https://helmfile.readthedocs.io/en/latest/)
声明式Helm Chart管理工具
<br />
</div>
[English](./README.md) | [简体中文]
# 关于
Helmfile 是一个声明式Helm Chart管理工具
> Helmfile 项目已经从原仓库 roboll/helmfile 转移到了 helmfile/helmfile。有关更多信息,请参见 roboll/helmfile#1824
## 特性
- 通过一个YAML集中管理集群中多个Helm Chart, 类似于Docker Compose统一管理Docker
- 对Helm Chart根据部署环境区分管理
- Helm Chart版本控制,比如指定版本范围、锁定某一版本
- 快速识别 Kubernetes 集群内已经部署应用与新更改之间的差异
- Helmfile支持Go Templates语法定义Helm Chart
- 在部署阶段支持配置hook,可以执行脚本等,实现变量远程获取,报错清理,成功提醒等
## 安装
**方式1: 二进制安装**
下载 [releases](https://github.com/helmfile/helmfile/releases)
**方式2: 包管理工具**
* Archlinux: `pacman -S helmfile`
* openSUSE: `zypper in helmfile`
* Windows: ([scoop](https://scoop.sh/)): `scoop install helmfile`
* macOS ([homebrew](https://brew.sh/)): `brew install helmfile`
**方式3: 容器**
详细见:[run as a container](https://helmfile.readthedocs.io/en/latest/#running-as-a-container)
> 安装后请运行一次 `helmfile init`。 检查[helm-diff](https://github.com/databus23/helm-diff) 等插件安装正确。
## 使用
让我们从最简单的 helmfile 开始,逐渐改进它以适应您的用例!
假设表示您 helm releases 的期望状态的 helmfile.yaml 看起来像这样:
```yaml
repositories:
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
releases:
- name: prom-norbac-ubuntu
namespace: prometheus
chart: prometheus-community/prometheus
set:
- name: rbac.create
value: false
```
通过运行来同步您的Kubernetes集群状态到期望状态:
```console
helmfile apply
```
恭喜!您现在已经在集群内部运行了第一个Prometheus部署。
## 文档
[Documentation](https://helmfile.readthedocs.io/)
## 参与贡献
欢迎贡献! 让我们一起使helmfile变得更好:[贡献指南](https://helmfile.readthedocs.io/en/latest/contributing/)
## 使用者
Helmfile 已经被许多用户在生产环境中使用:
* [gitlab.com](https://gitlab.com)
* [reddit.com](https://reddit.com)
* [Jenkins](https://jenkins.io)
* ...
更多用户请参见: [Users](https://helmfile.readthedocs.io/en/latest/users/)
## License
[MIT](https://github.com/helmfile/helmfile/blob/main/LICENSE)
+71 -1018
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
# Security Policy
## Sponsoring the project
This project is maintained by a small team of four and therefore lacks the resource to provide security fixes in a very timely manner.
That said, even though we are very passionate about making Helmfile rock solid security wise, all issues are handled on the best effort basis.
If you have important business(es) that relies on this project, please consider sponsoring the maintainers, so that they can commit more on providing such service.
> *Note* that we don't currently have project-wide sponsorship enabled as we don't know how to share the amount of sponsorships with fairness.
> Please sponsor individuals instead! Thanks for your understanding.
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 0.144.0 | :white_check_mark: |
| < 0.144.0| :x: |
## Reporting a Vulnerability
To report a security issue, please email helmfile-security@googlegroups.com with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue.
A maintainer will try to respond within 5 working days. If the issue is confirmed as a vulnerability, a Security Advisory will be opened. This project currently tries to follow a 90 day disclosure timeline.
+19 -2
View File
@@ -10,13 +10,30 @@ information to this file.
| Organization | Workload | More Info | Location | Added |
|---|---|---|---|---|
| [reddit.com](https://www.reddit.com/) | production | [GitHub issue](https://github.com/roboll/helmfile/issues/96#issue-312012249), [Talk](https://www.slideshare.net/GregoryTaylor11/helm-at-reddit-from-local-dev-staging-to-production) | San Francisco, CA | April 2018 |
| [gitlab.com](https://gitlab.com/) | production | [Gitlab Project](https://gitlab.com/gitlab-com/gl-infra/k8s-workloads/gitlab-com/-/tree/master) | * | August 2022 |
| [ricardo.ch](https://www.ricardo.ch/) | production | We're deploying our complete application platform using Helmfile. | Zug, Switzerland | April 2018 |
| [Hellofresh](https://engineering.hellofresh.com/) | production | We've been using helmfile in production since April 2018 for deploying all our infrastructure applications | Berlin, Germany | April 2018 |
| [Cherre](https://cherre.com/) | production | We have no public posts about using Helmfile, but we have been using it for a long time now | New York, NY | October 2018 |
| [Sight Machine](https://sightmachine.com/) | production | We don't have anything publicly posted about it, but have been using it for quite a while in production. | San Francisco, CA and Ann Arbor, MI | December 2018 |
| [TailorMed](https://tailormed.co/) | production | We're deploying all of our platform and all K8s resources using Helmfile. The power of Helmfile are more then amazing. Thank you! | Tel-Aviv, Israel | September 2020 |
| [VSHN – The DevOps Company](https://vshn.ch) | production | | Zurich, Switzerland | March 2019 |
| [Vlocity](https://vlocity.com/) | proof-of-concept | | Melbourne, Australia | March 2019 |
| [transit](https://transit.app/) | production | [Blog post](https://medium.com/@naseem_60378/helmfile-its-like-a-helm-for-your-helm-74a908581599). | Montreal, Canada | March 2019 |
| [uniqkey](https://uniqkey.eu/) | production | [Wiki Page](https://ocd-scm.github.io/ocd-meta/) | Copenhagen, Denmark | April 2019 |
| [bitsofinfo](https://github.com/bitsofinfo/helmfile-deploy) | production | Used with [helmfile-deploy](https://github.com/bitsofinfo/helmfile-deploy) to manage releases for dozens of apps | USA | July 2019 |
| [kloeckner-i](https://www.kloeckner-i.com/) | production | We are deploying our standard tools via helmfile to all our clusters. | Berlin, Germany | September 2019 |
| [American Express](https://www.americanexpress.com) | proof-of-concept | Orchestration of both internal cluster workloads and local developer environments. | London, GB | January 2020 |
| [kloeckner-i](https://www.kloeckner-i.com/) | production | We are deploying our standard tools via helmfile to all our clusters. | Berlin, Germany | September 2019 |
| [American Express](https://www.americanexpress.com) | proof-of-concept | Orchestration of both internal cluster workloads and local developer environments. | London, GB | January 2020 |
| [Sportradar](https://www.sportradar.com) | production | Since mid-2019, we've been deploying our core infrastructure and several application stacks with Helmfile. | St. Gallen, Switzerland | March 2020 |
| [PedidosYa](https://www.pedidosya.com) | production | | Montevideo, Uruguay | June 2020 |
| [Jenkins](https://jenkins.io) | production | [jenkins-infra/kubernetes-management](https://github.com/jenkins-infra/kubernetes-management) | * | July 2020 |
| [SettleMint](https://settlemint.com) | production | The SettleMint platform allows enterprises to spin up k8s clusters and deploy production grade blockchain networks and additional services. Helmfile is in charge of deploying these networks and services on demand out of the self service management ui. | Belgium, Singapore, UAE, India | October 2020 |
| [AutoTrader (UK)](https://www.autotrader.co.uk) | production | We've used Helmfile for 2+ years to deploy 400+ services | UK | October 2020 |
| [Trend Micro](https://www.trendmicro.com) | production | We manage 9 k8s clusters in a mono git repository with Helmfile | Taipei, Taiwan | December 2019 |
| [William Hill](https://www.williamhill.com) | production | We have standardised on Helmfile for managing both our application services and our Kubernetes platform components. | International | March 2021 |
| [The Hyve](https://www.thehyve.nl) | production | We've been using Helmfile since 2019 to deploy [Radar-base applications](https://github.com/RADAR-base/RADAR-Kubernetes). [Blog Post](https://www.thehyve.nl/articles/kubernetes-added-to-radar-base) | Utrecht, Netherlands | April 2021 |
| [IKEA US](https://www.ikea.com) | production | We started using Helmfile this year to shrink the boilerplate involved in deploying or microservices to cloud Kubernetes clusters. | Utrecht, Netherlands | April 2021 |
| [ShareGate](https://www.sharegate.com) | production | Used to deploy and sync our kubernetes workloads in Azure, using Azure Pipelines and custom extensions to [install](https://marketplace.visualstudio.com/items?itemName=GSoft.HelmfileInstaller) and [execute](https://marketplace.visualstudio.com/items?itemName=GSoft.HelmfileRunner) the cli. | Montreal, Canada | June 2021 |
| [subshell](https://subshell.com) | production | We're using helmfile since 2021 to deploy all our Kubernetes workloads into our clusters. We love helmfile for its simplicity and power. Thank you! | Hamburg, Germany | August 2022 |
| [Norddeutscher Rundfunk](https://www.ndr.de) | production | Using Helmfile since 2020 to deploy workloads to several similar clusters (dev, qa, prod, test, etc.) for sites tagesschau.de and sportschau.de. Thank you so much for your awesome work! | Hamburg, Germany | August 2022 |
| [Dealhub](https://dealhub.io/) | production | Helmfile was an essential part of our k8s migration. Keep up the good work! | Holon, Israel | January 2023 |
<!-- TABLE_END -->
Vendored
+19
View File
@@ -0,0 +1,19 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.hostname = "minikube.box"
config.vm.provision :shell, privileged: false,
inline: <<-EOS
set -e
sudo apt-get update
sudo apt-get install -y make docker.io
sudo systemctl start docker
sudo usermod -G docker $USER
cd /vagrant/.circleci
make all
EOS
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
end
+71
View File
@@ -0,0 +1,71 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/runtime"
)
// NewApplyCmd returns apply subcmd
func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
applyOptions := &config.ApplyOptions{}
cmd := &cobra.Command{
Use: "apply",
Short: "Apply all resources from state file only when there are changes",
RunE: func(cmd *cobra.Command, args []string) error {
applyImpl := config.NewApplyImpl(globalCfg, applyOptions)
err := config.NewCLIConfigImpl(applyImpl.GlobalImpl)
if err != nil {
return err
}
if err := applyImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(applyImpl)
return toCLIError(applyImpl.GlobalImpl, a.Apply(applyImpl))
},
}
f := cmd.Flags()
f.StringArrayVar(&applyOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&applyOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.IntVar(&applyOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&applyOptions.Validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. Note that this requires access to a Kubernetes cluster to obtain information necessary for validating, like the list of available API versions")
f.IntVar(&applyOptions.Context, "context", 0, "output NUM lines of context around changes")
f.StringVar(&applyOptions.Output, "output", "", "output format for diff plugin")
f.BoolVar(&applyOptions.DetailedExitcode, "detailed-exitcode", false, "return a non-zero exit code 2 instead of 0 when there were changes detected AND the changes are synced successfully")
f.BoolVar(&applyOptions.StripTrailingCR, "strip-trailing-cr", false, "strip trailing carriage return on input")
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
if !runtime.V1Mode {
// TODO: Remove this function once Helmfile v0.x
f.BoolVar(&applyOptions.RetainValuesFiles, "retain-values-files", false, "DEPRECATED: Use skip-cleanup instead")
_ = f.MarkDeprecated("retain-values-files", "Use skip-cleanup instead")
}
f.BoolVar(&applyOptions.SkipCleanup, "skip-cleanup", false, "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security")
f.BoolVar(&applyOptions.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present")
f.BoolVar(&applyOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
f.BoolVar(&applyOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided`)
f.BoolVar(&applyOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
f.BoolVar(&applyOptions.SkipDiffOnInstall, "skip-diff-on-install", false, "Skips running helm-diff on releases being newly installed on this apply. Useful when the release manifests are too huge to be reviewed, or it's too time-consuming to diff at all")
f.BoolVar(&applyOptions.IncludeTests, "include-tests", false, "enable the diffing of the helm test hooks")
f.StringArrayVar(&applyOptions.Suppress, "suppress", nil, "suppress specified Kubernetes objects in the diff output. Can be provided multiple times. For example: --suppress KeycloakClient --suppress VaultSecret")
f.BoolVar(&applyOptions.SuppressSecrets, "suppress-secrets", false, "suppress secrets in the diff output. highly recommended to specify on CI/CD use-cases")
f.BoolVar(&applyOptions.ShowSecrets, "show-secrets", false, "do not redact secret values in the diff output. should be used for debug purpose only")
f.BoolVar(&applyOptions.NoHooks, "no-hooks", false, "do not diff changes made by hooks.")
f.BoolVar(&applyOptions.SuppressDiff, "suppress-diff", false, "suppress diff in the output. Usable in new installs")
f.BoolVar(&applyOptions.Wait, "wait", false, `Override helmDefaults.wait setting "helm upgrade --install --wait"`)
f.BoolVar(&applyOptions.WaitForJobs, "wait-for-jobs", false, `Override helmDefaults.waitForJobs setting "helm upgrade --install --wait-for-jobs"`)
f.BoolVar(&applyOptions.ReuseValues, "reuse-values", false, `Override helmDefaults.reuseValues "helm upgrade --install --reuse-values"`)
f.BoolVar(&applyOptions.ResetValues, "reset-values", false, `Override helmDefaults.reuseValues "helm upgrade --install --reset-values"`)
f.StringVar(&applyOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`)
f.StringVar(&applyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
return cmd
}
+37
View File
@@ -0,0 +1,37 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewBuildCmd returns build subcmd
func NewBuildCmd(globalCfg *config.GlobalImpl) *cobra.Command {
buildOptions := config.NewBuildOptions()
cmd := &cobra.Command{
Use: "build",
Short: "Build all resources from state file",
RunE: func(cmd *cobra.Command, args []string) error {
buildImpl := config.NewBuildImpl(globalCfg, buildOptions)
err := config.NewCLIConfigImpl(buildImpl.GlobalImpl)
if err != nil {
return err
}
if err := buildImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(buildImpl)
return toCLIError(buildImpl.GlobalImpl, a.PrintState(buildImpl))
},
}
f := cmd.Flags()
f.BoolVar(&buildOptions.EmbedValues, "embed-values", false, "Read all the values files for every release and embed into the output helmfile.yaml")
return cmd
}
+69
View File
@@ -0,0 +1,69 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
func NewCacheInfoSubcommand(cacheImpl *config.CacheImpl) *cobra.Command {
cmd := &cobra.Command{
Use: "info",
Short: "cache info",
RunE: func(cmd *cobra.Command, args []string) error {
err := config.NewCLIConfigImpl(cacheImpl.GlobalImpl)
if err != nil {
return err
}
if err := cacheImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(cacheImpl)
return toCLIError(cacheImpl.GlobalImpl, a.ShowCacheDir(cacheImpl))
},
}
return cmd
}
func NewCacheCleanupSubcommand(cacheImpl *config.CacheImpl) *cobra.Command {
cmd := &cobra.Command{
Use: "cleanup",
Short: "clean up cache directory",
RunE: func(cmd *cobra.Command, args []string) error {
err := config.NewCLIConfigImpl(cacheImpl.GlobalImpl)
if err != nil {
return err
}
if err := cacheImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(cacheImpl)
return toCLIError(cacheImpl.GlobalImpl, a.CleanCacheDir(cacheImpl))
},
}
return cmd
}
// NewCacheCmd returns cache subcmd
func NewCacheCmd(globalCfg *config.GlobalImpl) *cobra.Command {
cacheOptions := config.NewCacheOptions()
cacheImpl := config.NewCacheImpl(globalCfg, cacheOptions)
cmd := &cobra.Command{
Use: "cache",
Short: "Cache management",
}
cmd.AddCommand(
NewCacheCleanupSubcommand(cacheImpl),
NewCacheInfoSubcommand(cacheImpl),
)
return cmd
}
+41
View File
@@ -0,0 +1,41 @@
// TODO: Remove this function once Helmfile v0.x
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewChartsCmd returns charts subcmd
func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
chartsOptions := config.NewChartsOptions()
cmd := &cobra.Command{
Use: "charts",
Short: "DEPRECATED: sync releases from state file (helm upgrade --install)",
RunE: func(cmd *cobra.Command, args []string) error {
chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions)
err := config.NewCLIConfigImpl(chartsImpl.GlobalImpl)
if err != nil {
return err
}
if err := chartsImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(chartsImpl)
return toCLIError(chartsImpl.GlobalImpl, a.DeprecatedSyncCharts(chartsImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.StringArrayVar(&chartsOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&chartsOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.IntVar(&chartsOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
return cmd
}
+42
View File
@@ -0,0 +1,42 @@
// TODO: Remove this function once Helmfile v0.x
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewDeleteCmd returns delete subcmd
func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {
deleteOptions := config.NewDeleteOptions()
cmd := &cobra.Command{
Use: "delete",
Short: "DEPRECATED: delete releases from state file (helm delete)",
RunE: func(cmd *cobra.Command, args []string) error {
deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)
err := config.NewCLIConfigImpl(deleteImpl.GlobalImpl)
if err != nil {
return err
}
if err := deleteImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(deleteImpl)
return toCLIError(deleteImpl.GlobalImpl, a.Delete(deleteImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.StringVar(&deleteOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
f.IntVar(&deleteOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&deleteOptions.Purge, "purge", false, "purge releases i.e. free release names and histories")
f.BoolVar(&deleteOptions.SkipCharts, "skip-charts", false, "don't prepare charts when deleting releases")
return cmd
}
+39
View File
@@ -0,0 +1,39 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewDepsCmd returns deps subcmd
func NewDepsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
depsOptions := config.NewDepsOptions()
cmd := &cobra.Command{
Use: "deps",
Short: "Update charts based on their requirements",
RunE: func(cmd *cobra.Command, args []string) error {
depsImpl := config.NewDepsImpl(globalCfg, depsOptions)
err := config.NewCLIConfigImpl(depsImpl.GlobalImpl)
if err != nil {
return err
}
if err := depsImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(depsImpl)
return toCLIError(depsImpl.GlobalImpl, a.Deps(depsImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.BoolVar(&depsOptions.SkipRepos, "skip-repos", false, `skip running "helm repo update" and "helm dependency build"`)
f.IntVar(&depsOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
return cmd
}
+40
View File
@@ -0,0 +1,40 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewDestroyCmd returns destroy subcmd
func NewDestroyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
destroyOptions := config.NewDestroyOptions()
cmd := &cobra.Command{
Use: "destroy",
Short: "Destroys and then purges releases",
RunE: func(cmd *cobra.Command, args []string) error {
destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions)
err := config.NewCLIConfigImpl(destroyImpl.GlobalImpl)
if err != nil {
return err
}
if err := destroyImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(destroyImpl)
return toCLIError(destroyImpl.GlobalImpl, a.Destroy(destroyImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.StringVar(&destroyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
f.IntVar(&destroyOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&destroyOptions.SkipCharts, "skip-charts", false, "don't prepare charts when destroying releases")
return cmd
}
+57
View File
@@ -0,0 +1,57 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewDiffCmd returns diff subcmd
func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command {
diffOptions := config.NewDiffOptions()
cmd := &cobra.Command{
Use: "diff",
Short: "Diff releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
diffImpl := config.NewDiffImpl(globalCfg, diffOptions)
err := config.NewCLIConfigImpl(diffImpl.GlobalImpl)
if err != nil {
return err
}
if err := diffImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(diffImpl)
return toCLIError(diffImpl.GlobalImpl, a.Diff(diffImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm diff")
f.StringArrayVar(&diffOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&diffOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.IntVar(&diffOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&diffOptions.Validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. Note that this requires access to a Kubernetes cluster to obtain information necessary for validating, like the diff of available API versions")
f.BoolVar(&diffOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
f.BoolVar(&diffOptions.IncludeTests, "include-tests", false, "enable the diffing of the helm test hooks")
f.BoolVar(&diffOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided`)
f.BoolVar(&diffOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
f.BoolVar(&diffOptions.SkipDiffOnInstall, "skip-diff-on-install", false, "Skips running helm-diff on releases being newly installed on this apply. Useful when the release manifests are too huge to be reviewed, or it's too time-consuming to diff at all")
f.BoolVar(&diffOptions.ShowSecrets, "show-secrets", false, "do not redact secret values in the output. should be used for debug purpose only")
f.BoolVar(&diffOptions.NoHooks, "no-hooks", false, "do not diff changes made by hooks.")
f.BoolVar(&diffOptions.DetailedExitcode, "detailed-exitcode", false, "return a detailed exit code")
f.BoolVar(&diffOptions.StripTrailingCR, "strip-trailing-cr", false, "strip trailing carriage return on input")
f.IntVar(&diffOptions.Context, "context", 0, "output NUM lines of context around changes")
f.StringVar(&diffOptions.Output, "output", "", "output format for diff plugin")
f.BoolVar(&diffOptions.SuppressSecrets, "suppress-secrets", false, "suppress secrets in the output. highly recommended to specify on CI/CD use-cases")
f.StringArrayVar(&diffOptions.Suppress, "suppress", nil, "suppress specified Kubernetes objects in the output. Can be provided multiple times. For example: --suppress KeycloakClient --suppress VaultSecret")
f.BoolVar(&diffOptions.ReuseValues, "reuse-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reuse-values"`)
f.BoolVar(&diffOptions.ResetValues, "reset-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reset-values"`)
f.StringVar(&diffOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`)
return cmd
}
+40
View File
@@ -0,0 +1,40 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/state"
)
// NewFetchCmd returns fetch subcmd
func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command {
fetchOptions := config.NewFetchOptions()
cmd := &cobra.Command{
Use: "fetch",
Short: "Fetch charts from state file",
RunE: func(cmd *cobra.Command, args []string) error {
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
err := config.NewCLIConfigImpl(fetchImpl.GlobalImpl)
if err != nil {
return err
}
if err := fetchImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(fetchImpl)
return toCLIError(fetchImpl.GlobalImpl, a.Fetch(fetchImpl))
},
}
f := cmd.Flags()
f.IntVar(&fetchOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.StringVar(&fetchOptions.OutputDir, "output-dir", "", "directory to store charts (default: temporary directory which is deleted when the command terminates)")
f.StringVar(&fetchOptions.OutputDirTemplate, "output-dir-template", state.DefaultFetchOutputDirTemplate, "go text template for generating the output directory")
return cmd
}
+35
View File
@@ -0,0 +1,35 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewInitCmd helmfile checks and installs deps
func NewInitCmd(globalCfg *config.GlobalImpl) *cobra.Command {
options := config.NewInitOptions()
cmd := &cobra.Command{
Use: "init",
Short: "Initialize the helmfile, includes version checking and installation of helm and plug-ins",
RunE: func(cmd *cobra.Command, args []string) error {
initImpl := config.NewInitImpl(globalCfg, options)
err := config.NewCLIConfigImpl(initImpl.GlobalImpl)
if err != nil {
return err
}
if err := initImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(initImpl)
return toCLIError(initImpl.GlobalImpl, a.Init(initImpl))
},
}
f := cmd.Flags()
f.BoolVar(&options.Force, "force", false, "Do not prompt, install dependencies required by helmfile")
return cmd
}
+43
View File
@@ -0,0 +1,43 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewLintCmd returns lint subcmd
func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command {
lintOptions := config.NewLintOptions()
cmd := &cobra.Command{
Use: "lint",
Short: "Lint charts from state file (helm lint)",
RunE: func(cmd *cobra.Command, args []string) error {
lintImpl := config.NewLintImpl(globalCfg, lintOptions)
err := config.NewCLIConfigImpl(lintImpl.GlobalImpl)
if err != nil {
return err
}
if err := lintImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(lintImpl)
return toCLIError(lintImpl.GlobalImpl, a.Lint(lintImpl))
},
}
f := cmd.Flags()
f.IntVar(&lintOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.StringArrayVar(&lintOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&lintOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.BoolVar(&lintOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
f.BoolVar(&lintOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided`)
f.BoolVar(&lintOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
return cmd
}
+39
View File
@@ -0,0 +1,39 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewListCmd returns list subcmd
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
listOptions := config.NewListOptions()
cmd := &cobra.Command{
Use: "list",
Short: "List releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
listImpl := config.NewListImpl(globalCfg, listOptions)
err := config.NewCLIConfigImpl(listImpl.GlobalImpl)
if err != nil {
return err
}
if err := listImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(listImpl)
return toCLIError(listImpl.GlobalImpl, a.ListReleases(listImpl))
},
}
f := cmd.Flags()
f.BoolVar(&listOptions.KeepTempDir, "keep-temp-dir", false, "Keep temporary directory")
f.BoolVar(&listOptions.SkipCharts, "skip-charts", false, "don't prepare charts when listing releases")
f.StringVar(&listOptions.Output, "output", "", "output releases list as a json string")
return cmd
}
+37
View File
@@ -0,0 +1,37 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewReposCmd returns repos subcmd
func NewReposCmd(globalCfg *config.GlobalImpl) *cobra.Command {
reposOptions := config.NewReposOptions()
cmd := &cobra.Command{
Use: "repos",
Short: "Add chart repositories defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
reposImpl := config.NewReposImpl(globalCfg, reposOptions)
err := config.NewCLIConfigImpl(reposImpl.GlobalImpl)
if err != nil {
return err
}
if err := reposImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(reposImpl)
return toCLIError(reposImpl.GlobalImpl, a.Repos(reposImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
return cmd
}
+142
View File
@@ -0,0 +1,142 @@
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"go.szostok.io/version/extension"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/app/version"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/errors"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/runtime"
)
var logger *zap.SugaredLogger
var globalUsage = "Declaratively deploy your Kubernetes manifests, Kustomize configs, and Charts as Helm releases in one shot\n" + runtime.Info()
func toCLIError(g *config.GlobalImpl, err error) error {
if err != nil {
switch e := err.(type) {
case *app.NoMatchingHelmfileError:
noMatchingExitCode := 3
if g.AllowNoMatchingRelease {
noMatchingExitCode = 0
}
return errors.NewExitError(e.Error(), noMatchingExitCode)
case *app.MultiError:
return errors.NewExitError(e.Error(), 1)
case *app.Error:
return errors.NewExitError(e.Error(), e.Code())
default:
panic(fmt.Errorf("BUG: please file an github issue for this unhandled error: %T: %v", e, e))
}
}
return err
}
// NewRootCmd creates the root command for the CLI.
func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) {
cmd := &cobra.Command{
Use: "helmfile",
Short: globalUsage,
Long: globalUsage,
Version: version.Version(),
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: func(c *cobra.Command, args []string) error {
// Valid levels:
// https://github.com/uber-go/zap/blob/7e7e266a8dbce911a49554b945538c5b950196b8/zapcore/level.go#L126
logLevel := globalConfig.LogLevel
switch {
case globalConfig.Debug:
logLevel = "debug"
case globalConfig.Quiet:
logLevel = "warn"
}
logger = helmexec.NewLogger(os.Stderr, logLevel)
globalConfig.SetLogger(logger)
return nil
},
}
flags := cmd.PersistentFlags()
// Set the global options for the root command.
setGlobalOptionsForRootCmd(flags, globalConfig)
flags.ParseErrorsWhitelist.UnknownFlags = true
globalImpl := config.NewGlobalImpl(globalConfig)
// when set environment HELMFILE_UPGRADE_NOTICE_DISABLED any value, skip upgrade notice.
var versionOpts []extension.CobraOption
if os.Getenv(envvar.UpgradeNoticeDisabled) == "" {
versionOpts = append(versionOpts, extension.WithUpgradeNotice("helmfile", "helmfile"))
}
cmd.AddCommand(
NewInitCmd(globalImpl),
NewApplyCmd(globalImpl),
NewBuildCmd(globalImpl),
NewCacheCmd(globalImpl),
NewDepsCmd(globalImpl),
NewDestroyCmd(globalImpl),
NewFetchCmd(globalImpl),
NewListCmd(globalImpl),
NewReposCmd(globalImpl),
NewLintCmd(globalImpl),
NewWriteValuesCmd(globalImpl),
NewTestCmd(globalImpl),
NewTemplateCmd(globalImpl),
NewSyncCmd(globalImpl),
NewDiffCmd(globalImpl),
NewStatusCmd(globalImpl),
extension.NewVersionCobraCmd(
versionOpts...,
),
)
// TODO: Remove this function once Helmfile v0.x
if !runtime.V1Mode {
cmd.AddCommand(
NewChartsCmd(globalImpl),
NewDeleteCmd(globalImpl),
)
}
return cmd, nil
}
func setGlobalOptionsForRootCmd(fs *pflag.FlagSet, globalOptions *config.GlobalOptions) {
fs.StringVarP(&globalOptions.HelmBinary, "helm-binary", "b", app.DefaultHelmBinary, "Path to the helm binary")
fs.StringVarP(&globalOptions.File, "file", "f", "", "load config from file or directory. defaults to \"`helmfile.yaml`\" or \"helmfile.yaml.gotmpl\" or \"helmfile.d\" (means \"helmfile.d/*.yaml\" or \"helmfile.d/*.yaml.gotmpl\") in this preference. Specify - to load the config from the standard input.")
fs.StringVarP(&globalOptions.Environment, "environment", "e", "", `specify the environment name. Overrides "HELMFILE_ENVIRONMENT" OS environment variable when specified. defaults to "default"`)
fs.StringArrayVar(&globalOptions.StateValuesSet, "state-values-set", nil, "set state values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2). Used to override .Values within the helmfile template (not values template).")
fs.StringArrayVar(&globalOptions.StateValuesFile, "state-values-file", nil, "specify state values in a YAML file. Used to override .Values within the helmfile template (not values template).")
fs.BoolVar(&globalOptions.SkipDeps, "skip-deps", false, `skip running "helm repo update" and "helm dependency build"`)
fs.BoolVar(&globalOptions.DisableForceUpdate, "disable-force-update", false, `do not force helm repos to update when executing "helm repo add"`)
fs.BoolVarP(&globalOptions.Quiet, "quiet", "q", false, "Silence output. Equivalent to log-level warn")
fs.StringVar(&globalOptions.KubeContext, "kube-context", "", "Set kubectl context. Uses current context by default")
fs.BoolVar(&globalOptions.Debug, "debug", false, "Enable verbose output for Helm and set log-level to debug, this disables --quiet/-q effect")
fs.BoolVar(&globalOptions.Color, "color", false, "Output with color")
fs.BoolVar(&globalOptions.NoColor, "no-color", false, "Output without color")
fs.StringVar(&globalOptions.LogLevel, "log-level", "info", "Set log level, default info")
fs.StringVarP(&globalOptions.Namespace, "namespace", "n", "", "Set namespace. Uses the namespace set in the context by default, and is available in templates as {{ .Namespace }}")
fs.StringVarP(&globalOptions.Chart, "chart", "c", "", "Set chart. Uses the chart set in release by default, and is available in template as {{ .Chart }}")
fs.StringArrayVarP(&globalOptions.Selector, "selector", "l", nil, `Only run using the releases that match labels. Labels can take the form of foo=bar or foo!=bar.
A release must match all labels in a group in order to be used. Multiple groups can be specified at once.
"--selector tier=frontend,tier!=proxy --selector tier=backend" will match all frontend, non-proxy releases AND all backend releases.
The name of a release can be used as a label: "--selector name=myrelease"`)
fs.BoolVar(&globalOptions.AllowNoMatchingRelease, "allow-no-matching-release", false, `Do not exit with an error code if the provided selector has no matching releases.`)
fs.BoolVar(&globalOptions.EnableLiveOutput, "enable-live-output", globalOptions.EnableLiveOutput, `Show live output from the Helm binary Stdout/Stderr into Helmfile own Stdout/Stderr.
It only applies for the Helm CLI commands, Stdout/Stderr for Hooks are still displayed only when it's execution finishes.`)
fs.BoolVarP(&globalOptions.Interactive, "interactive", "i", false, "Request confirmation before attempting to modify clusters")
// avoid 'pflag: help requested' error (#251)
fs.BoolP("help", "h", false, "help for helmfile")
}
+38
View File
@@ -0,0 +1,38 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewStatusCmd returns status subcmd
func NewStatusCmd(globalCfg *config.GlobalImpl) *cobra.Command {
statusOptions := config.NewStatusOptions()
cmd := &cobra.Command{
Use: "status",
Short: "Retrieve status of releases in state file",
RunE: func(cmd *cobra.Command, args []string) error {
statusImpl := config.NewStatusImpl(globalCfg, statusOptions)
err := config.NewCLIConfigImpl(statusImpl.GlobalImpl)
if err != nil {
return err
}
if err := statusImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(statusImpl)
return toCLIError(statusImpl.GlobalImpl, a.Status(statusImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.IntVar(&statusOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
return cmd
}
+51
View File
@@ -0,0 +1,51 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewSyncCmd returns sync subcmd
func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
syncOptions := config.NewSyncOptions()
cmd := &cobra.Command{
Use: "sync",
Short: "Sync releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
syncImpl := config.NewSyncImpl(globalCfg, syncOptions)
err := config.NewCLIConfigImpl(syncImpl.GlobalImpl)
if err != nil {
return err
}
if err := syncImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(syncImpl)
return toCLIError(syncImpl.GlobalImpl, a.Sync(syncImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm sync")
f.StringArrayVar(&syncOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&syncOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.IntVar(&syncOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&syncOptions.Validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. Note that this requires access to a Kubernetes cluster to obtain information necessary for validating, like the sync of available API versions")
f.BoolVar(&syncOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
f.BoolVar(&syncOptions.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present")
f.BoolVar(&syncOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided`)
f.BoolVar(&syncOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
f.BoolVar(&syncOptions.Wait, "wait", false, `Override helmDefaults.wait setting "helm upgrade --install --wait"`)
f.BoolVar(&syncOptions.WaitForJobs, "wait-for-jobs", false, `Override helmDefaults.waitForJobs setting "helm upgrade --install --wait-for-jobs"`)
f.BoolVar(&syncOptions.ReuseValues, "reuse-values", false, `Override helmDefaults.reuseValues "helm upgrade --install --reuse-values"`)
f.BoolVar(&syncOptions.ResetValues, "reset-values", false, `Override helmDefaults.reuseValues "helm upgrade --install --reset-values"`)
f.StringVar(&syncOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`)
f.StringVar(&syncOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
return cmd
}
+51
View File
@@ -0,0 +1,51 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewTemplateCmd returm template subcmd
func NewTemplateCmd(globalCfg *config.GlobalImpl) *cobra.Command {
templateOptions := config.NewTemplateOptions()
cmd := &cobra.Command{
Use: "template",
Short: "Template releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
templateImpl := config.NewTemplateImpl(globalCfg, templateOptions)
err := config.NewCLIConfigImpl(templateImpl.GlobalImpl)
if err != nil {
return err
}
if err := templateImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(templateImpl)
return toCLIError(templateImpl.GlobalImpl, a.Template(templateImpl))
},
}
f := cmd.Flags()
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm template")
f.StringArrayVar(&templateOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&templateOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.StringVar(&templateOptions.OutputDir, "output-dir", "", "output directory to pass to helm template (helm template --output-dir)")
f.StringVar(&templateOptions.OutputDirTemplate, "output-dir-template", "", "go text template for generating the output directory. Default: {{ .OutputDir }}/{{ .State.BaseName }}-{{ .State.AbsPathSHA1 }}-{{ .Release.Name}}")
f.IntVar(&templateOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&templateOptions.Validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. Note that this requires access to a Kubernetes cluster to obtain information necessary for validating, like the template of available API versions")
f.BoolVar(&templateOptions.IncludeCRDs, "include-crds", false, "include CRDs in the templated output")
f.BoolVar(&templateOptions.SkipTests, "skip-tests", false, "skip tests from templated output")
f.BoolVar(&templateOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
f.BoolVar(&templateOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided`)
f.BoolVar(&templateOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
f.BoolVar(&templateOptions.SkipCleanup, "skip-cleanup", false, "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security")
f.StringVar(&templateOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`)
f.StringVar(&templateOptions.KubeVersion, "kube-version", "", `pass --kube-version to "helm template". Overrides kubeVersion in helmfile.yaml`)
return cmd
}
+42
View File
@@ -0,0 +1,42 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewTestCmd returns test subcmd
func NewTestCmd(globalCfg *config.GlobalImpl) *cobra.Command {
testOptions := config.NewTestOptions()
testImpl := config.NewTestImpl(globalCfg, testOptions)
cmd := &cobra.Command{
Use: "test",
Short: "Test charts from state file (helm test)",
RunE: func(cmd *cobra.Command, args []string) error {
err := config.NewCLIConfigImpl(testImpl.GlobalImpl)
if err != nil {
return err
}
if err := testImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(testImpl)
return toCLIError(testImpl.GlobalImpl, a.Test(testImpl))
},
}
testImpl.Cmd = cmd
f := cmd.Flags()
f.IntVar(&testOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.BoolVar(&testOptions.Cleanup, "cleanup", false, "delete test pods upon completion")
f.BoolVar(&testOptions.Logs, "logs", false, "Dump the logs from test pods (this runs after all tests are complete, but before any cleanup)")
f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec")
f.IntVar(&testOptions.Timeout, "timeout", 300, "maximum time for tests to run before being considered failed")
return cmd
}
+40
View File
@@ -0,0 +1,40 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
)
// NewWriteValuesCmd returns write-values subcmd
func NewWriteValuesCmd(globalCfg *config.GlobalImpl) *cobra.Command {
writeValuesOptions := config.NewWriteValuesOptions()
cmd := &cobra.Command{
Use: "write-values",
Short: "Write values files for releases. Similar to `helmfile template`, write values files instead of manifests.",
RunE: func(cmd *cobra.Command, args []string) error {
writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions)
err := config.NewCLIConfigImpl(writeValuesImpl.GlobalImpl)
if err != nil {
return err
}
if err := writeValuesImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(writeValuesImpl)
return toCLIError(writeValuesImpl.GlobalImpl, a.WriteValues(writeValuesImpl))
},
}
f := cmd.Flags()
f.IntVar(&writeValuesOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.StringArrayVar(&writeValuesOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag")
f.StringArrayVar(&writeValuesOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag")
f.StringVar(&writeValuesOptions.OutputFileTemplate, "output-file-template", "", "go text template for generating the output file. Default: {{ .State.BaseName }}-{{ .State.AbsPathSHA1 }}/{{ .Release.Name}}.yaml")
return cmd
}
+332
View File
@@ -0,0 +1,332 @@
## Advanced Features
- [Import Configuration Parameters into Helmfile](#import-configuration-parameters-into-helmfile)
- [Deploy Kustomization with Helmfile](#deploy-kustomizations-with-helmfile)
- [Adhoc Kustomization of Helm Charts](#adhoc-kustomization-of-helm-charts)
- [Adding dependencies without forking the chart](#adding-dependencies-without-forking-the-chart)
### Import Configuration Parameters into Helmfile
Helmfile integrates [vals]() to import configuration parameters from following backends:
- AWS SSM Parameter Store
- AWS SecretsManager
- Vault
- SOPS
See [Vals "Suported Backends"](https://github.com/helmfile/vals#suported-backends) for the full list of available backends.
This feature was implemented in https://github.com/roboll/helmfile/pull/906.
If you're curious how it's designed and how it works, please consult the pull request.
### Deploy Kustomizations with Helmfile
You can deploy [kustomize](https://github.com/kubernetes-sigs/kustomize) "kustomization"s with Helmfile.
Most of Kustomize operations that is usually done with `kustomize edit` can be done declaratively via Helm values.yaml files.
Under the hood, Helmfile transforms the kustomization into a local chart in a temporary directory so that it can be `helm upgrade --install`ed.
The transformation is done by generating (1)a temporary kustomization from various options and (2)temporary chart from the temporary kustomization.
An example pseudo code for the transformation logic can be written as:
```console
$ TMPCHART=/tmp/sometmpdir
$ mkdir -p ${TMPCHART}/templates
$ somehow_generate_chart_yaml ${TMPCHART}/Chart.yaml
$ TMPKUSTOMIZATION=/tmp/sometmpdir2
$ somehow_generate_temp_kustomization_yaml ${TMPKUSTOMIZATION}/kustomization.yaml
$ kustomize build ${TMPKUSTOMIZATION}/kustomization.yaml > ${TMPCHART}/templates/all.yaml
```
Let's say you have a `helmfile.yaml` that looks like the below:
```yaml
releases:
- name: myapp
chart: mykustomization
values:
- values.yaml
```
Helmfile firstly generates a temporary `kustomization.yaml` that looks like:
```yaml
bases:
- $(ABS_PATH_TO_HELMFILE_YAML}/mykustomization
```
Followed by the below steps:
- Running `kustomize edit set image $IMAGE` for every `$IMAGE` generated from your values.yaml
- Running `kustomize edit set nameprefix $NAMEPREFIX` with the nameprefix specified in your values.yaml
- Running `kustomize edit set namesuffix $NAMESUFFIX` with the namesuffix specified in your values.yaml
- Running `kustomize edit set namespace $NS` with the namespace specified in your values.yaml
A `values.yaml` file for kustomization would look like the below:
```yaml
images:
# kustomize edit set image mysql=eu.gcr.io/my-project/mysql@canary
- name: mysql
newName: eu.gcr.io/my-project/mysql
newTag: canary
# kustomize edit set image myapp=my-registry/my-app@sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
- name: myapp
digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
newName: my-registry/my-app
# kustomize edit set nameprefix foo-
namePrefix: foo-
# kustomize edit set namesuffix -bar
nameSuffix: -bar
# kustomize edit set namespace myapp
namespace: myapp
```
At this point, Helmfile can generate a complete kustomization from the base kustomization you specified in `releases[].chart` of your helmfile.yaml and `values.yaml`,
which can be included in the temporary chart.
After all, Helmfile just installs the temporary chart like standard charts, which allows you to manage everything with Helmfile regardless of each app is declared using a Helm chart or a kustomization.
Please also see [test/advanced/helmfile.yaml](https://github.com/helmfile/helmfile/tree/master/test/advanced/helmfile.yaml) for an example of kustomization support and more.
### Adhoc Kustomization of Helm charts
With Helmfile's integration with Kustomize, not only deploying Kustomization as a Helm chart, you can kustomize charts before installation.
Currently, Helmfile allows you to set the following fields for kustomizing the chart:
- [`releases[].strategicMergePatches`](#strategicmergepatches)
- `releases[].jsonPatches`
- [`releases[].transformers`](#transformers)
#### `strategicMergePatches`
You can add/update any Kubernetes resource field rendered from a Helm chart by specifying `releases[].strategicMergePatches`:
```
repositories:
- name: incubator
url: https://charts.helm.sh/incubator
releases:
- name: raw1
chart: incubator/raw
values:
- resources:
- apiVersion: v1
kind: ConfigMap
metadata:
name: raw1
namespace: default
data:
foo: FOO
strategicMergePatches:
- apiVersion: v1
kind: ConfigMap
metadata:
name: raw1
namespace: default
data:
bar: BAR
```
Running `helmfile template` on the above example results in a ConfigMap called `raw` whose `data` is:
```yaml
foo: FOO
bar: BAR
```
Please note that the second `data` field `bar` is coming from the strategic-merge patch defined in the above helmfile.yaml.
There's also `releases[].jsonPatches` that works similarly to `strategicMergePatches` but has additional capability to remove fields.
Please also see [test/advanced/helmfile.yaml](https://github.com/helmfile/helmfile/tree/master/test/advanced/helmfile.yaml) for an example of patching support and more.
#### `transformers`
You can set `transformers` to apply [Kustomize's transformers](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/configureBuiltinPlugin.md#configuring-the-builtin-plugins-instead).
Each item can be a path to a YAML or Go template file, or an embedded transformer declaration as a YAML hash.
It's often used to add common labels and annotations to your resources.
In the below example, we add common annotations and labels every resource rendered from the `aws-load-balancer-controller` chart:
```yaml
releases:
- name: "aws-load-balancer-controller"
namespace: "kube-system"
forceNamespace: "kube-system"
chart: "center/aws/aws-load-balancer-controller"
transformers:
- apiVersion: builtin
kind: AnnotationsTransformer
metadata:
name: notImportantHere
annotations:
area: 51
greeting: take me to your leader
fieldSpecs:
- path: metadata/annotations
create: true
- apiVersion: builtin
kind: LabelTransformer
metadata:
name: notImportantHere
labels:
foo: bar
fieldSpecs:
- path: metadata/labels
create: true
```
As explained earlier, `transformers` can be not only a list of embedded transformers, but also YAML or Go template files, or a mix of those three kinds.
```yaml
transformers:
# Embedded transformer
- apiVersion: builtin
kind: AnnotationsTransformer
metadata:
name: notImportantHere
annotations:
area: 51
greeting: take me to your leader
fieldSpecs:
- path: metadata/annotations
create: true
# YAML file
- path/to/transformer.yaml
# Go template
# The same set of template parameters as release values files templates is available.
- path/to/transformer.yaml.gotmpl
```
Please see https://github.com/kubernetes-sigs/kustomize/blob/master/examples/configureBuiltinPlugin.md#configuring-the-builtin-plugins-instead for more information on how to declare transformers.
### Adding dependencies without forking the chart
With Helmfile, you can add chart dependencies to a Helm chart without forking it.
An example `helmfile.yaml` that adds a `stable/envoy` dependency to the release `foo` looks like the below:
```yaml
repositories:
- name: stable
url: https://charts.helm.sh/stable
releases:
- name: foo
chart: ./path/to/foo
dependencies:
- chart: stable/envoy
version: 1.5
```
When Helmfile encounters `releases[].dependencies`, it creates another temporary chart from `./path/to/foo` and adds the following `dependencies` to the `Chart.yaml`, so that you don't need to fork the chart.
```yaml
dependencies:
- name: envoy
repo: https://charts.helm.sh/stable
condition: envoy.enabled
```
A Helm chart can have two or more dependencies for the same chart with different `alias`es. To give your dependency an `alias`, define it like you would do in a standard `Chart.yaml`:
```yaml
repositories:
- name: stable
url: https://charts.helm.sh/stable
releases:
- name: foo
chart: ./path/to/foo
dependencies:
- chart: stable/envoy
version: 1.5
alias: bar
- chart: stable/envoy
version: 1.5
alias: baz
```
which will tweaks the temporary chart's `Chart.yaml` to have:
```yaml
dependencies:
- alias: bar
name: envoy
repo: https://charts.helm.sh/stable
condition: bar.enabled
- alias: baz
name: envoy
repo: https://charts.helm.sh/stable
condition: baz.enabled
```
Please see #649 for more context around this feature.
After the support for adhoc dependency to local chart (#1765),
you can even write local file paths relative to `helmfile.yaml` in `chart`:
```yaml
releases:
- name: foo
chart: ./path/to/foo
dependencies:
- chart: ./path/to/bar
```
Internally, Helmfile creates another temporary chart from the local chart `./path/to/foo`, and modifies the chart's `Chart.yaml` dependencies to look like:
```yaml
dependencies:
- alias: bar
name: bar
repo: file:///abs/path/to/bar
condition: bar.enabled
```
Please read https://github.com/roboll/helmfile/issues/1762#issuecomment-816341251 for more details.
#### OCI chart dependencies
With Helmfile version v0.146.0 or later, you can add OCI chart to chart dependencies.
An example `helmfile.yaml` that adds a OCI chart dependency to the release `foo` looks like the below:
```yaml
releases:
- name: foo
chart: ./path/to/foo
dependencies:
- chart: oci://my-oci-registry/helm-repo/envoy
version: 1.5
```
### Lockfile per environment
In some cases it can be handy for CI/CD pipelines to be able to roll out updates gradually for environments, such as staging and production while using the same
set of charts. This can be achieved by using `lockFilePath` in combination with environments, such as:
```yaml
environments:
staging:
production
---
lockFilePath: .helmfile.{{ .Environment.Name}}.lock
releases:
- name: myapp
chart: charts/myapp
```
+67
View File
@@ -0,0 +1,67 @@
# helmfile template built-in objects
- `Environment`: The information about the environment. This is set by the
`--environment` flag. It has several objects inside of it:
- `Environment.Name`: The name of the environment
- `Environment.KubeContext`: The kube context to be used by default for releases in the environment.
- `Values`: Values passed into the environment.
- `StateValues`: alias for `Values`.
- `Namespace`: The namespace to be released into
# release template built-in objects
it be used for the below two cases:
1. release definition
```
templates:
default:
chart: stable/{{`{{ .Release.Name }}`}}
namespace: kube-system
values:
- config/{{`{{ .Release.Name }}`}}/values.yaml
- config/{{`{{ .Release.Name }}`}}/{{`{{ .Environment.Name }}`}}.yaml
secrets:
- config/{{`{{ .Release.Name }}`}}/secrets.yaml
- config/{{`{{ .Release.Name }}`}}/{{`{{ .Environment.Name }}`}}-secrets.yaml
releases:
- name: heapster
version: 0.3.2
inherit:
- template: default
- name: kubernetes-dashboard
version: 0.10.0
inherit:
- template: default
```
2. release values template
```
releases:
- name: some-release
chart: my-chart
values:
# This is a template file can use the built-in objects
- path/to/values.gotmpl
```
- `Release`: This object describes the release itself. It has several objects
inside of it:
- `Release.Name`: The release name
- `Release.Namespace`: The namespace to be released into
- `Release.Labels`: The labels to be applied to the release
- `Release.Chart`: The chart name of the release
- `Release.KubeContext`: The kube context to be used for the release
- `Values`: Values passed into the environment.
- `StateValues`: alias for `Values`.
- `Environment`: The information about the environment. This is set by the
`--environment` flag. It has several objects inside of it:
- `Environment.Name`: The name of the environment
- `Environment.KubeContext`: The kube context to be used by default for releases in the environment.
- `Chart`: The chart name for the release.
- `KubeContext`: The kube context to be used for the release
- `Namespace`: The namespace to be released into
The built-in values always begin with a capital letter. This is in keeping with
Go's naming convention. When you define your own values and template variables, you are free to use a
convention that suits your team.
+1
View File
@@ -0,0 +1 @@
../CONTRIBUTING.md
+1659
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
../LICENSE
+17 -13
View File
@@ -1,25 +1,29 @@
# Paths Overivew
Using manifest files in conjunction with command line argument can be a bit confusing.
# Paths Overview
A few rules to clear up this ambiguity:
Using manifest files in conjunction with command line argument can be a bit confusing.
A few rules to clear up this ambiguity:
- Absolute paths are always resolved as absolute paths
- Relative paths referenced *in* the helmfile manifest itself are relative to that manifest
- Relative paths referenced on the command line are relative to the current working directory the user is in
- Relative paths referenced from within the helmfile loaded from the standard input using `helmfile -f -` are relative to the current working directory
### Examples
There are several examples that we can go through in the `/examples` folder which demonstrate this.
There are several examples that we can go through in the [`/examples`](../examples/) folder which demonstrate this.
**Local Execution**
This is an example of a Helmfile manifest referencing a local value directly.
This is an example of a Helmfile manifest referencing a local value directly.
Indirect:
```
helmfile -f examples/deployments/local/charts.yaml sync
helmfile -f examples/deployments/local/helmfile.yaml sync
```
Direct:
Direct:
```
cd examples/deployments/local/
helmfile sync
@@ -27,14 +31,14 @@ helmfile sync
**Relative Paths in Helmfile**
This is an example of a Helmfile manifest using relative paths for values.
This is an example of a Helmfile manifest using relative paths for values.
Indirect:
```
helmfile -f examples/deployments/dev/charts.yaml sync
helmfile -f examples/deployments/dev/helmfile.yaml sync
```
Direct:
Direct:
```
cd examples/deployments/dev/
helmfile sync
@@ -42,16 +46,16 @@ helmfile sync
**Relative Paths in Helmfile w/ --values overrides**
This is an example of a Helmfile manifest using relative paths for values including an additional `--values` from the command line.
This is an example of a Helmfile manifest using relative paths for values including an additional `--values` from the command line.
NOTE: The `--values` is resolved relative to the CWD of the terminal *not* the Helmfile manifest. You can see this with the `replicas` being adjusted to 3 now for the deployment.
Indirect:
```
helmfile -f examples/deployments/dev/charts.yaml sync --values values/replica-values.yaml
helmfile -f examples/deployments/dev/helmfile.yaml sync --values values/replica-values.yaml
```
Direct:
Direct:
```
cd examples/deployments/dev/
helmfile sync --values ../../values/replica-values.yaml
+89
View File
@@ -0,0 +1,89 @@
# Towards Helmfile 1.0
I'd like to make 3 breaking changes to Helmfile and mark it as 1.0, so that we can better communicate with the current and future Helmfile users about our stance on maintaining Helmfile.
Note that every breaking change should have an easy alternative way to achieve the same goal achieved using the removed functionality.
## The changes in 1.0
1. [Forbid the use of `environments` and `releases` within a single helmfile.yaml.gotmpl part](#forbid-the-use-of-environments-and-releases-within-a-single-helmfileyamlgotmpl-part)
2. [Force `.gotmpl` file extension for `helmfile.yaml` in case you want helmfile to render it as a go template before yaml parsing.](#force-gotmpl-file-extension-for-helmfileyaml-in-case-you-want-helmfile-to-render-it-as-a-go-template-before-yaml-parsing)
3. [Remove the `--args` flag from the `helmfile` command](#remove-the---args-flag-from-the-helmfile-command)
4. [Remove `HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS` in favor of `HELMFILE_DISABLE_INSECURE_FEATURES`](#remove-helmfile_skip_insecure_template_functions-in-favor-of-helmfile_disable_insecure_features)
5. [The long deprecated `charts.yaml` has been finally removed](#the-long-deprecated-chartsyaml-has-been-finally-removed)
### Forbid the use of `environments` and `releases` within a single helmfile.yaml.gotmpl part
- Helmfile currently relies on a hack called "double rendering" which no one understands correctly (I suppose) to solve the chicken-and-egg problem of rendering the helmfile template(which requires helmfile to parse `environments` as yaml first) and parsing the rendered helmfile as yaml(which requires helmfile to render the template first).
- By forcing (or print a big warning) the user to do separate helmfile parts for `environments` and `releases`, it's very unlikely Helmfile needs double-rendering at all.
- After this change, every helmfile.yaml written this way:
environments:
default:
values:
- foo: bar
releases:
- name: myapp
chart: charts/myapp
values:
- {{ .Values | toYaml | nindent 4 }}
must be rewritten like:
environments:
default:
values:
- foo: bar
---
releases:
- name: myapp
chart: charts/myapp
values:
- {{ .Values | toYaml | nindent 4 }}
It might not be a deal breaker as you already had to separate helmfile parts when you need to generate `environments` dynamically:
environments:
default:
values:
- foo: bar
---
environments:
default:
values:
- {{ .Values | toYaml | nindent 6}}}
- bar: baz
---
releases:
- name: myapp
chart: charts/myapp
values:
- {{ .Values | toYaml | nindent 4 }}
If you're already using any helmfile.yaml files that are written in the first style, do start using `---` today! It will probably reveal and fix unintended template evaluations. If you start using `---` today, you won't need to do anything after Helmfile 1.0.
### Force `.gotmpl` file extension for `helmfile.yaml` in case you want helmfile to render it as a go template before yaml parsing.
- As the primary maintainer of the project, I'm tired of explaining why Helmfile renders go template expressions embedded in a yaml comment. [The latest example of it](https://github.com/helmfile/helmfile/issues/127).
- When we first introduced helmfile the ability to render helmfile.yaml as a go template, I did propose it to require `.gotmpl` file extension to enable the feature. But none of active helmfile users and contributors at that time agreed with it (although I didn't have a very strong opinion on the matter either), so we enabled it without the extension. I consider it as a tech debt now.
### Remove the `--args` flag from the `helmfile` command
- It has been provided as-is, and never intended to work reliably because it's fundamentally flawed because we have no way to specify which args to be passed to which `helm` commands being called by which `helmfile` command.
- However, I periodically see a new user finds it's not working and reporting it as a bug([the most recent example](https://github.com/roboll/helmfile/issues/2034#issuecomment-1147059088)). It's not a fault of the user. It's our fault that left this broken feature.
- Every use-case previsouly covered (by any chance) with `--args` should be covered in new `helmfile.yaml` fields or flags.
### Remove `HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS` in favor of `HELMFILE_DISABLE_INSECURE_FEATURES`
- This option didn't make much sense in practical. Generally, you'd want to disable all the insecure features altogether to make your deployment secure, or not disable any features. Disabling all is already possible via `HELMFILE_DISABLE_INSECURE_FEATURES `. In addition, `HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS` literally made every insecure template function to silently skipped without any error or warning, which made debugging unnecessarily hard when the user accidentally used an insecure function.
- See https://github.com/helmfile/helmfile/pull/564 for more context.
### The long deprecated `charts.yaml` has been finally removed
Helmfile used to load `helmfile.yaml` or `charts.yaml` when you omitted the `-f` flag. `charts.yaml` has been deprecated for a long time but never been removed. We take v1 as a chance to finally remove it.
## After 1.0
We won't add any backward-incompatible changes while in 1.x, as long as it's inevitable to fix unseen important bug(s).
We also quit saying [Helmfile is in its early days](https://github.com/helmfile/helmfile#status) in your README as... it's just untrue today.
+58
View File
@@ -0,0 +1,58 @@
# Secrets
helmfile can handle secrets using [helm-secrets](https://github.com/jkroepke/helm-secrets) plugin or using remote secrets storage
(everything that package [vals](https://github.com/helmfile/vals) can handle vault, AWS SSM etc)
This section will describe the second use case.
# Remote secrets
This paragraph will describe how to use remote secrets storage (vault, SSM etc) in helmfile
## Fetching single key
To fetch single key from remote secret storage you can use `fetchSecretValue` template function example below
```yaml
# helmfile.yaml
repositories:
- name: stable
url: https://kubernetes-charts.storage.googleapis.com
environments:
default:
values:
- service:
password: ref+vault://svc/#pass
login: ref+vault://svc/#login
releases:
- name: service
namespace: default
labels:
cluster: services
secrets: vault
chart: stable/svc
version: 0.1.0
values:
- service:
login: {{ .Values.service.login | fetchSecretValue }} # this will resolve ref+vault://svc/#pass and fetch secret from vault
password: {{ .Values.service.password | fetchSecretValue | quote }}
# - values/service.yaml.gotmpl # alternatively
```
## Fetching multiple keys
Alternatively you can use `expandSecretRefs` to fetch a map of secrets
```yaml
# values/service.yaml.gotmpl
service:
{{ .Values.service | expandSecretRefs | toYaml | nindent 2 }}
```
This will produce
```yaml
# values/service.yaml
service:
login: svc-login # fetched from vault
password: pass
```
+22
View File
@@ -0,0 +1,22 @@
Babel==2.9.1
click==8.1.2
ghp-import==2.0.2
gitdb==4.0.9
GitPython==3.1.30
importlib-metadata==4.11.3
Jinja2==3.1.1
Markdown==3.3.6
MarkupSafe==2.1.1
mergedeep==1.3.4
mkdocs==1.3.0
mkdocs-git-revision-date-localized-plugin==1.0.1
packaging==21.3
pyparsing==3.0.7
python-dateutil==2.8.2
pytz==2022.1
PyYAML==6.0
pyyaml_env_tag==0.1
six==1.16.0
smmap==5.0.0
watchdog==2.1.7
zipp==3.7.0
+128
View File
@@ -0,0 +1,128 @@
# Template Functions
#### `env`
The `env` function allows you to declare a particular environment variable as an optional for template rendering.
If the environment variable is unset or empty, the template rendering will continue with an empty string as a value.
```yaml
{{ $envValue := env "envName" }}
```
#### `requiredEnv`
The `requiredEnv` function allows you to declare a particular environment variable as required for template rendering.
If the environment variable is unset or empty, the template rendering will fail with an error message.
```yaml
{{ $envValue := requiredEnv "envName" }}
```
> If the environment variable value starts with '/' (forward slash) and [Git for Windows](https://git-scm.com/download/win) is used, you must set `MSYS_NO_PATHCONV=1` to preserve values as-is, or the environment variable value will be prefixed with the `C:\Program Files\Git`. [reference](https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues)
#### `exec`
The `exec` function allows you to run a command, returning the stdout of the command. When the command fails, the template rendering will fail with an error message.
```yaml
{{ $cmdOutpot := exec "./mycmd" (list "arg1" "arg2" "--flag1") }}
```
#### `envExec`
The `envExec` function allows you to run a command with environment variables declared on-the-fly in addition to existing environment variables, returning the stdout of the command. When the command fails, the template rendering will fail with an error message.
```yaml
{{ $cmdOutpot := envExec (dict "envKey" "envValue") "./mycmd" (list "arg1" "arg2" "--flag1") }}
```
#### `readFile`
The `readFile` function allows you to read a file and return its content as the function output. On failure, the template rendering will fail with an error message.
```yaml
{{ $fileContent := readFile "./myfile" }}
```
#### `readDir`
The `readDir` function returns a list of the relative paths to the files contained within the directory. (No folders included. Use `readDirEntries` if you need folders too)
```yaml
{{ range $index,$item := readDir "./testdata/tmpl/sample_folder/" }}
{{- $itemSplit := splitList "/" $item -}}
{{- if contains "\\" $item -}}
{{- $itemSplit = splitList "\\" $item -}}
{{- end -}}
{{- $itemValue := $itemSplit | last -}}
{{- $itemValue -}}
{{- end -}}
```
#### `readDirEntries`
The `readDirEntries` function returns a list of [DirEntry](https://pkg.go.dev/os#DirEntry) contained within the directory
```yaml
{{ range $index,$item := readDirEntries "./testdata/tmpl/sample_folder/" }}
{{- if $item.IsDir -}}
{{- $item.Name -}}
{{- end -}}
{{- end -}}
```
#### `toYaml`
The `toYaml` function allows you to convert a value to YAML string. When has failed, the template rendering will fail with an error message.
```yaml
{{ $yaml := $value | toYaml }}
```
#### `fromYaml`
The `fromYaml` function allows you to convert a YAML string to a value. When has failed, the template rendering will fail with an error message.
```yaml
{{ $value := $yamlString | fromYaml }}
```
#### `setValueAtPath`
The `setValueAtPath` function allows you to set a value at a path. When has failed, the template rendering will fail with an error message.
```yaml
{{ $value | setValueAtPath "path.key" $newValue }}
```
#### `get`
The `get` function allows you to get a value at a path. when defaultValue not set. It will return nil. When has failed, the template rendering will fail with an error message.
```yaml
{{ $Getvalue := $value | get "path.key" "defaultValue" }}
```
#### `getOrNil`
The `getOrNil` function allows you to get a value at a path. when defaultValue not set. It will return nil. When has failed, the template rendering will fail with an error message.
```yaml
{{ $GetOrNlvalue := $value | getOrNil "path.key" }}
```
#### `tpl`
The `tpl` function allows you to render a template. When has failed, the template rendering will fail with an error message.
```yaml
{{ $tplValue := $value | tpl "{{ .Value.key }}" }}
```
#### `required`
The `required` function returns the second argument as-is only if it is not empty. If empty, the template rendering will fail with an error message containing the first argument.
```yaml
{{ $requiredValue := $value | required "value not set" }}
```
#### `fetchSecretValue`
The `fetchSecretValue` function parses the argument as a [vals](https://github.com/helmfile/vals) ref URL, retrieves and returns the remote secret value referred by the URL. In case it failed to access the remote secret backend for whatever reason or the URL was invalid, the template rendering will fail with an error message.
```yaml
{{ $fetchSecretValue := fetchSecretValue "secret/path" }}
```
#### `expandSecretRefs`
The `expandSecretRefs` function takes an object as the argument and expands every [vals](https://github.com/helmfile/vals) secret reference URL embedded in the object's values. See ["Remote Secrets" page in our documentation](./remote-secrets.md) for more information.
```yaml
{{ $expandSecretRefs := $value | expandSecretRefs }}
```
+1
View File
@@ -0,0 +1 @@
../USERS.md
+123 -58
View File
@@ -2,6 +2,23 @@
This guide covers the Helmfile’s considered patterns for writing advanced helmfiles. It focuses on how helmfile should be structured and executed.
## Helmfile .Values vs Helm .Values
Templating engine of Helmfile uses the same pipeline name `.Values` as Helm, so in some use-cases `.Values` of Helmfile and
Helm can be seen in the same file. To distinguish these two kinds of `.Values`, Helmfile provides an alias `.StateValues`
for its `.Values`.
```
app:
project: {{.Environment.Name}}-{{.StateValues.project}} # Same as {{.Environment.Name}}-{{.Values.project}}
{{`
extraEnvVars:
- name: APP_PROJECT
value: {{.Values.app.project}}
`}}
```
## Missing keys and Default values
helmfile tries its best to inform users for noticing potential mistakes.
@@ -14,10 +31,10 @@ That is, the following example let `helmfile` fail when you have no `eventApi.re
{{ .Values.eventApi.replicas | default 1 }}
```
In case it isn't a mistake and you do want to allow missing keys, use the `getOrNil` template function:
In case it isn't a mistake and you do want to allow missing keys, use the `get` template function:
```
{{ .Values | getOrNil "eventApi.replicas" }}
{{ .Values | get "eventApi.replicas" nil }}
```
This result in printing `<no value` in your template, that may or may not result in a failure.
@@ -25,7 +42,7 @@ This result in printing `<no value` in your template, that may or may not result
If you want a kind of default values that is used when a missing key was referenced, use `default` like:
```
{{ .Values | getOrNil "eventApi.replicas" | default 1 }}
{{ .Values | get "eventApi.replicas" 1 }}
```
Now, you get `1` when there is no `eventApi.replicas` defined in environment values.
@@ -68,7 +85,7 @@ It allows you to abstract away the repetitions in releases into a template, whic
```yaml
templates:
default: &default
default:
chart: stable/{{`{{ .Release.Name }}`}}
namespace: kube-system
# This prevents helmfile exiting when it encounters a missing file
@@ -84,48 +101,59 @@ templates:
releases:
- name: heapster
<<: *default
version: 0.3.2
inherit:
- template: default
- name: kubernetes-dashboard
<<: *default
version: 0.10.0
inherit:
- template: default
```
Release Templating supports the following parts of release definition:
- basic fields: `name`, `namespace`, `chart`, `version`
- boolean fields: `installed`, `wait`, `tillerless`, `verify` by the means of additional text
fields designed for templating only: `installedTemplate`, `waitTemplate`, `tillerlessTemplate`, `verifyTemplate`
```yaml
# ...
installedTemplate: '{{`{{ eq .Release.Namespace "kube-system" }}`}}'
waitTemplate: '{{`{{ eq .Release.Labels.tag "safe" | not }}`}}'
# ...
```
- `set` block values:
```yaml
# ...
setTemplate:
- name: '{{`{{ .Release.Name }}`}}'
values: '{{`{{ .Release.Namespace }}`}}'
# ...
```
- `values` and `secrets` file paths:
```yaml
# ...
valuesTemplate:
- config/{{`{{ .Release.Name }}`}}/values.yaml
secrets:
- config/{{`{{ .Release.Name }}`}}/secrets.yaml
# ...
```
- inline `values` map:
```yaml
# ...
valuesTemplate:
- image:
tag: `{{ .Release.Labels.tag }}`
# ...
```
See the [issue 428](https://github.com/roboll/helmfile/issues/428) for more context on how this is supposed to work.
- basic fields: `name`, `namespace`, `chart`, `version`
- boolean fields: `installed`, `wait`, `waitForJobs`, `verify` by the means of additional text
fields designed for templating only: `installedTemplate`, `waitTemplate`, `verifyTemplate`
# ...
installedTemplate: '{{`{{ eq .Release.Namespace "kube-system" }}`}}'
waitTemplate: '{{`{{ eq .Release.Labels.tag "safe" | not }}`}}'
# ...
- `set` block values:
# ...
setTemplate:
- name: '{{`{{ .Release.Name }}`}}'
values: '{{`{{ .Release.Namespace }}`}}'
# ...
- `values` and `secrets` file paths:
# ...
valuesTemplate:
- config/{{`{{ .Release.Name }}`}}/values.yaml
secrets:
- config/{{`{{ .Release.Name }}`}}/secrets.yaml
# ...
- inline `values` map:
# ...
valuesTemplate:
- image:
tag: '{{`{{ .Release.Labels.tag }}`}}'
# ...
Previously, we've been using YAML anchors for release template inheritance.
It turned out not work well when you wanted to nest templates for complex use cases and/or you want a fine control over which fields to inherit or not.
Thus we added a new way for inheritance, which uses the `inherit` field we introduced above.
See [issue helmfile/helmfile#435](https://github.com/helmfile/helmfile/issues/435#issuecomment-1362177510) for more context.
You might also find [issue roboll/helmfile#428](https://github.com/roboll/helmfile/issues/428) useful for more context on how we originally designed the relase template and what it's supposed to solve.
## Layering Release Values
@@ -135,18 +163,18 @@ Please note, that it is not possible to layer `values` sections. If `values` is
> See **Layering State Template Files** if you're layering templates.
You may occasionally end up with many helmfiles that shares common parts like which repositories to use, and whichi release to be bundled by default.
You may occasionally end up with many helmfiles that shares common parts like which repositories to use, and which release to be bundled by default.
Use Layering to extract the common parts into a dedicated *library helmfile*s, so that each helmfile becomes DRY.
Let's assume that your `helmfile.yaml` looks like:
```
```yaml
bases:
- environments.yaml
releases:
- name: metricbaet
- name: metricbeat
chart: stable/metricbeat
- name: myapp
chart: mychart
@@ -173,7 +201,7 @@ environments:
releases:
- name: myapp
chart: mychart
- name: metricbaet
- name: metricbeat
chart: stable/metricbeat
```
@@ -186,7 +214,7 @@ environments:
production:
releases:
- name: metricbaet
- name: metricbeat
chart: stable/metricbeat
- name: myapp
chart: mychart
@@ -204,7 +232,7 @@ Helmfile doesn't merge arrays across layers. That is, the below example doesn't
```yaml
releases:
- name: metricbaet
- name: metricbeat
chart: stable/metricbeat
---
releases:
@@ -216,7 +244,7 @@ Helmfile overrides the `releases` array with the latest layer so the resulting s
```yaml
releases:
# metricbeat release disappeared! but that's how helmfiel works
# metricbeat release disappeared! but that's how helmfile works
- name: myapp
chart: mychart
```
@@ -256,23 +284,23 @@ In the following example `helmfile.yaml.gotmpl`, each `---` separated part of th
`helmfile.yaml.gotmpl`:
```yaml
# Part 1: Reused Enviroment Values
# Part 1: Reused Environment Values
bases:
- myenv.yaml
---
# Part 2: Reused Defaults
bases:
- mydefaults.yaml
- mydefaults.yaml.gotmpl
---
# Part 3: Dynamic Releases
releases:
- name: test1
chart: mychart-{{ .Values.myname }}
values:
replicaCount: 1
image:
repository: "nginx"
tag: "latest"
- replicaCount: 1
image:
repository: "nginx"
tag: "latest"
```
Suppose the `myenv.yaml` and `test.env.yaml` loaded in the first part looks like:
@@ -301,7 +329,6 @@ Where the gotmpl file loaded in the second part looks like:
```yaml
helmDefaults:
tillerNamespace: kube-system
kubeContext: {{ .Values.kubeContext }}
verify: false
{{ if .Values.wait }}
@@ -314,13 +341,12 @@ helmDefaults:
force: true
```
Each go template is rendered in the context where `.Values` is inherited from the previous part.
Each go template is rendered in the context where `.Values` is inherited from the previous part.
So in `mydefaults.yaml.gotmpl`, both `.Values.kubeContext` and `.Values.wait` are valid as they do exist in the environment values inherited from the previous part(=the first part) of your `helmfile.yaml.gotmpl`, and therefore the template is rendered to:
```yaml
helmDefaults:
tillerNamespace: kube-system
kubeContext: test
verify: false
wait: false
@@ -341,7 +367,7 @@ releases:
image:
repository: "nginx"
tag: "latest"
````
```
hence rendered to:
@@ -356,3 +382,42 @@ releases:
repository: "nginx"
tag: "latest"
```
## Re-using environment state in sub-helmfiles
Do you want to decouple the environment state loading from the sub-helmfiles and load it only once?
This example shows how to do this:
```yaml
environments:
stage:
values:
- env/stage.yaml
prod:
values:
- env/prod.yaml
---
helmfiles:
- path: releases/myrelease/helmfile.yaml
values:
- {{ toYaml .Values | nindent 4 }}
# pass the current state values to the sub-helmfile
# add other values to use overlay logic here
```
and `releases/myrelease/helmfile.yaml` is as DRY as
```yaml
releases:
- name: mychart-{{ .Values.myrelease.myname }}
installed: {{ .Values | get "myrelease.enabled" false }}
chart: mychart
version: {{ .Values.myrelease.version }}
labels:
chart: mychart
values:
- values.yaml.gotmpl
# templated values would also inherit the values passed from upstream
```
+1 -1
View File
@@ -26,7 +26,7 @@ You would then start a database migration job by executing:
```console
# Start a database migration for the prod environment
$ RAILS_ENV=prod helmfile sync --selector job=dbmigrator
$ RAILS_ENV=prod helmfile --selector job=dbmigrator sync
# Tail log until you are satisfied
$ kubectl logs -l job=dbmigrator
@@ -0,0 +1,11 @@
apiVersion: v2
name: argo-cd
description: Kubernetes continuous deployment system
type: application
version: 3.2.0
appVersion: "3.2.0" # ArgoCD version
dependencies:
- name: argo-cd
version: 3.2.0
repository: https://argoproj.github.io/argo-helm
@@ -0,0 +1,136 @@
# ArgoCD Deployment
This example is intended to show how you can use Helmfile with ArgoCD in a private way. The example deployment demonstrates how to deploy ArgoCD with the helmfile plugin, and how to use helmfile within ArgoCD to connect to various private external systems.
If you intend to follow this example, please pay close attention to the caveats. This chart will not work if you deploy it as-is, you will need to customise many parts of it to match the infrastructure of your organisation.
## What is the point of this chart?
There are many organisations out there which would like to widen Kubernetes adoption but struggle with the requirement to keep all data confidential and follow best practices. For example, one best practice is to to implement a CI/CD process for all deployments including Helm charts. As part of this process we may want to keep secrets in private Vault secret storage, use Helm charts from a private chart museum, customised Helm values from a private Git repository and docker images from a private docker repository. ArgoCD alone cannot do all of these things at once, but we can achieve this if we configure it with Helmfile.
This example is intended to show how you COULD use ArgoCD together with Helmfile to implement a fully private CI/CD system. Your deployment may be a litte bit different, or very different to this example. It's intended only as an example.
The helm chart in this repo can be deployed with Helmfile, if you follow the prerequisites. In order for the deployment to work correctly, you will need to follow the prerequisites and update all of the `values.yaml` file entries with a `# TODO` comment.
# Deployment planning
* Getting started: https://argoproj.github.io/argo-cd/getting_started/
* Helm Chart: https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd
* SSO Setup: https://argoproj.github.io/argo-cd/operator-manual/user-management/microsoft/#azure-ad-app-registration-auth-using-oidc
* RBAC: https://medium.com/dzerolabs/configuring-sso-with-azure-active-directory-on-argocd-d20be4ba753b
* Vault
* Private Chartmuseum (Harbor)
What are the interactions between the different systems?
* ArgoCD will run on Kubernetes. We must use a custom build of ArgoCD as the official build doesn't ship with the runtime binaries which we will need to execute Helmfile and interact with Vault.
* ArgoCD interacts with AzureAD for SSO. ArgoCD has to be configured as an enterprise app in Azure AD for authorization and authentication by an administrator. We put the client ID and client secrets into Vault for safe keeping.
* ArgoCD interacts with Vault in order to pull secrets for customising Helm deployments. Sometimes we need to inject secrets into the values.yaml file of a Helm deployment. ArgoCD will use an AppRole for authentication into Vault, and this is done once during the deployment. The ArgoCD Vault credentials are saved in Vault for safe keeping.
* ArgoCD may need to interact with a private Git server. This is so that ArgoCD can access the `helmfile.yaml` files before executing Helmfile. Additional configuration files (like `conf.d` and other `values.yaml`) files can be kept in here.
* ArgoCD will authenticate to a private chart museum. This is so that we can keep the private helm charts private.
# Prerequisites
## Docker image
* Build the docker image from the `argocd.dockerfile` file in this folder.
* Upload the image to your private docker registry and make a note of the registry URL and tag.
* Customise the `values.yaml` file in this folder.
Replace `argo-cd.global.image.repository` for the docker registry URL of your private registry.
Replace `argo-cd.global.image.tag` for the tag which you used to upload your private docker image.
## Configure Single Sign-On for ArgoCD
* Log into AzureAD as an administrator.
* Create a new App Registration in your tenant for ArgoCD.
* Create a new Client ID and client secret.
* Save the client ID and client secret into your vault server.
- Save the client ID and client secret into Vault. Suggested keys: `internal/argocd/auth#azure_oidc_client_id` and `internal/argocd/auth#azure_oidc_client_secret`.
* Update `values.yaml` for your deployment
- Update `argo-cd.server.config.oidc.config` - replace `SOME_AZURE_AD_TENANT` for your actual plaintext AzureAD tenant ID.
- Update `argo-cd.server.config.oidc.config` - replace `SOME_AZURE_AD_UUID` for your actual plaintext AzureAD client app ID.
- Verify that the Vault path specified in `argo-cd.config.secret.extra.oidc.azure.clientSecret` is the correct path in Vault.
* Customise the ingress objects in the source to match what your expected external URL will be. Update `values.yaml` to have the correct values for the hostname you plan to use.
- `argo-cd.config.server.(url|hostname)`
```yaml
url: 'https://my.argocd.deployment.org' # TODO
hostname: my.argocd.deployment.org # TODO
```
## Configure authentication from ArgoCD into Vault (or read next section on how to disable it)
* Read the documentation from Hashicorp on AppRoles. Provision a new AppRole for ArgoCD with policies.
- In the example the authentication path in Vault is assumed to be `auth/approle/login`. If that's not the case then update line 123 in `values.yaml`.
* Store the AppRole credentials for ArgoCD in Vault. We will use Helmfile to pull them from here when we launch the chart.
- Suggested paths: `internal/vault/argocd#role_id` and `internal/vault/argocd#secret_id`
* Verify that the Vault paths in `values.yaml` are correct
- `argo-cd.config.secret.extra.vault_role_id`
- `argo-cd.config.secret.extra.vault_secret_id`
* Replace `ROLE_ID` and `SECRET_ID` in `values.yaml` (line 124) with the actual plaintext values (values key `argocd.server.config.configManagementPlugins`). This is not 100% secure but was the only way that I could manage to get the rest of the deployment working. I advise you add `values.yaml` to `.gitignore` after doing this step.
## Disable Vault (optional)
If you are not going to use Vault, then you need to update the values to get your deployment to use Helmfile.
* If you are not going to use Vault, then remove the line in `values.yaml` that starts with `export VAULT_TOKEN=...`.
## Configure authentication from ArgoCD into private Git repository
* Create a new API user in your Git system (username + password auth). ArgoCD will use these credentials to pull `values.yaml` and `helmfile.yaml` for your project.
* Save the username and password into Vault
- Recommended keys: `internal/git/users/argocd#username` and `internal/git/users/argocd#password`
* Verify that the Vault paths in `values.yaml` are correct
- `argo-cd.config.secret.extra.git_username`
- `argo-cd.config.secret.extra.git_password`
* Update the settings in `values.yaml` for repositories - remove the example Git URLS and replace with actual Git URLs for your project.
- `https://my.git.server.org/my-team/my-repo-one.git`
- `https://my.git.server.org/my-team/my-repo-two.git`
## Configure authentication from ArgoCD to your private Docker registry and Chartmuseum
* This guide is written with Harbor in mind, which is both a docker registry and chart museum. If you have separate systems in place you might need to configure these things separately.
* Create a new set of credentials for Harbor and save them into Vault.
- Suggested paths: `internal/harbor/users/argocd#username`, `internal/harbor/users/argocd#username`.
* Verify that the Vault paths in `values.yaml` are correct
- `argo-cd.config.secret.extra.harbor_username`
- `argo-cd.config.secret.extra.harbor_password`
* Change the Helm URL on line 95 in `values.yaml` for the actual URL of your Helm Chartmuseum deployment.
- `https://my.harbor.deployment.org/chartrepo/my-project`
# Deploy ArgoCD for the first time
Once you've completed the prerequisites you are ready to deploy ArgoCD for the first time. There is a helmfile that you can use to do this.
Steps:
* Auth to Vault and Kubernetes
* Add ArgoCD Helm repo
- ```bash
helm repo add argo https://argoproj.github.io/argo-helm
helm install --name argocd --namespace argocd argo/argo-cd
```
* Download dependencies (`helmfile dep update`)
* Deploy chart (`helmfile apply`)
- If everything worked correctly, then ArgoCD should have deployed using your customised docker image into your cluster.
* If the ingress deployed correctly then we should be able to access the UI: https://my.argocd.deployment.org
* Grab the admin password from `argocd-initial-admin-secret secret` and use it to log into the UI.
```bash
echo "<password>" | base64 -d
```
* Verify that SSO works by signing on with AzureAD.
* Verify that Helmfile appears in the list of configured plugins in the UI.
# Configure ArgoCD apps for deployment with Helmfile
* Log into ArgoCD in the UI and configure a new app.
* Make sure that it's using the Helmfile plugin.
* For the source, select one of the Git repos which you configured previously.
* Make sure that your Helm repo (including `helmfile.yaml` is present in the Git repository).
* ArgoCD will pull the project from your private Git server and read the `helmfile.yaml` file.
* ArgoCD will also execute helmfile directly in the container using the files checked out from your project.
* If you configured ArgoCD with logins for Vault and private Chartmuseums, these can be used in ArgoCD by Helmfile.
* You can use the diff feature and resource views in ArgoCD when using Helmfile. Unfortunately you can no longer use the `values.yaml` editor in the UI. You can change `values.yaml` for deployments by creating `values.yaml` files and committing them to the folders in your project Git repo. You can also customise them using `!vault` tags.
If you would like an example, this ArgoCD + helmfile deployment can itself be deployed by ArgoCD + helmfile (you may need to drop the pods after you do deploy this way). Any other projects - just structure them in the same way as this example.
Be careful when reconfiguring a project which was previously deploy by ArgoCD with Helmfile. There are some differences around the way in which annotations are used.
@@ -0,0 +1,27 @@
# Custom Dockerfile to install required helm plugins
FROM argoproj/argocd:latest
USER root
# Download OS dependencies
RUN apt-get update && \
apt-get install -y \
curl git wget unzip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Download helmfile
RUN wget https://github.com/roboll/helmfile/releases/download/v0.138.7/helmfile_linux_amd64 && \
mv helmfile_linux_amd64 /usr/local/bin/helmfile && \
chmod a+x /usr/local/bin/helmfile
# Download Vault
RUN wget https://releases.hashicorp.com/vault/1.5.0/vault_1.5.0_linux_amd64.zip -O /tmp/vault.zip --quiet && \
unzip -p /tmp/vault.zip vault > /usr/local/bin/vault && \
chmod a+x /usr/local/bin/vault && \
rm /tmp/vault.zip
USER argocd
# Install helm-secrets plugin (as argocd user)
RUN helm plugin install https://github.com/jkroepke/helm-secrets --version v3.6.0
ENV HELM_PLUGINS="/home/argocd/.local/share/helm/plugins/"
@@ -0,0 +1,43 @@
# What is a helmfile? Read here...
# https://github.com/helmfile/helmfile
# Before deployment, export the required env vars
# export HELM_SECRETS_DRIVER=vault
# Commands to deploy:
# helmfile deps # < download dependencies
# helmfile template # < template stuff. You might have to be signed into vault
# helmfile sync # < deploy everything
# helmfile apply # < deploy diff only
helmDefaults:
wait: true
timeout: 600
recreatePods: true
force: false
commonLabels:
system: argocd
releases:
- name: argocd # name of this release
namespace: argocd # target namespace
createNamespace: true # helm 3.2+ automatically create release namespace (default true)
labels: # Arbitrary key value pairs for filtering releases
env: prod
chart: "." # the chart being installed to create this release, referenced by `repository/chart` syntax
version: 3.2.2 # the semver of the chart. range constraint is supported
missingFileHandler: Warn # set to either "Error" or "Warn". "Error" instructs helmfile to fail when unable to find a values or secrets file. When "Warn", it prints the file and continues.
# will attempt to decrypt secrets using helm-secrets plugin
secrets:
# {{ requiredEnv "HELM_SECRETS_DRIVER" }}
- values.yaml
verify: false
wait: true
timeout: 600
recreatePods: true
force: false
installed: true
atomic: true
cleanupOnFail: false
@@ -0,0 +1,26 @@
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: argocd-ingress
namespace: argocd
labels:
app: argocd
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: ingress
app.kubernetes.io/name: argocd-ingress
app.kubernetes.io/part-of: argocd
annotations:
external-dns.alpha.kubernetes.io/hostname: {{ .Values.argo-cd.server.config.hostname }}
spec:
tls:
- hosts:
- {{ .Values.argo-cd.server.config.hostname }}
secretName: argocd-secret
rules:
- host: {{ .Values.argo-cd.server.config.hostname }}
http:
paths:
- path: /
backend:
serviceName: argocd-server
servicePort: http
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
name: dockerpullsecrets
stringData:
.dockerconfigjson: |
{
"auths" : {
"my.harbor.deployment.org" : {
{{ $authstring := (printf "%v:%v" .Values.secrets.harbor.username .Values.secrets.harbor.password ) }}
"auth": "{{ $authstring | b64enc }}"
}
}
}
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
type: secret
metadata:
name: argocd-git
stringData:
username: "{{ .Values.secrets.git.username }}"
password: "{{ .Values.secrets.git.password }}"
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
type: secret
metadata:
name: argocd-harbor
stringData:
username: "{{ .Values.secrets.harbor.username }}"
password: "{{ .Values.secrets.harbor.password }}"
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
type: secret
metadata:
name: argocd-vault
stringData:
role_id: "{{ .Values.secrets.vault.role_id }}"
secret_id: "{{ .Values.secrets.vault.secret_id }}"
@@ -0,0 +1,154 @@
# TODO - Any of the fields with TODO must be changed for the deployment to work.
secrets:
harbor:
username: !vault internal/harbor/users/argocd#username # TODO
password: !vault internal/harbor/users/argocd#password # TODO
git:
username: !vault internal/git/users/argocd#username # TODO
password: !vault internal/git/users/argocd#password # TODO
vault:
role_id: !vault internal/vault/argocd#role_id # TODO
secret_id: !vault internal/vault/argocd#secret_id # TODO
argo-cd:
global:
image:
repository: my.private.docker.registry.local/internal/argocd # TODO
tag: 1.2.3 # TODO
imagePullPolicy: IfNotPresent
securityContext: {}
# runAsUser: 999
# runAsGroup: 999
# fsGroup: 999
imagePullSecrets:
- name: dockerpullsecrets
hostAliases: []
# - ip: 10.20.30.40
# hostnames:
# - git.myhostname
# set harbor creds in environment, set HELM_SECRET_DRIVER as well
server:
## Argo server log format: text|json
logFormat: text
## Argo server log level
logLevel: debug
env:
- name: "HELM_SECRETS_DRIVER"
value: "vault"
- name: "HARBOR_USERNAME"
valueFrom:
secretKeyRef:
name: argocd-harbor
key: username
- name: "HARBOR_PASSWORD"
valueFrom:
secretKeyRef:
name: argocd-harbor
key: password
# Unfortunately these envvars don't seem to be working correctly.
- name: "VAULT_APPROLE_ID"
valueFrom:
secretKeyRef:
name: argocd-vault
key: role_id
- name: "VAULT_APPROLE_SECRET"
valueFrom:
secretKeyRef:
name: argocd-vault
key: secret_id
config:
application.instanceLabelKey: argocd.argoproj.io/instance
# TODO - customise oidc.config - replace SOME_AZURE_AD_TENANT and SOME_AZURE_AD_UUID with the plaintext values
oidc.config: |
name: Azure
issuer: SOME_AZURE_AD_TENANT
clientID: SOME_AZURE_AD_UUID
clientSecret: $oidc.azure.clientSecret
requestedIDTokenClaims:
groups:
essential: true
requestedScopes:
- openid
- profile
- email
# TODO - customise repositories to include correct git URLs
repositories: |
- type: git
url: https://my.git.server.org/my-team/my-repo-one.git
usernameSecret:
key: username
name: argocd-git
passwordSecret:
key: password
name: argocd-git
- type: git
url: https://my.git.server.org/my-team/my-repo-two.git
usernameSecret:
name: argocd-git
key: username
passwordSecret:
name: argocd-git
key: password
- type: helm
url: https://my.harbor.deployment.org/chartrepo/my-project
usernameSecret:
name: argocd-harbor
key: username
passwordSecret:
name: argocd-harbor
key: password
url: 'https://my.argocd.deployment.org' # TODO
hostname: my.argocd.deployment.org # TODO
configManagementPlugins: |
# If you just want to use helm-secrets this will work.
- name: helm-secrets
generate: # Command to generate manifests YAML
command: ["/bin/bash", "-c"]
args: ["echo \"$HELM_VALUES\" > ./values-local.yaml && helm secrets -d vault template $HELM_OPTS -n $ARGOCD_APP_NAMESPACE -f ./values-local.yaml $ARGOCD_APP_NAME . && rm ./values-local.yaml"]
# You can use helm-secrets via helmfile also.
- name: helmfile
init:
command: ["/bin/bash", "-c"]
args:
- >
helmfile repos ;
helm dependency update ;
true
generate:
command: ["/bin/bash", "-c"]
args:
- >
export VAULT_TOKEN=$(vault write auth/approle/login role_id=ROLE_ID secret_id=SECRET_ID | grep token | head -n 1 | tr -s ' ' | cut -d ' ' -f 2) &&
helmfile template --skip-deps
# ^^^ I am not sure why but I can't seem to get it working without hardcoding the secrets here :(
# TODO - replace ROLE_ID and SECRET_ID with the actual plaintext values
## ArgoCD rbac config
## reference https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/rbac.md
rbacConfig:
policy.csv: |
p, role:org-admin, applications, *, */*, allow
p, role:org-admin, clusters, get, *, allow
p, role:org-admin, repositories, get, *, allow
p, role:org-admin, repositories, create, *, allow
p, role:org-admin, repositories, update, *, allow
p, role:org-admin, repositories, delete, *, allow
g, "OrgAdmin", role:org-admin
g, "ReadOnly", role:readonly
policy.default: 'role:readonly'
scopes: '[roles, email]'
## Argo Configs
configs:
secret:
extra:
oidc.azure.clientSecret: !vault internal/argocd/auth#azure_oidc_client_secret # TODO
harbor_username: !vault internal/harbor/users/argocd#username # TODO
harbor_password: !vault internal/harbor/users/argocd#password # TODO
git_username: !vault internal/git/users/argocd#username # TODO
git_password: !vault internal/git/users/argocd#password # TODO
vault_role_id: !vault internal/vault/argocd#role_id # TODO
vault_secret_id: !vault internal/vault/argocd#secret_id # TODO
@@ -1,4 +1,4 @@
charts:
releases:
- name: dev-paths-example
namespace: dev
chart: ../../charts/paths-example/
@@ -1,4 +1,4 @@
charts:
releases:
- name: local-paths-example
namespace: local
chart: ../../charts/paths-example/
@@ -1,4 +1,4 @@
charts:
releases:
- name: prod-paths-example
namespace: prod
chart: ../../charts/paths-example/
@@ -1,4 +1,4 @@
charts:
releases:
# Published chart example
- name: grafana # helm release name
namespace: grafana # target namespace
+10
View File
@@ -0,0 +1,10 @@
helmfiles:
- path: git::https://github.com/cloudposse/helmfiles.git@releases/echo-server/helmfile.yaml?ref=master
values:
- installed: true
stage: test
environment: test
releases:
- name: apache
chart: git::https://github.com/bitnami/charts.git@bitnami/apache?ref=master
+244 -42
View File
@@ -1,48 +1,250 @@
module github.com/roboll/helmfile
module github.com/helmfile/helmfile
go 1.13
go 1.20
require (
cloud.google.com/go v0.47.0 // indirect
github.com/Azure/azure-sdk-for-go v35.0.0+incompatible // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.4.2
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/Masterminds/semver/v3 v3.2.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a
github.com/aws/aws-sdk-go v1.25.22 // indirect
github.com/go-test/deep v1.0.3
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect
github.com/google/go-cmp v0.3.1
github.com/gosuri/uitable v0.0.3
github.com/hashicorp/go-getter v1.3.0
github.com/hashicorp/go-retryablehttp v0.6.3 // indirect
github.com/hashicorp/go-version v1.2.0
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c // indirect
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.6
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/pierrec/lz4 v2.3.0+incompatible // indirect
github.com/r3labs/diff v0.0.0-20190801153147-a71de73c46ad
github.com/davecgh/go-spew v1.1.1
github.com/go-test/deep v1.1.0
github.com/goccy/go-yaml v1.11.0
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.9
github.com/gosuri/uitable v0.0.4
github.com/hashicorp/go-getter v1.7.1
github.com/helmfile/chartify v0.14.0
github.com/helmfile/vals v0.25.0
github.com/imdario/mergo v0.3.15
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.3
github.com/tatsushid/go-prettytable v0.0.0-20141013043238-ed2d14c29939
github.com/urfave/cli v1.20.0
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363
github.com/variantdev/vals v0.0.0-20191123015158-21b16052816c
go.mozilla.org/sops v0.0.0-20190912205235-14a22d7a7060 // indirect
go.opencensus.io v0.22.1 // indirect
go.uber.org/multierr v1.1.0
go.uber.org/zap v1.9.1
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf // indirect
golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 // indirect
golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
google.golang.org/api v0.13.0 // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 // indirect
google.golang.org/grpc v1.24.0 // indirect
gopkg.in/square/go-jose.v2 v2.4.0 // indirect
gopkg.in/yaml.v2 v2.2.4
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d // indirect
gotest.tools v2.2.0+incompatible
github.com/variantdev/dag v1.1.0
go.szostok.io/version v1.2.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.24.0
golang.org/x/sync v0.2.0
golang.org/x/term v0.8.0
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.12.0
k8s.io/apimachinery v0.27.2
)
replace gopkg.in/yaml.v3 => github.com/colega/go-yaml-yaml v0.0.0-20220720070545-aaba007ebc22
require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go/iam v0.12.0 // indirect
cloud.google.com/go/storage v1.28.1 // indirect
filippo.io/age v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/a8m/envsubst v1.3.0 // indirect
github.com/aws/aws-sdk-go v1.44.122 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fujiwara/tfstate-lookup v1.1.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-slug v0.8.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-tfe v1.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d // indirect
github.com/hashicorp/vault/api v1.5.0 // indirect
github.com/hashicorp/vault/sdk v0.4.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.11 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/otiai10/copy v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a // indirect
go.mozilla.org/sops/v3 v3.7.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.110.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/secretmanager v1.10.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.10.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220407094043-a94812496cf5 // indirect
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.5 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.14 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.14 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.23 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.54 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.21 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.24 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.23 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.23 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.4 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/containerd v1.7.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/docker/cli v20.10.21+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v20.10.24+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-plugin v1.4.3 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.3 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/goleak v1.1.12 // indirect
golang.org/x/crypto v0.7.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.1 // indirect
k8s.io/cli-runtime v0.27.1 // indirect
k8s.io/client-go v0.27.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 // indirect
oras.land/oras-go v1.2.2 // indirect
sigs.k8s.io/kustomize/api v0.13.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
+1293 -797
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
echo "=> Building container"
docker build \
--tag "$IMAGE_NAME" \
--file Dockerfile .
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
go()
{
docker run --rm -v "$(pwd):/workspace" -w /workspace golang:latest go $@;
}
go get -u github.com/tcnksm/ghr github.com/mitchellh/gox
go mod vendor
-11
View File
@@ -1,11 +0,0 @@
#!/bin/bash
echo "=> Fetch unshallow origin"
git fetch --unshallow origin || true
echo "=> Tag image:"
docker tag "${IMAGE_NAME}" "${DOCKER_REPO}:$(git describe --tags --abbrev=0 HEAD^)"
docker tag "${IMAGE_NAME}" "${DOCKER_REPO}:$(git describe --tags --abbrev=0 HEAD)"
echo "=> Push images"
docker push "${DOCKER_REPO}"
+1507
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+30 -633
View File
@@ -1,652 +1,49 @@
package main
import (
"fmt"
"os"
"strings"
"os/signal"
"syscall"
"github.com/roboll/helmfile/pkg/app/version"
"github.com/roboll/helmfile/pkg/app"
"github.com/roboll/helmfile/pkg/helmexec"
"github.com/roboll/helmfile/pkg/maputil"
"github.com/roboll/helmfile/pkg/state"
"github.com/urfave/cli"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/helmfile/helmfile/cmd"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/errors"
)
var logger *zap.SugaredLogger
func configureLogging(c *cli.Context) error {
// Valid levels:
// https://github.com/uber-go/zap/blob/7e7e266a8dbce911a49554b945538c5b950196b8/zapcore/level.go#L126
logLevel := c.GlobalString("log-level")
if c.GlobalBool("quiet") {
logLevel = "warn"
}
var level zapcore.Level
err := level.Set(logLevel)
if err != nil {
return err
}
logger = helmexec.NewLogger(os.Stderr, logLevel)
if c.App.Metadata == nil {
// Auto-initialised in 1.19.0
// https://github.com/urfave/cli/blob/master/CHANGELOG.md#1190---2016-11-19
c.App.Metadata = make(map[string]interface{})
}
c.App.Metadata["logger"] = logger
return nil
}
func main() {
var sig os.Signal
sigs := make(chan os.Signal, 1)
errChan := make(chan error, 1)
cliApp := cli.NewApp()
cliApp.Name = "helmfile"
cliApp.Usage = ""
cliApp.Version = version.Version
cliApp.Flags = []cli.Flag{
cli.StringFlag{
Name: "helm-binary, b",
Usage: "path to helm binary",
Value: "helm",
},
cli.StringFlag{
Name: "file, f",
Usage: "load config from file or directory. defaults to `helmfile.yaml` or `helmfile.d`(means `helmfile.d/*.yaml`) in this preference",
},
cli.StringFlag{
Name: "environment, e",
Usage: "specify the environment name. defaults to `default`",
},
cli.StringSliceFlag{
Name: "state-values-set",
Usage: "set state values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)",
},
cli.StringSliceFlag{
Name: "state-values-file",
Usage: "specify state values in a YAML file",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "Silence output. Equivalent to log-level warn",
},
cli.StringFlag{
Name: "kube-context",
Usage: "Set kubectl context. Uses current context by default",
},
cli.BoolFlag{
Name: "no-color",
Usage: "Output without color",
},
cli.StringFlag{
Name: "log-level",
Usage: "Set log level, default info",
},
cli.StringFlag{
Name: "namespace, n",
Usage: "Set namespace. Uses the namespace set in the context by default, and is available in templates as {{ .Namespace }}",
},
cli.StringSliceFlag{
Name: "selector, l",
Usage: `Only run using the releases that match labels. Labels can take the form of foo=bar or foo!=bar.
A release must match all labels in a group in order to be used. Multiple groups can be specified at once.
--selector tier=frontend,tier!=proxy --selector tier=backend. Will match all frontend, non-proxy releases AND all backend releases.
The name of a release can be used as a label. --selector name=myrelease`,
},
cli.BoolFlag{
Name: "allow-no-matching-release",
Usage: `Do not exit with an error code if the provided selector has no matching releases.`,
},
cli.BoolFlag{
Name: "interactive, i",
Usage: "Request confirmation before attempting to modify clusters",
},
}
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
cliApp.Before = configureLogging
cliApp.Commands = []cli.Command{
{
Name: "deps",
Usage: "update charts based on the contents of requirements.yaml",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.BoolFlag{
Name: "skip-repos",
Usage: "skip running `helm repo update` before running `helm dependency build`",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Deps(c)
}),
},
{
Name: "repos",
Usage: "sync repositories from state file (helm repo add && helm repo update)",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Repos(c)
}),
},
{
Name: "charts",
Usage: "DEPRECATED: sync releases from state file (helm upgrade --install)",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.DeprecatedSyncCharts(c)
}),
},
{
Name: "diff",
Usage: "diff releases from state file against env (helm diff)",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: "skip running `helm repo update` and `helm dependency build`",
},
cli.BoolFlag{
Name: "detailed-exitcode",
Usage: "return a non-zero exit code when there are changes",
},
cli.BoolFlag{
Name: "suppress-secrets",
Usage: "suppress secrets in the output. highly recommended to specify on CI/CD use-cases",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.IntFlag{
Name: "context",
Value: 0,
Usage: "output NUM lines of context around changes",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Diff(c)
}),
},
{
Name: "template",
Usage: "template releases from state file against env (helm template)",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm template",
},
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.StringFlag{
Name: "output-dir",
Usage: "output directory to pass to helm template (helm template --output-dir)",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent downloads of release charts",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: "skip running `helm repo update` and `helm dependency build`",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Template(c)
}),
},
{
Name: "lint",
Usage: "lint charts from state file (helm lint)",
Flags: []cli.Flag{
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent downloads of release charts",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: "skip running `helm repo update` and `helm dependency build`",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Lint(c)
}),
},
{
Name: "sync",
Usage: "sync all resources from state file (repos, releases and chart deps)",
Flags: []cli.Flag{
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: "skip running `helm repo update` and `helm dependency build`",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Sync(c)
}),
},
{
Name: "apply",
Usage: "apply all resources from state file only when there are changes",
Flags: []cli.Flag{
cli.StringSliceFlag{
Name: "set",
Usage: "additional values to be merged into the command",
},
cli.StringSliceFlag{
Name: "values",
Usage: "additional value files to be merged into the command",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.IntFlag{
Name: "context",
Value: 0,
Usage: "output NUM lines of context around changes",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.BoolFlag{
Name: "suppress-secrets",
Usage: "suppress secrets in the diff output. highly recommended to specify on CI/CD use-cases",
},
cli.BoolFlag{
Name: "suppress-diff",
Usage: "suppress diff in the output. Usable in new installs",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: "skip running `helm repo update` and `helm dependency build`",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Apply(c)
}),
},
{
Name: "status",
Usage: "retrieve status of releases in state file",
Flags: []cli.Flag{
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Status(c)
}),
},
{
Name: "delete",
Usage: "DEPRECATED: delete releases from state file (helm delete)",
Flags: []cli.Flag{
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
cli.BoolFlag{
Name: "purge",
Usage: "purge releases i.e. free release names and histories",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Delete(c)
}),
},
{
Name: "destroy",
Usage: "deletes and then purges releases",
Flags: []cli.Flag{
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass args to helm exec",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Destroy(c)
}),
},
{
Name: "test",
Usage: "test releases from state file (helm test)",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "cleanup",
Usage: "delete test pods upon completion",
},
cli.StringFlag{
Name: "args",
Value: "",
Usage: "pass additional args to helm exec",
},
cli.IntFlag{
Name: "timeout",
Value: 300,
Usage: "maximum time for tests to run before being considered failed",
},
cli.IntFlag{
Name: "concurrency",
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
},
Action: action(func(run *app.App, c configImpl) error {
return run.Test(c)
}),
},
{
Name: "build",
Usage: "output compiled helmfile state(s) as YAML",
Flags: []cli.Flag{},
Action: action(func(run *app.App, c configImpl) error {
return run.PrintState(c)
}),
},
{
Name: "list",
Usage: "list releases defined in state file",
Flags: []cli.Flag{},
Action: action(func(run *app.App, c configImpl) error {
return run.ListReleases(c)
}),
},
}
err := cliApp.Run(os.Args)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(3)
}
}
type configImpl struct {
c *cli.Context
set map[string]interface{}
}
func NewUrfaveCliConfigImpl(c *cli.Context) (configImpl, error) {
if c.NArg() > 0 {
cli.ShowAppHelp(c)
return configImpl{}, fmt.Errorf("err: extraneous arguments: %s", strings.Join(c.Args(), ", "))
}
conf := configImpl{
c: c,
}
optsSet := c.GlobalStringSlice("state-values-set")
if len(optsSet) > 0 {
set := map[string]interface{}{}
for i := range optsSet {
ops := strings.Split(optsSet[i], ",")
for j := range ops {
op := strings.SplitN(ops[j], "=", 2)
k := maputil.ParseKey(op[0])
v := op[1]
maputil.Set(set, k, v)
}
}
conf.set = set
}
return conf, nil
}
func (c configImpl) Set() []string {
return c.c.StringSlice("set")
}
func (c configImpl) SkipRepos() bool {
return c.c.Bool("skip-repos")
}
func (c configImpl) Values() []string {
return c.c.StringSlice("values")
}
func (c configImpl) Args() string {
return c.c.String("args")
}
func (c configImpl) OutputDir() string {
return c.c.String("output-dir")
}
func (c configImpl) Concurrency() int {
return c.c.Int("concurrency")
}
func (c configImpl) HasCommandName(name string) bool {
return c.c.Command.HasName(name)
}
// DiffConfig
func (c configImpl) SkipDeps() bool {
return c.c.Bool("skip-deps")
}
func (c configImpl) DetailedExitcode() bool {
return c.c.Bool("detailed-exitcode")
}
func (c configImpl) SuppressSecrets() bool {
return c.c.Bool("suppress-secrets")
}
func (c configImpl) SuppressDiff() bool {
return c.c.Bool("suppress-diff")
}
// DeleteConfig
func (c configImpl) Purge() bool {
return c.c.Bool("purge")
}
// TestConfig
func (c configImpl) Cleanup() bool {
return c.c.Bool("cleanup")
}
func (c configImpl) Timeout() int {
return c.c.Int("timeout")
}
// GlobalConfig
func (c configImpl) HelmBinary() string {
return c.c.GlobalString("helm-binary")
}
func (c configImpl) KubeContext() string {
return c.c.GlobalString("kube-context")
}
func (c configImpl) Namespace() string {
return c.c.GlobalString("namespace")
}
func (c configImpl) FileOrDir() string {
return c.c.GlobalString("file")
}
func (c configImpl) Selectors() []string {
return c.c.GlobalStringSlice("selector")
}
func (c configImpl) StateValuesSet() map[string]interface{} {
return c.set
}
func (c configImpl) StateValuesFiles() []string {
return c.c.GlobalStringSlice("state-values-file")
}
func (c configImpl) Interactive() bool {
return c.c.GlobalBool("interactive")
}
func (c configImpl) NoColor() bool {
return c.c.GlobalBool("no-color")
}
func (c configImpl) Context() int {
return c.c.Int("context")
}
func (c configImpl) Logger() *zap.SugaredLogger {
return c.c.App.Metadata["logger"].(*zap.SugaredLogger)
}
func (c configImpl) Env() string {
env := c.c.GlobalString("environment")
if env == "" {
env = state.DefaultEnv
}
return env
}
func action(do func(*app.App, configImpl) error) func(*cli.Context) error {
return func(implCtx *cli.Context) error {
conf, err := NewUrfaveCliConfigImpl(implCtx)
go func() {
globalConfig := new(config.GlobalOptions)
rootCmd, err := cmd.NewRootCmd(globalConfig)
if err != nil {
return err
errChan <- err
return
}
a := app.New(conf)
errChan <- rootCmd.Execute()
}()
a.ErrorHandler = func(err error) error {
return toCliError(implCtx, err)
}
select {
case sig = <-sigs:
if sig != nil {
app.Cancel()
app.CleanWaitGroup.Wait()
return do(a, conf)
}
}
func toCliError(c *cli.Context, err error) error {
if err != nil {
switch e := err.(type) {
case *app.NoMatchingHelmfileError:
noMatchingExitCode := 3
if c.GlobalBool("allow-no-matching-release") {
noMatchingExitCode = 0
// See http://tldp.org/LDP/abs/html/exitcodes.html
switch sig {
case syscall.SIGINT:
os.Exit(130)
case syscall.SIGTERM:
os.Exit(143)
}
return cli.NewExitError(e.Error(), noMatchingExitCode)
case *app.Error:
return cli.NewExitError(e.Error(), e.Code())
default:
panic(fmt.Errorf("BUG: please file an github issue for this unhandled error: %T: %v", e, e))
}
case err := <-errChan:
errors.HandleExitCoder(err)
}
return err
}
+55
View File
@@ -0,0 +1,55 @@
# Test this locally with:
# $ docker run --rm -it -v $(pwd):$(pwd) --workdir $(pwd) python:3 bash
# # pip install -r docs/requirements.txt
# # mkdocs serve
# # mkdocs build
# $ ls -lah site/
site_name: helmfile
site_author: Helmfile Authors
repo_name: helmfile/helmfile/
repo_url: https://github.com/helmfile/helmfile/
edit_uri: ''
docs_dir: docs
nav:
- Home: index.md
- Getting Started:
- Paths Overview: paths.md
- Templating Funs: templating_funcs.md
- Built-in Objects: builtin-objects.md
- Advanced Features:
- Best Practices Guide: writing-helmfile.md
- Advanced Features: advanced-features.md
- Secrets: remote-secrets.md
- Shared Configuration Across Teams: shared-configuration-across-teams.md
- About:
- Users: users.md
- License: license.md
- Contributing: contributing.md
theme:
name: readthedocs
features:
- navigation.tabs
collapse_navigation: false
hljs_languages:
- yaml
- dockerfile
markdown_extensions:
# meta, toc, table and fenced_code extensions are included by default
- extra
- admonition
- smarty
- sane_lists
- nl2br
- toc:
permalink: true
plugins:
- search
- git-revision-date-localized:
type: date
fallback_to_build_date: true
+1539 -562
View File
File diff suppressed because it is too large Load Diff
+458
View File
@@ -0,0 +1,458 @@
package app
import (
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestApply_hooks(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
}
type testcase struct {
fields fields
ns string
concurrency int
skipDiffOnInstall bool
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
logLevel string
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantUpgrades := tc.upgraded
wantDeletes := tc.deleted
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
Lists: tc.lists,
Diffs: tc.diffs,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, tc.logLevel, func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, tc.files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
syncErr := app.Apply(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: tc.concurrency,
logger: logger,
skipDiffOnInstall: tc.skipDiffOnInstall,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
})
var gotErr string
if syncErr != nil {
gotErr = syncErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
if len(wantUpgrades) > len(helm.Releases) {
t.Fatalf("insufficient number of upgrades: got %d, want %d", len(helm.Releases), len(wantUpgrades))
}
for relIdx := range wantUpgrades {
if wantUpgrades[relIdx].Name != helm.Releases[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Releases[relIdx].Name, wantUpgrades[relIdx].Name)
}
for flagIdx := range wantUpgrades[relIdx].Flags {
if wantUpgrades[relIdx].Flags[flagIdx] != helm.Releases[relIdx].Flags[flagIdx] {
t.Errorf("releases[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Releases[relIdx].Flags[flagIdx], wantUpgrades[relIdx].Flags[flagIdx])
}
}
}
if len(wantDeletes) > len(helm.Deleted) {
t.Fatalf("insufficient number of deletes: got %d, want %d", len(helm.Deleted), len(wantDeletes))
}
for relIdx := range wantDeletes {
if wantDeletes[relIdx].Name != helm.Deleted[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Deleted[relIdx].Name, wantDeletes[relIdx].Name)
}
for flagIdx := range wantDeletes[relIdx].Flags {
if wantDeletes[relIdx].Flags[flagIdx] != helm.Deleted[relIdx].Flags[flagIdx] {
t.Errorf("releaes[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Deleted[relIdx].Flags[flagIdx], wantDeletes[relIdx].Flags[flagIdx])
}
}
}
})
if tc.log != "" {
actual := bs.String()
diff, exists := testhelper.Diff(tc.log, actual, 3)
if exists {
t.Errorf("unexpected log:\nDIFF\n%s\nEOD", diff)
}
} else {
assertLogEqualsToSnapshot(t, bs.String())
}
}
t.Run("apply release with preapply hook", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["preapply"]
command: echo
showlogs: true
args: ["foo"]
`,
},
selectors: []string{"name=foo"},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("apply release with preapply hook", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["foo"]
`,
},
selectors: []string{"name=foo"},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("apply release with preapply hook", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["presync"]
command: echo
showlogs: true
args: ["foo"]
`,
},
selectors: []string{"name=foo"},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("hooks for no-diff release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
# only prepare and cleanup are run
- events: ["prepare", "preapply", "presync", "cleanup"]
command: echo
showlogs: true
args: ["foo"]
`,
},
selectors: []string{"app=test"},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: nil,
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("hooks are run on enabled release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
values:
- bar:
enabled: true
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["foo"]
- name: bar
condition: bar.enabled
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["bar"]
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "foo"},
{Name: "bar"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "bar", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("hooks are not run on disabled release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
values:
- bar:
enabled: false
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["foo"]
- name: bar
condition: bar.enabled
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["bar"]
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("hooks are run on to-be-uninstalled release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["foo"]
- name: bar
installed: false
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["bar"]
`,
},
selectors: []string{"app=test"},
lists: map[exectest.ListKey]string{
{Filter: "^foo$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
foo 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^bar$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
bar 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
t.Run("hooks are not run on alreadyd uninstalled release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["foo"]
- name: bar
installed: false
chart: incubator/raw
namespace: default
labels:
app: test
hooks:
- events: ["prepare", "preapply", "presync"]
command: echo
showlogs: true
args: ["bar"]
`,
},
selectors: []string{"app=test"},
lists: map[exectest.ListKey]string{
{Filter: "^foo$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
foo 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^bar$", Flags: listFlags("default", "default")}: ``,
},
upgraded: []exectest.Release{
{Name: "foo"},
},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
logLevel: "info",
})
})
}
+568
View File
@@ -0,0 +1,568 @@
package app
import (
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestApply_3(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
}
type testcase struct {
fields fields
ns string
concurrency int
skipDiffOnInstall bool
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantUpgrades := tc.upgraded
wantDeletes := tc.deleted
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
Lists: tc.lists,
Diffs: tc.diffs,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: filesystem.DefaultFileSystem(),
OverrideKubeContext: "",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", ""): helm,
},
valsRuntime: valsRuntime,
}, tc.files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
syncErr := app.Apply(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: tc.concurrency,
logger: logger,
skipDiffOnInstall: tc.skipDiffOnInstall,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
})
var gotErr string
if syncErr != nil {
gotErr = syncErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
if len(wantUpgrades) > len(helm.Releases) {
t.Fatalf("insufficient number of upgrades: got %d, want %d", len(helm.Releases), len(wantUpgrades))
}
for relIdx := range wantUpgrades {
if wantUpgrades[relIdx].Name != helm.Releases[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Releases[relIdx].Name, wantUpgrades[relIdx].Name)
}
for flagIdx := range wantUpgrades[relIdx].Flags {
if wantUpgrades[relIdx].Flags[flagIdx] != helm.Releases[relIdx].Flags[flagIdx] {
t.Errorf("releaes[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Releases[relIdx].Flags[flagIdx], wantUpgrades[relIdx].Flags[flagIdx])
}
}
}
if len(wantDeletes) > len(helm.Deleted) {
t.Fatalf("insufficient number of deletes: got %d, want %d", len(helm.Deleted), len(wantDeletes))
}
for relIdx := range wantDeletes {
if wantDeletes[relIdx].Name != helm.Deleted[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Deleted[relIdx].Name, wantDeletes[relIdx].Name)
}
for flagIdx := range wantDeletes[relIdx].Flags {
if wantDeletes[relIdx].Flags[flagIdx] != helm.Deleted[relIdx].Flags[flagIdx] {
t.Errorf("releaes[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Deleted[relIdx].Flags[flagIdx], wantDeletes[relIdx].Flags[flagIdx])
}
}
}
})
if tc.log != "" {
actual := bs.String()
diff, exists := testhelper.Diff(tc.log, actual, 3)
if exists {
t.Errorf("unexpected log:\nDIFF\n%s\nEOD", diff)
}
} else {
assertLogEqualsToSnapshot(t, bs.String())
}
}
t.Run("skip-needs=true", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=true with no diff on a release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
^external-secrets$ 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: nil,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "kubernetes-external-secrets", Chart: "incubator/raw", Flags: "--namespacekube-system--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
kubernetes-external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true but no diff on needed release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "kubernetes-external-secrets", Chart: "incubator/raw", Flags: "--namespacekube-system--detailed-exitcode--reset-values"}: nil,
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true with installed but disabled release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
installed: false
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
kubernetes-external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true with not installed and disabled release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
installed: false
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "")}: ``,
{Filter: "^external-secrets$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("bad --selector", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test_non_existent"},
upgraded: []exectest.Release{},
error: "err: no releases found that matches specified selector(app=test_non_existent) and environment(default), in any helmfile",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
log: `processing file "helmfile.yaml" in directory "."
changing working directory to "/path/to"
first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "helmfile.yaml.part.0":
0:
1:
2:
3: releases:
4: - name: kubernetes-external-secrets
5: chart: incubator/raw
6: namespace: kube-system
7:
8: - name: external-secrets
9: chart: incubator/raw
10: namespace: default
11: labels:
12: app: test
13: needs:
14: - kube-system/kubernetes-external-secrets
15:
16: - name: my-release
17: chart: incubator/raw
18: namespace: default
19: labels:
20: app: test
21: needs:
22: - default/external-secrets
23:
first-pass produced: &{default map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "helmfile.yaml.part.0":
0:
1:
2:
3: releases:
4: - name: kubernetes-external-secrets
5: chart: incubator/raw
6: namespace: kube-system
7:
8: - name: external-secrets
9: chart: incubator/raw
10: namespace: default
11: labels:
12: app: test
13: needs:
14: - kube-system/kubernetes-external-secrets
15:
16: - name: my-release
17: chart: incubator/raw
18: namespace: default
19: labels:
20: app: test
21: needs:
22: - default/external-secrets
23:
merged environment: &{default map[] map[]}
0 release(s) matching app=test_non_existent found in helmfile.yaml
changing working directory back to "/path/to"
`,
})
})
}
+725
View File
@@ -0,0 +1,725 @@
package app
import (
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestApply_2(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
}
type testcase struct {
fields fields
ns string
concurrency int
skipDiffOnInstall bool
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantUpgrades := tc.upgraded
wantDeletes := tc.deleted
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
Lists: tc.lists,
Diffs: tc.diffs,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: filesystem.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, tc.files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
syncErr := app.Apply(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: tc.concurrency,
logger: logger,
skipDiffOnInstall: tc.skipDiffOnInstall,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
})
var gotErr string
if syncErr != nil {
gotErr = syncErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
if len(wantUpgrades) > len(helm.Releases) {
t.Fatalf("insufficient number of upgrades: got %d, want %d", len(helm.Releases), len(wantUpgrades))
}
for relIdx := range wantUpgrades {
if wantUpgrades[relIdx].Name != helm.Releases[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Releases[relIdx].Name, wantUpgrades[relIdx].Name)
}
for flagIdx := range wantUpgrades[relIdx].Flags {
if wantUpgrades[relIdx].Flags[flagIdx] != helm.Releases[relIdx].Flags[flagIdx] {
t.Errorf("releases[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Releases[relIdx].Flags[flagIdx], wantUpgrades[relIdx].Flags[flagIdx])
}
}
}
if len(wantDeletes) > len(helm.Deleted) {
t.Fatalf("insufficient number of deletes: got %d, want %d", len(helm.Deleted), len(wantDeletes))
}
for relIdx := range wantDeletes {
if wantDeletes[relIdx].Name != helm.Deleted[relIdx].Name {
t.Errorf("releases[%d].name: got %q, want %q", relIdx, helm.Deleted[relIdx].Name, wantDeletes[relIdx].Name)
}
for flagIdx := range wantDeletes[relIdx].Flags {
if wantDeletes[relIdx].Flags[flagIdx] != helm.Deleted[relIdx].Flags[flagIdx] {
t.Errorf("releaes[%d].flags[%d]: got %v, want %v", relIdx, flagIdx, helm.Deleted[relIdx].Flags[flagIdx], wantDeletes[relIdx].Flags[flagIdx])
}
}
}
})
if tc.log != "" {
actual := bs.String()
diff, exists := testhelper.Diff(tc.log, actual, 3)
if exists {
t.Errorf("unexpected log:\nDIFF\n%s\nEOD", diff)
}
} else {
assertLogEqualsToSnapshot(t, bs.String())
}
}
t.Run("skip-needs=true", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default"}},
{Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default"}},
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=true with no diff on a release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default"}},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
^external-secrets$ 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: nil,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "kubernetes-external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacekube-system--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
kubernetes-external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true but no diff on needed release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "kubernetes-external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacekube-system--detailed-exitcode--reset-values"}: nil,
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true with installed but disabled release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
installed: false
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
kubernetes-external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("skip-needs=false include-needs=true with not installed and disabled release", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
installed: false
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test"},
upgraded: []exectest.Release{},
lists: map[exectest.ListKey]string{
{Filter: "^kubernetes-external-secrets$", Flags: listFlags("kube-system", "default")}: ``,
{Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
{Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffs: map[exectest.DiffKey]error{
{Name: "external-secrets", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "my-release", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("include-transitive-needs=true", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
error: ``,
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: serviceA
chart: my/chart
needs:
- serviceB
- name: serviceB
chart: my/chart
needs:
- serviceC
- name: serviceC
chart: my/chart
- name: serviceD
chart: my/chart
`,
},
selectors: []string{"name=serviceA"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "serviceA", Chart: "my/chart", Flags: "--kube-contextdefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "serviceB", Chart: "my/chart", Flags: "--kube-contextdefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
{Name: "serviceC", Chart: "my/chart", Flags: "--kube-contextdefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^serviceA$", Flags: listFlags("", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
serviceA 4 Fri Nov 1 08:40:07 2019 DEPLOYED chart-3.1.0 3.1.0 default
`,
{Filter: "^serviceB$", Flags: listFlags("", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
serviceB 4 Fri Nov 1 08:40:07 2019 DEPLOYED chart-3.1.0 3.1.0 default
`,
{Filter: "^serviceC$", Flags: listFlags("", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
serviceC 4 Fri Nov 1 08:40:07 2019 DEPLOYED chart-3.1.0 3.1.0 default
`,
},
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("bad --selector", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
{{ $mark := "a" }}
releases:
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
`,
},
selectors: []string{"app=test_non_existent"},
upgraded: []exectest.Release{},
error: "err: no releases found that matches specified selector(app=test_non_existent) and environment(default), in any helmfile",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
log: `processing file "helmfile.yaml" in directory "."
changing working directory to "/path/to"
first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "helmfile.yaml.part.0":
0:
1:
2:
3: releases:
4: - name: kubernetes-external-secrets
5: chart: incubator/raw
6: namespace: kube-system
7:
8: - name: external-secrets
9: chart: incubator/raw
10: namespace: default
11: labels:
12: app: test
13: needs:
14: - kube-system/kubernetes-external-secrets
15:
16: - name: my-release
17: chart: incubator/raw
18: namespace: default
19: labels:
20: app: test
21: needs:
22: - default/external-secrets
23:
first-pass produced: &{default map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "helmfile.yaml.part.0":
0:
1:
2:
3: releases:
4: - name: kubernetes-external-secrets
5: chart: incubator/raw
6: namespace: kube-system
7:
8: - name: external-secrets
9: chart: incubator/raw
10: namespace: default
11: labels:
12: app: test
13: needs:
14: - kube-system/kubernetes-external-secrets
15:
16: - name: my-release
17: chart: incubator/raw
18: namespace: default
19: labels:
20: app: test
21: needs:
22: - default/external-secrets
23:
merged environment: &{default map[] map[]}
0 release(s) matching app=test_non_existent found in helmfile.yaml
changing working directory back to "/path/to"
`,
})
})
t.Run("deduplicate by --selector", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
component: raw
index: '1'
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
component: raw
index: '2'
`,
},
selectors: []string{"index=1"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^foo$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
foo 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("select non existent release with --allow-no-matching-release", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
- name: bar
chart: incubator/raw
namespace: default
labels:
app: test
`,
},
selectors: []string{"app=foo"},
upgraded: []exectest.Release{},
error: "err: no releases found that matches specified selector(app=foo) and environment(default), in any helmfile",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
t.Run("select single release from helmfile with two duplicates", func(t *testing.T) {
check(t, testcase{
files: map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: foo
chart: incubator/raw
namespace: default
labels:
app: test
- name: bar
chart: incubator/raw
namespace: default
labels:
app: build
- name: bar
chart: incubator/raw
namespace: default
labels:
app: test
`,
},
selectors: []string{"name=foo"},
upgraded: []exectest.Release{},
diffs: map[exectest.DiffKey]error{
{Name: "foo", Chart: "incubator/raw", Flags: "--kube-contextdefault--namespacedefault--detailed-exitcode--reset-values"}: helmexec.ExitError{Code: 2},
},
lists: map[exectest.ListKey]string{
{Filter: "^foo$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
foo 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
error: "",
// as we check for log output, set concurrency to 1 to avoid non-deterministic test result
concurrency: 1,
})
})
}
+418
View File
@@ -0,0 +1,418 @@
package app
import (
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
"github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestDiffWithNeeds(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
noHooks bool
}
type testcase struct {
fields fields
ns string
error string
selectors []string
diffed []exectest.Release
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantDiffs := tc.diffed
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: logging
chart: incubator/raw
namespace: kube-system
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
needs:
- kube-system/logging
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
# Disabled releases are treated as missing
- name: disabled
chart: incubator/raw
namespace: kube-system
installed: false
- name: test2
chart: incubator/raw
needs:
- kube-system/disabled
- name: test3
chart: incubator/raw
needs:
- test2
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: filesystem.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
diffErr := app.Diff(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
noHooks: tc.fields.noHooks,
})
var gotErr string
if diffErr != nil {
gotErr = diffErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
require.Equal(t, wantDiffs, helm.Diffed)
})
testhelper.RequireLog(t, "app_diff_test", bs)
}
t.Run("fail on unselected need by default", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test"},
error: `in ./helmfile.yaml: release "default/default/external-secrets" depends on "default/kube-system/kubernetes-external-secrets" which does not match the selectors. Please add a selector like "--selector name=kubernetes-external-secrets", or indicate whether to skip (--skip-needs) or include (--include-needs) these dependencies`,
})
})
t.Run("skip-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
selectors: []string{"app=test"},
diffed: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
{Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
},
})
})
t.Run("include-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
diffed: []exectest.Release{
// TODO: Turned out we can't differentiate needs vs transitive needs in this case :thinking:
{Name: "logging", Flags: []string{"--kube-context", "default", "--namespace", "kube-system", "--reset-values"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "kube-system", "--reset-values"}},
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
{Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
},
})
})
t.Run("include-transitive-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeTransitiveNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
diffed: []exectest.Release{
{Name: "logging", Flags: []string{"--kube-context", "default", "--namespace", "kube-system", "--reset-values"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "kube-system", "--reset-values"}},
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
{Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
},
})
})
t.Run("include-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test2"},
diffed: []exectest.Release{
{Name: "test2", Flags: []string{"--kube-context", "default", "--reset-values"}},
},
})
})
t.Run("include-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test3"},
diffed: []exectest.Release{
{Name: "test2", Flags: []string{"--kube-context", "default", "--reset-values"}},
{Name: "test3", Flags: []string{"--kube-context", "default", "--reset-values"}},
},
})
})
t.Run("include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: false,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
diffed: []exectest.Release{
{Name: "test2", Flags: []string{"--kube-context", "default", "--reset-values"}},
{Name: "test3", Flags: []string{"--kube-context", "default", "--reset-values"}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test2"},
diffed: []exectest.Release{
{Name: "test2", Flags: []string{"--kube-context", "default", "--reset-values"}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
diffed: []exectest.Release{
{Name: "test2", Flags: []string{"--kube-context", "default", "--reset-values"}},
{Name: "test3", Flags: []string{"--kube-context", "default", "--reset-values"}},
},
})
})
t.Run("no-hooks", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
noHooks: true,
},
selectors: []string{"app=test"},
diffed: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default", "--no-hooks", "--reset-values"}},
{Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default", "--no-hooks", "--reset-values"}},
},
})
})
t.Run("bad selector", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test_non_existent"},
diffed: nil,
error: "err: no releases found that matches specified selector(app=test_non_existent) and environment(default), in any helmfile",
})
})
}
func TestDiffWithInstalled(t *testing.T) {
type testcase struct {
helmfile string
ns string
error string
selectors []string
lists map[exectest.ListKey]string
diffed []exectest.Release
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantDiffs := tc.diffed
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
Lists: tc.lists,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": tc.helmfile,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: filesystem.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
diffErr := app.Diff(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
skipNeeds: true,
})
var gotErr string
if diffErr != nil {
gotErr = diffErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
require.Equal(t, wantDiffs, helm.Diffed)
})
testhelper.RequireLog(t, "app_diff_test", bs)
}
t.Run("show diff on changed selected release", func(t *testing.T) {
check(t, testcase{
helmfile: `
releases:
- name: a
chart: incubator/raw
namespace: default
- name: b
chart: incubator/raw
namespace: default
`,
selectors: []string{"name=a"},
lists: map[exectest.ListKey]string{
{Filter: "^a$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
foo 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default
`,
},
diffed: []exectest.Release{
{Name: "a", Flags: []string{"--kube-context", "default", "--namespace", "default", "--reset-values"}},
},
})
})
t.Run("shows no diff on already uninstalled selected release", func(t *testing.T) {
check(t, testcase{
helmfile: `
releases:
- name: a
chart: incubator/raw
installed: false
namespace: default
- name: b
chart: incubator/raw
namespace: default
`,
selectors: []string{"name=a"},
lists: map[exectest.ListKey]string{
{Filter: "^a$", Flags: listFlags("default", "default")}: ``,
},
})
})
}
+309
View File
@@ -0,0 +1,309 @@
package app
import (
"os"
"path/filepath"
"strings"
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
ffs "github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestLint(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
}
type testcase struct {
fields fields
ns string
error string
selectors []string
linted []exectest.Release
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantLints := tc.linted
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: logging
chart: incubator/raw
namespace: kube-system
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
needs:
- kube-system/logging
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
# Disabled releases are treated as missing
- name: disabled
chart: incubator/raw
namespace: kube-system
installed: false
- name: test2
chart: incubator/raw
needs:
- kube-system/disabled
- name: test3
chart: incubator/raw
needs:
- test2
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: ffs.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
lintErr := app.Lint(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
})
var gotErr string
if lintErr != nil {
gotErr = lintErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
require.Equal(t, wantLints, helm.Linted)
})
testNameComponents := strings.Split(t.Name(), "/")
testBaseName := strings.ToLower(
strings.ReplaceAll(
testNameComponents[len(testNameComponents)-1],
" ",
"_",
),
)
wantLogFileDir := filepath.Join("testdata", "app_lint_test")
wantLogFile := filepath.Join(wantLogFileDir, testBaseName)
wantLogData, err := os.ReadFile(wantLogFile)
updateLogFile := err != nil
wantLog := string(wantLogData)
gotLog := bs.String()
if updateLogFile {
if err := os.MkdirAll(wantLogFileDir, 0755); err != nil {
t.Fatalf("unable to create directory %q: %v", wantLogFileDir, err)
}
if err := os.WriteFile(wantLogFile, bs.Bytes(), 0644); err != nil {
t.Fatalf("unable to update lint log snapshot: %v", err)
}
}
diff, exists := testhelper.Diff(wantLog, gotLog, 3)
if exists {
t.Errorf("unexpected log:\nDIFF\n%s\nEOD", diff)
}
}
t.Run("fail on unselected need by default", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test"},
error: `in ./helmfile.yaml: release "default/default/external-secrets" depends on "default/kube-system/kubernetes-external-secrets" which does not match the selectors. Please add a selector like "--selector name=kubernetes-external-secrets", or indicate whether to skip (--skip-needs) or include (--include-needs) these dependencies`,
})
})
t.Run("skip-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
selectors: []string{"app=test"},
linted: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
linted: []exectest.Release{
// TODO: Turned out we can't differentiate needs vs transitive needs in this case :thinking:
{Name: "logging", Flags: []string{"--namespace", "kube-system"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--namespace", "kube-system"}},
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-transitive-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeTransitiveNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
linted: []exectest.Release{
{Name: "logging", Flags: []string{"--namespace", "kube-system"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--namespace", "kube-system"}},
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test2"},
linted: []exectest.Release{
{Name: "test2", Flags: []string{}},
},
})
})
t.Run("include-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test3"},
linted: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: false,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
linted: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test2"},
linted: []exectest.Release{
{Name: "test2", Flags: []string{}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
linted: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("bad selector", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test_non_existent"},
linted: nil,
error: "err: no releases found that matches specified selector(app=test_non_existent) and environment(default), in any helmfile",
})
})
}
+297
View File
@@ -0,0 +1,297 @@
package app
import (
"bytes"
"os"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
ffs "github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/testhelper"
"github.com/helmfile/helmfile/pkg/testutil"
)
func testListWithEnvironment(t *testing.T, cfg configImpl) {
type testcase struct {
environment string
ns string
error string
selectors []string
expected string
}
check := func(t *testing.T, tc testcase, cfg configImpl) {
t.Helper()
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.d/helmfile_1.yaml": `
environments:
development: {}
shared: {}
releases:
- name: logging
chart: incubator/raw
namespace: kube-system
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
needs:
- kube-system/logging
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
# Disabled releases are treated as missing
- name: disabled
chart: incubator/raw
namespace: kube-system
installed: false
- name: test2
chart: incubator/raw
needs:
- kube-system/disabled
- name: test3
chart: incubator/raw
needs:
- test2
`,
"/path/to/helmfile.d/helmfile_2.yaml": `
environments:
test: {}
shared: {}
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: cache
namespace: my-app
chart: bitnami/redis
version: 17.0.7
labels:
app: test
- name: database
namespace: my-app
chart: bitnami/postgres
version: 11.6.22
`,
"/path/to/helmfile.d/helmfile_3.yaml": `
releases:
- name: global
chart: incubator/raw
namespace: kube-system
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: ffs.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: tc.environment,
Logger: logger,
valsRuntime: valsRuntime,
}, files)
expectNoCallsToHelm(app)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
var listErr error
out := testutil.CaptureStdout(func() {
listErr = app.ListReleases(cfg)
})
var gotErr string
if listErr != nil {
gotErr = listErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
assert.Equal(t, tc.expected, out)
})
testhelper.RequireLog(t, "app_list_test", bs)
}
t.Run("default environment includes all releases", func(t *testing.T) {
check(t, testcase{
environment: "default",
expected: `NAME NAMESPACE ENABLED INSTALLED LABELS CHART VERSION
logging kube-system true true incubator/raw
kubernetes-external-secrets kube-system true true incubator/raw
external-secrets default true true app:test incubator/raw
my-release default true true app:test incubator/raw
disabled kube-system true false incubator/raw
test2 true true incubator/raw
test3 true true incubator/raw
cache my-app true true app:test bitnami/redis 17.0.7
database my-app true true bitnami/postgres 11.6.22
global kube-system true true incubator/raw
`,
}, cfg)
})
t.Run("fail on unknown environment", func(t *testing.T) {
check(t, testcase{
environment: "staging",
error: `err: no releases found that matches specified selector() and environment(staging), in any helmfile`,
}, cfg)
})
t.Run("list releases matching selector and environment", func(t *testing.T) {
check(t, testcase{
environment: "development",
selectors: []string{"app=test"},
expected: `NAME NAMESPACE ENABLED INSTALLED LABELS CHART VERSION
external-secrets default true true app:test,chart:raw,name:external-secrets,namespace:default incubator/raw
my-release default true true app:test,chart:raw,name:my-release,namespace:default incubator/raw
`,
}, cfg)
})
t.Run("filters releases for environment used in one file only", func(t *testing.T) {
check(t, testcase{
environment: "test",
expected: `NAME NAMESPACE ENABLED INSTALLED LABELS CHART VERSION
cache my-app true true app:test bitnami/redis 17.0.7
database my-app true true bitnami/postgres 11.6.22
`,
}, cfg)
})
t.Run("filters releases for environment used in multiple files", func(t *testing.T) {
check(t, testcase{
environment: "shared",
// 'global' release has no environments, so is still excluded
expected: `NAME NAMESPACE ENABLED INSTALLED LABELS CHART VERSION
logging kube-system true true incubator/raw
kubernetes-external-secrets kube-system true true incubator/raw
external-secrets default true true app:test incubator/raw
my-release default true true app:test incubator/raw
disabled kube-system true false incubator/raw
test2 true true incubator/raw
test3 true true incubator/raw
cache my-app true true app:test bitnami/redis 17.0.7
database my-app true true bitnami/postgres 11.6.22
`,
}, cfg)
})
}
func TestListWithEnvironment(t *testing.T) {
t.Run("with skipCharts=false", func(t *testing.T) {
testListWithEnvironment(t, configImpl{skipCharts: false})
})
t.Run("with skipCharts=true", func(t *testing.T) {
testListWithEnvironment(t, configImpl{skipCharts: true})
})
}
func testListWithJSONOutput(t *testing.T, cfg configImpl) {
cfg.output = "json"
files := map[string]string{
"/path/to/helmfile.d/first.yaml": `
environments:
default:
values:
- myrelease2:
enabled: false
releases:
- name: myrelease1
chart: mychart1
installed: false
labels:
id: myrelease1
- name: myrelease2
chart: mychart1
condition: myrelease2.enabled
`,
"/path/to/helmfile.d/second.yaml": `
releases:
- name: myrelease3
chart: mychart1
installed: true
- name: myrelease4
chart: mychart1
labels:
id: myrelease1
`,
}
stdout := os.Stdout
defer func() { os.Stdout = stdout }()
var buffer bytes.Buffer
logger := helmexec.NewLogger(&buffer, "debug")
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: ffs.DefaultFileSystem(),
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
Namespace: "testNamespace",
}, files)
expectNoCallsToHelm(app)
out := testutil.CaptureStdout(func() {
err := app.ListReleases(cfg)
assert.Nil(t, err)
})
expected := `[{"name":"myrelease1","namespace":"testNamespace","enabled":true,"installed":false,"labels":"id:myrelease1","chart":"mychart1","version":""},{"name":"myrelease2","namespace":"testNamespace","enabled":false,"installed":true,"labels":"","chart":"mychart1","version":""},{"name":"myrelease3","namespace":"testNamespace","enabled":true,"installed":true,"labels":"","chart":"mychart1","version":""},{"name":"myrelease4","namespace":"testNamespace","enabled":true,"installed":true,"labels":"id:myrelease1","chart":"mychart1","version":""}]
`
assert.Equal(t, expected, out)
}
func TestListWithJSONOutput(t *testing.T) {
t.Run("with skipCharts=false", func(t *testing.T) {
testListWithJSONOutput(t, configImpl{skipCharts: false})
})
t.Run("with skipCharts=true", func(t *testing.T) {
testListWithJSONOutput(t, configImpl{skipCharts: true})
})
}
File diff suppressed because it is too large Load Diff
+497
View File
@@ -0,0 +1,497 @@
package app
import (
"os"
"path/filepath"
"strings"
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/exectest"
ffs "github.com/helmfile/helmfile/pkg/filesystem"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/runtime"
"github.com/helmfile/helmfile/pkg/testhelper"
)
func TestTemplate(t *testing.T) {
type fields struct {
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
}
type testcase struct {
fields fields
ns string
error string
selectors []string
templated []exectest.Release
}
check := func(t *testing.T, tc testcase) {
t.Helper()
wantTemplates := tc.templated
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
bs := runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: logging
chart: incubator/raw
namespace: kube-system
- name: kubernetes-external-secrets
chart: incubator/raw
namespace: kube-system
needs:
- kube-system/logging
- name: external-secrets
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- kube-system/kubernetes-external-secrets
- name: my-release
chart: incubator/raw
namespace: default
labels:
app: test
needs:
- default/external-secrets
# Disabled releases are treated as missing
- name: disabled
chart: incubator/raw
namespace: kube-system
installed: false
- name: test2
chart: incubator/raw
needs:
- kube-system/disabled
- name: test3
chart: incubator/raw
needs:
- test2
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: &ffs.FileSystem{Glob: filepath.Glob},
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
if tc.selectors != nil {
app.Selectors = tc.selectors
}
tmplErr := app.Template(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
skipNeeds: tc.fields.skipNeeds,
includeNeeds: tc.fields.includeNeeds,
includeTransitiveNeeds: tc.fields.includeTransitiveNeeds,
})
var gotErr string
if tmplErr != nil {
gotErr = tmplErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
require.Equal(t, wantTemplates, helm.Templated)
})
testNameComponents := strings.Split(t.Name(), "/")
testBaseName := strings.ToLower(
strings.ReplaceAll(
testNameComponents[len(testNameComponents)-1],
" ",
"_",
),
)
wantLogFileDir := filepath.Join("testdata", "app_template_test")
wantLogFile := filepath.Join(wantLogFileDir, testBaseName)
wantLogData, err := os.ReadFile(wantLogFile)
updateLogFile := err != nil
wantLog := string(wantLogData)
gotLog := bs.String()
if updateLogFile {
if err := os.MkdirAll(wantLogFileDir, 0755); err != nil {
t.Fatalf("unable to create directory %q: %v", wantLogFileDir, err)
}
if err := os.WriteFile(wantLogFile, bs.Bytes(), 0644); err != nil {
t.Fatalf("unable to update lint log snapshot: %v", err)
}
}
diff, exists := testhelper.Diff(wantLog, gotLog, 3)
if exists {
t.Errorf("unexpected log:\nDIFF\n%s\nEOD", diff)
}
}
t.Run("fail on unselected need by default", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test"},
error: `in ./helmfile.yaml: release "default/default/external-secrets" depends on "default/kube-system/kubernetes-external-secrets" which does not match the selectors. Please add a selector like "--selector name=kubernetes-external-secrets", or indicate whether to skip (--skip-needs) or include (--include-needs) these dependencies`,
})
})
t.Run("skip-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: true,
},
selectors: []string{"app=test"},
templated: []exectest.Release{
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
templated: []exectest.Release{
// TODO: Turned out we can't differentiate needs vs transitive needs in this case :thinking:
{Name: "logging", Flags: []string{"--namespace", "kube-system"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--namespace", "kube-system"}},
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-transitive-needs", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeTransitiveNeeds: true,
},
error: ``,
selectors: []string{"app=test"},
templated: []exectest.Release{
{Name: "logging", Flags: []string{"--namespace", "kube-system"}},
{Name: "kubernetes-external-secrets", Flags: []string{"--namespace", "kube-system"}},
{Name: "external-secrets", Flags: []string{"--namespace", "default"}},
{Name: "my-release", Flags: []string{"--namespace", "default"}},
},
})
})
t.Run("include-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test2"},
templated: []exectest.Release{
{Name: "test2", Flags: []string{}},
},
})
})
t.Run("include-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
},
selectors: []string{"name=test3"},
templated: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: false,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
templated: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled direct need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test2"},
templated: []exectest.Release{
{Name: "test2", Flags: []string{}},
},
})
})
t.Run("include-needs with include-transitive-needs should not fail on disabled transitive need", func(t *testing.T) {
check(t, testcase{
fields: fields{
skipNeeds: false,
includeNeeds: true,
includeTransitiveNeeds: true,
},
selectors: []string{"name=test3"},
templated: []exectest.Release{
{Name: "test2", Flags: []string{}},
{Name: "test3", Flags: []string{}},
},
})
})
t.Run("bad selector", func(t *testing.T) {
check(t, testcase{
selectors: []string{"app=test_non_existent"},
templated: nil,
error: "err: no releases found that matches specified selector(app=test_non_existent) and environment(default), in any helmfile",
})
})
}
func TestTemplate_StrictParsing(t *testing.T) {
type testcase struct {
goccyGoYaml bool
ns string
error string
}
check := func(t *testing.T, tc testcase) {
t.Helper()
v := runtime.GoccyGoYaml
runtime.GoccyGoYaml = tc.goccyGoYaml
t.Cleanup(func() {
runtime.GoccyGoYaml = v
})
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
Helm3: true,
}
_ = runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": `
releases:
- name: app1
foobar: FOOBAR
chart: incubator/raw
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: &ffs.FileSystem{Glob: filepath.Glob},
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
tmplErr := app.Template(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
})
var gotErr string
if tmplErr != nil {
gotErr = tmplErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
})
}
t.Run("fail due to unknown field with goccy/go-yaml", func(t *testing.T) {
check(t, testcase{
goccyGoYaml: true,
error: `in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: [4:3] unknown field "foobar"
2 | releases:
3 | - name: app1
> 4 | foobar: FOOBAR
^
5 | chart: incubator/raw`,
})
})
t.Run("fail due to unknown field with gopkg.in/yaml.v2", func(t *testing.T) {
check(t, testcase{
goccyGoYaml: false,
error: `in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
line 4: field foobar not found in type state.ReleaseSpec`,
})
})
}
func TestTemplate_CyclicInheritance(t *testing.T) {
type testcase struct {
ns string
error string
}
check := func(t *testing.T, tc testcase) {
t.Helper()
var helm = &exectest.Helm{
FailOnUnexpectedList: true,
FailOnUnexpectedDiff: true,
DiffMutex: &sync.Mutex{},
ChartsMutex: &sync.Mutex{},
ReleasesMutex: &sync.Mutex{},
}
_ = runWithLogCapture(t, "debug", func(t *testing.T, logger *zap.SugaredLogger) {
t.Helper()
valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
if err != nil {
t.Errorf("unexpected error creating vals runtime: %v", err)
}
files := map[string]string{
"/path/to/helmfile.yaml": `
templates:
a:
inherit:
- template: b
values:
- a.yaml
b:
inherit:
- template: c
values:
- b.yaml
c:
inherit:
- template: a
values:
- c.yaml
releases:
- name: app1
inherit:
- template: a
chart: incubator/raw
`,
}
app := appWithFs(&App{
OverrideHelmBinary: DefaultHelmBinary,
fs: &ffs.FileSystem{Glob: filepath.Glob},
OverrideKubeContext: "default",
Env: "default",
Logger: logger,
helms: map[helmKey]helmexec.Interface{
createHelmKey("helm", "default"): helm,
},
valsRuntime: valsRuntime,
}, files)
if tc.ns != "" {
app.Namespace = tc.ns
}
tmplErr := app.Template(applyConfig{
// if we check log output, concurrency must be 1. otherwise the test becomes non-deterministic.
concurrency: 1,
logger: logger,
})
var gotErr string
if tmplErr != nil {
gotErr = tmplErr.Error()
}
if d := cmp.Diff(tc.error, gotErr); d != "" {
t.Fatalf("unexpected error: want (-), got (+): %s", d)
}
})
}
t.Run("fail due to cyclic inheritance", func(t *testing.T) {
check(t, testcase{
error: `in ./helmfile.yaml: failed executing release templates in "helmfile.yaml": unable to load release "app1" with template: cyclic inheritance detected: a->b->c->a`,
})
})
}
+1575 -1073
View File
File diff suppressed because it is too large Load Diff
+129
View File
@@ -5,10 +5,14 @@ import "go.uber.org/zap"
type ConfigProvider interface {
Args() string
HelmBinary() string
EnableLiveOutput() bool
DisableForceUpdate() bool
SkipDeps() bool
FileOrDir() string
KubeContext() string
Namespace() string
Chart() string
Selectors() []string
StateValuesSet() map[string]interface{}
StateValuesFiles() []string
@@ -17,72 +21,136 @@ type ConfigProvider interface {
loggingConfig
}
// TODO: Remove this function once Helmfile v0.x
type DeprecatedChartsConfigProvider interface {
Values() []string
concurrencyConfig
loggingConfig
IncludeTransitiveNeeds() bool
}
type DepsConfigProvider interface {
Args() string
SkipRepos() bool
IncludeTransitiveNeeds() bool
concurrencyConfig
}
type ReposConfigProvider interface {
Args() string
IncludeTransitiveNeeds() bool
}
type ApplyConfigProvider interface {
Args() string
PostRenderer() string
Cascade() string
Values() []string
Set() []string
SkipCRDs() bool
SkipDeps() bool
Wait() bool
WaitForJobs() bool
IncludeTests() bool
Suppress() []string
SuppressSecrets() bool
ShowSecrets() bool
NoHooks() bool
SuppressDiff() bool
DetailedExitcode() bool
StripTrailingCR() bool
Color() bool
NoColor() bool
Context() int
DiffOutput() string
// TODO: Remove this function once Helmfile v0.x
RetainValuesFiles() bool
Validate() bool
SkipCleanup() bool
SkipDiffOnInstall() bool
DAGConfig
concurrencyConfig
interactive
loggingConfig
valuesControlMode
}
type SyncConfigProvider interface {
Args() string
PostRenderer() string
Cascade() string
Values() []string
Set() []string
SkipCRDs() bool
SkipDeps() bool
Wait() bool
WaitForJobs() bool
Validate() bool
SkipNeeds() bool
IncludeNeeds() bool
IncludeTransitiveNeeds() bool
DAGConfig
concurrencyConfig
interactive
loggingConfig
valuesControlMode
}
type DiffConfigProvider interface {
Args() string
PostRenderer() string
Values() []string
Set() []string
Validate() bool
SkipCRDs() bool
SkipDeps() bool
IncludeTests() bool
Suppress() []string
SuppressSecrets() bool
ShowSecrets() bool
NoHooks() bool
SuppressDiff() bool
SkipDiffOnInstall() bool
DAGConfig
DetailedExitcode() bool
StripTrailingCR() bool
Color() bool
NoColor() bool
Context() int
DiffOutput() string
concurrencyConfig
valuesControlMode
}
// TODO: Remove this function once Helmfile v0.x
type DeleteConfigProvider interface {
Args() string
Cascade() string
Purge() bool
SkipDeps() bool
SkipCharts() bool
interactive
loggingConfig
@@ -91,6 +159,10 @@ type DeleteConfigProvider interface {
type DestroyConfigProvider interface {
Args() string
Cascade() string
SkipDeps() bool
SkipCharts() bool
interactive
loggingConfig
@@ -100,8 +172,10 @@ type DestroyConfigProvider interface {
type TestConfigProvider interface {
Args() string
SkipDeps() bool
Timeout() int
Cleanup() bool
Logs() bool
concurrencyConfig
}
@@ -112,17 +186,54 @@ type LintConfigProvider interface {
Values() []string
Set() []string
SkipDeps() bool
SkipCleanup() bool
DAGConfig
concurrencyConfig
}
type FetchConfigProvider interface {
SkipDeps() bool
OutputDir() string
OutputDirTemplate() string
concurrencyConfig
}
type TemplateConfigProvider interface {
Args() string
PostRenderer() string
Values() []string
Set() []string
OutputDirTemplate() string
Validate() bool
SkipDeps() bool
SkipCleanup() bool
SkipTests() bool
OutputDir() string
IncludeCRDs() bool
KubeVersion() string
DAGConfig
concurrencyConfig
}
type DAGConfig interface {
SkipNeeds() bool
IncludeNeeds() bool
IncludeTransitiveNeeds() bool
}
type WriteValuesConfigProvider interface {
Values() []string
Set() []string
OutputFileTemplate() string
SkipDeps() bool
SkipCleanup() bool
IncludeTransitiveNeeds() bool
concurrencyConfig
}
@@ -134,6 +245,7 @@ type StatusesConfigProvider interface {
}
type StateConfigProvider interface {
EmbedValues() bool
}
type concurrencyConfig interface {
@@ -147,3 +259,20 @@ type loggingConfig interface {
type interactive interface {
Interactive() bool
}
type ListConfigProvider interface {
Output() string
SkipCharts() bool
}
type CacheConfigProvider interface{}
type InitConfigProvider interface {
Force() bool
}
// reset/reuse values helm cli flags handling for apply/sync/diff
type valuesControlMode interface {
ReuseValues() bool
ResetValues() bool
}
+8 -5
View File
@@ -3,20 +3,23 @@ package app
import (
"os"
"strings"
"github.com/helmfile/helmfile/pkg/envvar"
)
const (
DefaultHelmfile = "helmfile.yaml"
DeprecatedHelmfile = "charts.yaml"
DefaultHelmfile = "helmfile.yaml"
// TODO: Remove this function once Helmfile v0.x
DeprecatedHelmfile = "charts.yaml"
DefaultHelmfileDirectory = "helmfile.d"
ExperimentalEnvVar = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case
ExperimentalSelectorExplicit = "explicit-selector-inheritance" // value to remove default selector inheritance to sub-helmfiles and use the explicit one
)
func experimentalModeEnabled() bool {
return os.Getenv(ExperimentalEnvVar) == "true"
return os.Getenv(envvar.Experimental) == "true"
}
func isExplicitSelectorInheritanceEnabled() bool {
return experimentalModeEnabled() || strings.Contains(os.Getenv(ExperimentalEnvVar), ExperimentalSelectorExplicit)
return experimentalModeEnabled() || strings.Contains(os.Getenv(envvar.Experimental), ExperimentalSelectorExplicit)
}

Some files were not shown because too many files have changed in this diff Show More