From f07ee3b2f493d5fa13a5f4e78ecebd47d9dd91b1 Mon Sep 17 00:00:00 2001 From: Faeka Ansari Date: Tue, 17 Dec 2024 22:07:09 +0530 Subject: [PATCH] add docs Signed-off-by: Faeka Ansari --- docs/docs/35-references/10-promotion-steps.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/docs/35-references/10-promotion-steps.md b/docs/docs/35-references/10-promotion-steps.md index f168c38cc..298309669 100644 --- a/docs/docs/35-references/10-promotion-steps.md +++ b/docs/docs/35-references/10-promotion-steps.md @@ -539,6 +539,53 @@ steps: |------|------|-------------| | `commitMessage` | `string` | A description of the change(s) applied by this step. Typically, a subsequent [`git-commit`](#git-commit) step will reference this output and aggregate this commit message fragment with other like it to build a comprehensive commit message that describes all changes. | +### `json-update` + +`json-update` updates the values of specified keys in any JSON file. + +#### `json-update` Configuration + +| Name | Type | Required | Description | +|------|------|----------|-------------| +| `path` | `string` | Y | Path to a JSON file. This path is relative to the temporary workspace that Kargo provisions for use by the promotion process. | | +| `updates` | `[]object` | Y | The details of changes to be applied to the file. At least one must be specified. | +| `updates[].key` | `string` | Y | The key to update within the file. For nested values, use a JSON dot notation path. See [sjson documentation](https://github.com/tidwall/sjson) for supported syntax. | +| `updates[].value`| `any` | Y | The new value for the key. Typically specified using an expression. Supports strings, numbers, booleans, arrays, and objects. | + +#### `json-update` Example + +```yaml +vars: +- name: gitRepo + value: https://github.com/example/repo.git +steps: +- uses: git-clone + config: + repoURL: ${{ vars.gitRepo }} + checkout: + - commit: ${{ commitFrom(vars.gitRepo).ID }} + path: ./src + - branch: stage/${{ ctx.stage }} + create: true + path: ./out + - uses: git-clear + config: + path: ./out +- uses: json-update + config: + path: configs/settings.json + updates: + - key: image.tag + value: ${{ imageFrom("my/image").Tag }} +# Render manifests to ./out, commit, push, etc... +``` + +#### `json-update` Output + +| Name | Type | Description | +|------|------|-------------| +| `commitMessage` | `string` | A description of the change(s) applied by this step. Typically, a subsequent [`git-commit`](#git-commit) step will reference this output and aggregate this commit message fragment with other like it to build a comprehensive commit message that describes all changes. | + ### `yaml-update` `yaml-update` updates the values of specified keys in any YAML file. This step