diff --git a/docs/content/en/docs/user-guide/configuration-reference.md b/docs/content/en/docs/user-guide/configuration-reference.md index 399f989b3c..8f538b57ad 100644 --- a/docs/content/en/docs/user-guide/configuration-reference.md +++ b/docs/content/en/docs/user-guide/configuration-reference.md @@ -152,7 +152,7 @@ One of `yamlField` or `regex` is required. | Field | Type | Description | Required | |-|-|-|-| -| file | string | The path to the file to be updated. | Yes | +| file | string | The relative path from the repository root to the file to be updated. | Yes | | yamlField | string | The yaml path to the field to be updated. It requires to start with `$` which represents the root element. e.g. `$.foo.bar[0].baz`. | No | | regex | string | The regex string that specify what should be replaced. The only first capturing group enclosed by `()` will be replaced with the new value. e.g. `host.xz/foo/bar:(v[0-9].[0-9].[0-9])` | No | diff --git a/docs/content/en/docs/user-guide/event-watcher.md b/docs/content/en/docs/user-guide/event-watcher.md index ac58512428..f1c27f2528 100644 --- a/docs/content/en/docs/user-guide/event-watcher.md +++ b/docs/content/en/docs/user-guide/event-watcher.md @@ -156,7 +156,7 @@ spec: + version: 0.2.0 ``` -See [here](https://github.com/pipe-cd/examples/blob/master/.pipe/event-watcher.yaml) for more examples. +See [here](https://github.com/pipe-cd/examples/blob/master/.pipe) for more examples. ## Github Actions If you're using Github Actions in your CI workflow, [actions-event-register](https://github.com/marketplace/actions/pipecd-register-event) is for you! diff --git a/examples/.pipe/event-watcher-helm.yaml b/examples/.pipe/event-watcher-helm.yaml new file mode 100644 index 0000000000..3b5e023cf9 --- /dev/null +++ b/examples/.pipe/event-watcher-helm.yaml @@ -0,0 +1,9 @@ +apiVersion: pipecd.dev/v1beta1 +kind: EventWatcher +spec: + events: + # For those who want to update the deployment config file when releasing a new Helm package. + - name: helm-release + replacements: + - file: kubernetes/helm-remote-chart/.pipe.yaml + yamlField: $.spec.input.helmChart.version diff --git a/examples/.pipe/event-watcher-k8s.yaml b/examples/.pipe/event-watcher-k8s.yaml new file mode 100644 index 0000000000..ada2b1bbe9 --- /dev/null +++ b/examples/.pipe/event-watcher-k8s.yaml @@ -0,0 +1,17 @@ +apiVersion: pipecd.dev/v1beta1 +kind: EventWatcher +spec: + events: + # For those who want to update the manifest file when a new docker image was pushed. + - name: image-update + replacements: + - file: kubernetes/simple/deployment.yaml + yamlField: $.spec.template.spec.containers[0].image + # For those who want to identify Events using labels. + - name: image-update + labels: + repoId: repo-1 + appName: simple + replacements: + - file: kubernetes/simple/deployment.yaml + yamlField: $.spec.template.spec.containers[0].image diff --git a/examples/.pipe/event-watcher-using-regex.yaml b/examples/.pipe/event-watcher-using-regex.yaml new file mode 100644 index 0000000000..a89d1f4ac7 --- /dev/null +++ b/examples/.pipe/event-watcher-using-regex.yaml @@ -0,0 +1,9 @@ +apiVersion: pipecd.dev/v1beta1 +kind: EventWatcher +spec: + events: + # For those who want to update a file using regex + - name: image-update-with-regex + replacements: + - file: kubernetes/simple/deployment.yaml + regex: "image: gcr.io/pipecd/helloworld:(v[0-9].[0-9].[0-9])" diff --git a/examples/.pipe/event-watcher.yaml b/examples/.pipe/event-watcher.yaml deleted file mode 100644 index 5957d051cd..0000000000 --- a/examples/.pipe/event-watcher.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: pipecd.dev/v1beta1 -kind: EventWatcher -spec: - events: - # For those who want to update the manifest file when a new docker image was pushed. - - name: helloworld-image-update - replacements: - - file: helloworld/deployment.yaml - yamlField: $.spec.template.spec.containers[0].image - # For those who want to update the deployment config file when releasing a new Helm package. - - name: helloworld-helm-release - replacements: - - file: helloworld/.pipe.yaml - yamlField: $.spec.input.helmChart.version - # For those who want to identify Events using labels. - - name: image-update - labels: - repoId: repo-1 - appName: helloworld - replacements: - - file: helloworld/deployment.yaml - yamlField: $.spec.template.spec.containers[0].image - # For those who want to update multiple files at once. - - name: helloworld-image-update - replacements: - - file: dev/helloworld/deployment.yaml - yamlField: $.spec.template.spec.containers[0].image - - file: stg/helloworld/deployment.yaml - yamlField: $.spec.template.spec.containers[0].image - # For those who want to update a file using regex - - name: helloworld-image-update-with-regex - replacements: - - file: helloworld/deployment.yaml - regex: "image: gcr.io/pipecd/helloworld:(v[0-9].[0-9].[0-9])"