Commit Graph

28 Commits

Author SHA1 Message Date
Copilot d94a7ada2b
Migrate AWS SDK from v1 to v2 to resolve deprecation warnings (#2202)
* Migrate AWS SDK from v1 to v2 to resolve deprecation warnings

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

* Fix error message style issue for staticcheck

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2025-09-30 09:59:00 +08:00
Jess 9a88372449
Allow caching of remote files to be disabled (#2112)
* Allow caching of remote files to be disabled

Make it possible to automatically update the cache of remote
resources by disabling the caching of those resources using a query
string parameter (`cache=false`).

Signed-off-by: Jess <jess@ros.io>

* Fix test that broke

Because query parameters are being re-encoded, = is being encoded to %3D.

Signed-off-by: Jess <jess@ros.io>

* Add test for disabling caching of remote resources

Signed-off-by: Jess <jess@ros.io>

* Include example usage in docs

Signed-off-by: Jess <jess@ros.io>

---------

Signed-off-by: Jess <jess@ros.io>
2025-07-31 13:38:36 +08:00
anontrex 3df6442bd1
fix-insecure-flag (#2072)
Signed-off-by: tcase44 <toblerone.tc@gmail.com>
Co-authored-by: tcase44 <toblerone.tc@gmail.com>
2025-06-09 17:08:10 +08:00
Cyril Jouve e0f1f765c5
simplify multierr usage with standard errors (#1208) 2023-12-10 20:04:05 +08:00
xiaomudk 2c3bebb451
feat: support most remote urls (#1061)
* feat: support most remote urls

This adds support for s3:// http:// https:// and most other go-getter style urls by

- Adding http downloader
- Adding s3 downloader that authenticates with aws sdk shared credentials
- Changing the parser to accept remote formats that do not include '::'
- Removing validation that required go-getter urls to contain '@' which is not required by go-getter spec

Resolves #831

Signed-off-by: joshwoodcock <ltdwoodcock@gmail.com>

* Fix nil region

Signed-off-by: Josh Woodcock <b.woodcock@partner.samsung.com>

* fix golangci

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

* fix testcase error

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

* optimize code

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

* fix handle error

Signed-off-by: zhuxixi179 <zhuxixi179@hellobike.com>

---------

Signed-off-by: joshwoodcock <ltdwoodcock@gmail.com>
Signed-off-by: Josh Woodcock <b.woodcock@partner.samsung.com>
Signed-off-by: xiaomudk <xiaomudk@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Signed-off-by: zhuxixi179 <zhuxixi179@hellobike.com>
Co-authored-by: joshwoodcock <ltdwoodcock@gmail.com>
Co-authored-by: Josh Woodcock <b.woodcock@partner.samsung.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
Co-authored-by: zhuxixi179 <zhuxixi179@hellobike.com>
2023-10-17 18:48:04 -05:00
Quan TRAN 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
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
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 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
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 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
Arkaitz Jimenez cc33e7b7d8
Introduce Helmfile's own filesystem abstraction to correctly unit test some components (#307)
Use abstracted FS

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

Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
2022-08-24 12:58:43 +09:00
yxxhero 8690d63401 fix lint error
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-08-13 07:40:32 +08:00
yxxhero ac23def893 add Go lint
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-07-16 20:21:11 +08:00
Quan TRAN 577f54af7a
Introduce DISABLE_INSECURE_FEATURES to disable insecure command executions (#1)
* introduce DISABLE_INSECURE_FEATURES to disable insecure executions

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

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

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

* refactor envvar package

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

* (test) fix test fixtures

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

* use absolute path to avoid unit test failure

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

* Fix conflicts

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

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

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

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

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

* Update pkg/state/storage.go

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-06-05 15:08:38 +09:00
yxxhero 303ef9cd80 remove ioutil usage in all project
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-03 15:53:19 +08: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
Yusuke Kuoka f24b61f100
Fix error on concurrent go-getter on same URL (#1669)
Fixes #1660
2021-02-05 09:02:21 +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
art kon 06b0c99a0b Fix recursion for helmfiles pulled from git (#854) 2019-09-14 05:49:59 +02:00
Yusuke Kuoka cd5d906afb fix: clean up invalid remote state file cache
Fixes #815
2019-08-24 09:47:49 +09:00
KUOKA Yusuke b82f77ee50
fix: Absolute paths for -f not working on Windows (#721)
Fixes #718
2019-06-25 20:06:07 +09:00
KUOKA Yusuke e6bb8282db
fix: remote helmfile from git::ssh source (#719)
The remote helmfile feature introduced by #648 was unable to be sourced from private git repositories due to URL parsing issue in helmfile. This fixes that.

Ref https://github.com/roboll/helmfile/issues/469#issuecomment-505236600
2019-06-25 12:45:56 +09:00
KUOKA Yusuke 65d404b276
feat: `helmfile -f <go-getter url>` (#670)
Extends the remote-helmfile feature to also work when loading the first state file.
This should be useful for people who wants to give helmfile a try without ever opening `$EDITOR`.
2019-06-11 14:28:50 +09:00
KUOKA Yusuke 820abbc06d
feat: remote state files (#648)
This change enhances helmfile to accept terraform-module-like URLs in nested state files a.k.a sub-helmfiles.

```yaml
helmfiles:
- # Terraform-module-like URL for importing a remote directory and use a file in it as a nested-state file
  # The nested-state file is locally checked-out along with the remote directory containing it.
  # Therefore all the local paths in the file are resolved relative to the file
  path: git::https://github.com/cloudposse/helmfiles.git@releases/kiam.yaml?ref=0.40.0
```

The URL isn't equivalent to terraform module sources. The difference is that we use `@` to distinguish between (1) the path to the repository and directory containing the state file and (2) the path to the state file being loaded. This distinction provides us enough fleibiity to instruct helmfile to check-out necessary and sufficient directory to make the state file works.

Under the hood, it uses [hashicorp/go-getter](https://github.com/hashicorp/go-getter), that is used for [terraform module sources](https://www.terraform.io/docs/modules/sources.html) as well.

Only the git provider without authentication like git-credentials helper is tested. But theoretically any go-getter providers should work. Please feel free to test the provider of your choice and contribute documentation or instruction to use it :)

Resolves #347
2019-06-04 22:59:54 +09:00