argo-cd/docs/user-guide/jsonnet.md

35 lines
852 B
Markdown
Raw Normal View History

# Jsonnet
Feat: (Jsonnet) Add support to include library paths (#3825) * feat: added Libs field to ApplicationSourceJsonnet Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: codegen Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: implemented jsonnet jpath arguments - Implement the `-J` command line flag for jsonnet - adapt test to include a nested library for testing the VM functionality Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: jsonnet import path relative to the repoRoot - adapted testCase to make use of a jpath - join repoRoot and provided jpath attributes Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added checking for out-of-repoRoot references Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Added CLI option for passing jsonnet libs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Updated jsonnet docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: renamed function Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Expose --local-repo-root flag Allows passing a "virtal" git repository root when using the local sync mode with --local. Provides backwardscompatible with the previous default value ("/") Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added missing command Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * Remove obsolete line out of docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>
2020-07-13 21:18:21 +00:00
Any file matching `*.jsonnet` in a directory app is treated as a Jsonnet file. ArgoCD evaluates the Jsonnet and is able to parse a generated object or array.
## Build Environment
> v1.4
Jsonnet apps have access to the [standard build environment](build-environment.md) via substitution into *TLAs* and *external variables*.
2020-10-20 01:21:06 +00:00
It is also possible to add a shared library (e.g. `vendor` folder) relative to the repository root.
E.g. via the CLI:
```bash
argocd app create APPNAME \
--jsonnet-ext-str 'app=${ARGOCD_APP_NAME}' \
--jsonnet-tla-str 'ns=${ARGOCD_APP_NAMESPACE}' \
Feat: (Jsonnet) Add support to include library paths (#3825) * feat: added Libs field to ApplicationSourceJsonnet Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: codegen Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: implemented jsonnet jpath arguments - Implement the `-J` command line flag for jsonnet - adapt test to include a nested library for testing the VM functionality Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: jsonnet import path relative to the repoRoot - adapted testCase to make use of a jpath - join repoRoot and provided jpath attributes Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added checking for out-of-repoRoot references Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Added CLI option for passing jsonnet libs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Updated jsonnet docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: renamed function Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Expose --local-repo-root flag Allows passing a "virtal" git repository root when using the local sync mode with --local. Provides backwardscompatible with the previous default value ("/") Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added missing command Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * Remove obsolete line out of docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>
2020-07-13 21:18:21 +00:00
--jsonnet-libs 'vendor'
```
Or by declarative syntax:
```yaml
directory:
jsonnet:
extVars:
- name: app
value: $ARGOCD_APP_NAME
tlas:
- name: ns
value: $ARGOCD_APP_NAMESPACE
Feat: (Jsonnet) Add support to include library paths (#3825) * feat: added Libs field to ApplicationSourceJsonnet Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: codegen Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: implemented jsonnet jpath arguments - Implement the `-J` command line flag for jsonnet - adapt test to include a nested library for testing the VM functionality Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: jsonnet import path relative to the repoRoot - adapted testCase to make use of a jpath - join repoRoot and provided jpath attributes Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added checking for out-of-repoRoot references Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Added CLI option for passing jsonnet libs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Updated jsonnet docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: renamed function Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * feat: Expose --local-repo-root flag Allows passing a "virtal" git repository root when using the local sync mode with --local. Provides backwardscompatible with the previous default value ("/") Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * fix: added missing command Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com> * Remove obsolete line out of docs Signed-off-by: Matthias Riegler <matthias.riegler@taotesting.com>
2020-07-13 21:18:21 +00:00
libs:
- vendor
```