Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(update-methods.md):add escaping to the template so helm doesn't consume it #888

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/basics/update-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ By default Argo CD Image Updater re-uses the credentials you have configured
in Argo CD for accessing the repository.

If you don't want to use credentials configured for Argo CD you can use other credentials stored in a Kubernetes secret,
which needs to be accessible by the Argo CD Image Updater's Service Account. The secret should be specified in
which needs to be accessible by the Argo CD Image Updater's Service Account. The secret should be specified in
`argocd-image-updater.argoproj.io/write-back-method` annotation using `git:<credref>` format. Where `<credref>` might
take one of following values:

Expand Down Expand Up @@ -161,7 +161,7 @@ kubectl -n argocd-image-updater create secret generic git-creds \
By default, Argo CD Image Updater will use the value found in the Application
spec at `.spec.source.repoURL` as Git repository to checkout. But when using
a Helm repository as `.spec.source.repoURL` GIT will simply fail. To manually
specify the repository to push the changes, specify the
specify the repository to push the changes, specify the
annotation `argocd-image-updater.argoproj.io/git-repository` on the Application
manifest.

Expand Down Expand Up @@ -214,8 +214,10 @@ the annotation. For example, the following would create a branch named
`image-updater-foo/bar-1.1` based on `main` in the event an image with
the name `foo/bar` was updated to the new tag `1.1`.

Helm will try to consume this template unless you escape the opening and closing brackets.

```yaml
argocd-image-updater.argoproj.io/git-branch: main:image-updater{{range .Images}}-{{.Name}}-{{.NewTag}}{{end}}
argocd-image-updater.argoproj.io/git-branch: main:image-updater{{"{{"}}range .Images{{"}}"}}-{{"{{"}}.Name{{"}}"}}-{{"{{"}}.NewTag{{"}}"}}{{"{{"}}end{{"}}"}}
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to keep the original form for non-helm cases, and also for easy viewing of the real value? We can add the helm-escaped form for helm cases.


Alternatively, to assure unique branch names you could use the SHA1 representation of the changes:
Expand Down Expand Up @@ -349,7 +351,7 @@ You may also specify which kustomization to update with either a path relative t

```yaml
argocd-image-updater.argoproj.io/write-back-target: "kustomization:../../base"
# if the Application spec.source.path = config/overlays/foo, this would update the kustomization in config/base
# if the Application spec.source.path = config/overlays/foo, this would update the kustomization in config/base
```

...or absolute with respect to the repository:
Expand All @@ -374,7 +376,7 @@ You may also specify which helmvalues to update with either a path relative to t

```yaml
argocd-image-updater.argoproj.io/write-back-target: "helmvalues:../../values.yaml"
# if the Application spec.source.path = config/overlays/foo, this would update the helmvalues in config/base
# if the Application spec.source.path = config/overlays/foo, this would update the helmvalues in config/base
```

...or absolute with respect to the repository:
Expand Down