From 6dd089258a380773f923505606064f4ad06c53b2 Mon Sep 17 00:00:00 2001 From: macolso Date: Tue, 5 Dec 2023 10:33:01 -0800 Subject: [PATCH 01/10] adding SUH card for cron trigger Signed-off-by: macolso --- content/api/hub/plugin_spin_cron_trigger.md | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 content/api/hub/plugin_spin_cron_trigger.md diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md new file mode 100644 index 000000000..0beff8e2b --- /dev/null +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -0,0 +1,40 @@ +title = "Spin Cron Trigger" +template = "render_hub_content_body" +date = "2022-10-15T00:22:56Z" +content-type = "text/plain" +tags = ["trigger", "rust"] + +[extra] +author = "Fermyon" +type = "hub_document" +category = "Plugin" +language = "Rust" +created_at = "2023-12-05T00:22:56Z" +last_updated = "2023-12-05T00:22:56Z" +spin_version = ">v1.0" +summary = "An experimental cron trigger for Spin apps" +url = "https://github.com/fermyon/spin-trigger-cron" +keywords = "trigger, cron" + +--- + + +An experimental plugin that enables cron trigger for Spin applications. + +### Prerequisites +* [Rust](https://www.rust-lang.org/tools/install) +* `pluginify` plugin (see below) + +```bash +spin plugins install --url https://github.com/itowlson/spin-pluginify/releases/download/canary/pluginify.json +``` + +### Creating Spin App With Cron Trigger + +After creating a Spin application and moving into the directory, add `cron_expression` as your desired trigger type in your application manifest and then specify the component you would like to handle that event on a seperate line. `cron_expression` follows standard cron syntax. The example below is triggered every 2 seconds). + +```toml +[[trigger.cron]] +component = "" +cron_expression = "1/2 * * * * *" +``` From e22be7604f5ce61c15e14fe257da6516dc0358af Mon Sep 17 00:00:00 2001 From: MacKenzie Olson Date: Tue, 5 Dec 2023 15:01:48 -0800 Subject: [PATCH 02/10] Apply suggestions from tpmccallum Co-authored-by: Timothy McCallum Signed-off-by: MacKenzie Olson --- content/api/hub/plugin_spin_cron_trigger.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index 0beff8e2b..6f043814f 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -11,14 +11,13 @@ category = "Plugin" language = "Rust" created_at = "2023-12-05T00:22:56Z" last_updated = "2023-12-05T00:22:56Z" -spin_version = ">v1.0" +spin_version = “>=2.0.1" summary = "An experimental cron trigger for Spin apps" url = "https://github.com/fermyon/spin-trigger-cron" keywords = "trigger, cron" --- - An experimental plugin that enables cron trigger for Spin applications. ### Prerequisites From da89bf033af2533723ab1f5b69855986bbf361bf Mon Sep 17 00:00:00 2001 From: MacKenzie Olson Date: Tue, 5 Dec 2023 17:18:05 -0800 Subject: [PATCH 03/10] Update content/api/hub/plugin_spin_cron_trigger.md Co-authored-by: Timothy McCallum Signed-off-by: MacKenzie Olson --- content/api/hub/plugin_spin_cron_trigger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index 6f043814f..2c6ad4d2a 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -11,7 +11,7 @@ category = "Plugin" language = "Rust" created_at = "2023-12-05T00:22:56Z" last_updated = "2023-12-05T00:22:56Z" -spin_version = “>=2.0.1" +spin_version = “>=v2.0.1" summary = "An experimental cron trigger for Spin apps" url = "https://github.com/fermyon/spin-trigger-cron" keywords = "trigger, cron" From 138d62651bdbb0acfd6f4529e6515c1f0dbbbdc9 Mon Sep 17 00:00:00 2001 From: macolso Date: Tue, 19 Dec 2023 12:17:17 -0800 Subject: [PATCH 04/10] updating readme with latest install instrctions Signed-off-by: macolso --- content/api/hub/plugin_spin_cron_trigger.md | 31 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index 2c6ad4d2a..b7153122e 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -21,16 +21,43 @@ keywords = "trigger, cron" An experimental plugin that enables cron trigger for Spin applications. ### Prerequisites + * [Rust](https://www.rust-lang.org/tools/install) * `pluginify` plugin (see below) ```bash spin plugins install --url https://github.com/itowlson/spin-pluginify/releases/download/canary/pluginify.json ``` +## Installing Template +You can install the template using the following command: + +```bash +spin templates install --git https://github.com/fermyon/spin-trigger-cron +``` + +Once the template is installed, you can create a new application using: + +```bash +spin new -t cron-rust hello_cron --accept-defaults +``` + +To run the newly created app: + +```bash +cd hello_cron +spin build --up +``` + +### Modifying The Cron Trigger + +The trigger type is cron and there are no application-level configuration options. -### Creating Spin App With Cron Trigger +The following options are available to set in the [[trigger.cron]] section: -After creating a Spin application and moving into the directory, add `cron_expression` as your desired trigger type in your application manifest and then specify the component you would like to handle that event on a seperate line. `cron_expression` follows standard cron syntax. The example below is triggered every 2 seconds). +| Name | Type | Required? | Description | +|-----------------------|------------------|-----------|-------------| +| `component` | string or table | required | The component to run on the schedule given in `cron_expression`. (This is the standard Spin trigger component field.) | +| `cron_expression` | string | required | The `cron` expresison describing the schedule on which to execute the component. | ```toml [[trigger.cron]] From c265d7397ebe1a475a43e33c2e4f5c4e3432443e Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 12:18:44 +1000 Subject: [PATCH 05/10] Update based on review comments Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum From 0c0c5bbdb0eb227f61c6e0ce14ae36514c43aca8 Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 12:22:00 +1000 Subject: [PATCH 06/10] Actually update file that responds to review comments Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum --- content/api/hub/plugin_spin_cron_trigger.md | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index b7153122e..1b00d6377 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -18,39 +18,37 @@ keywords = "trigger, cron" --- -An experimental plugin that enables cron trigger for Spin applications. +An experimental plugin that enables cron trigger for Spin applications. -### Prerequisites - -* [Rust](https://www.rust-lang.org/tools/install) -* `pluginify` plugin (see below) - -```bash -spin plugins install --url https://github.com/itowlson/spin-pluginify/releases/download/canary/pluginify.json -``` ## Installing Template You can install the template using the following command: + + ```bash -spin templates install --git https://github.com/fermyon/spin-trigger-cron +$ spin templates install --git https://github.com/fermyon/spin-trigger-cron ``` Once the template is installed, you can create a new application using: + + ```bash -spin new -t cron-rust hello_cron --accept-defaults +$ spin new -t cron-rust hello_cron --accept-defaults ``` To run the newly created app: + + ```bash -cd hello_cron -spin build --up +$cd hello_cron +$ spin build --up ``` -### Modifying The Cron Trigger +### Configuring the Cron Trigger -The trigger type is cron and there are no application-level configuration options. +The trigger type is `cron` and there are no application-level configuration options. The following options are available to set in the [[trigger.cron]] section: From 15bd57ca46071ee58e22cb4d99bcade18cf0ddf4 Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 12:33:55 +1000 Subject: [PATCH 07/10] Typos and line breaks Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum --- content/api/hub/plugin_spin_cron_trigger.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index 1b00d6377..3c0d28d53 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -2,7 +2,7 @@ title = "Spin Cron Trigger" template = "render_hub_content_body" date = "2022-10-15T00:22:56Z" content-type = "text/plain" -tags = ["trigger", "rust"] +tags = ["trigger", "rust", "plugins"] [extra] author = "Fermyon" @@ -21,6 +21,7 @@ keywords = "trigger, cron" An experimental plugin that enables cron trigger for Spin applications. ## Installing Template + You can install the template using the following command: @@ -42,7 +43,7 @@ To run the newly created app: ```bash -$cd hello_cron +$ cd hello_cron $ spin build --up ``` @@ -55,7 +56,7 @@ The following options are available to set in the [[trigger.cron]] section: | Name | Type | Required? | Description | |-----------------------|------------------|-----------|-------------| | `component` | string or table | required | The component to run on the schedule given in `cron_expression`. (This is the standard Spin trigger component field.) | -| `cron_expression` | string | required | The `cron` expresison describing the schedule on which to execute the component. | +| `cron_expression` | string | required | The `cron` expression describing the schedule on which to execute the component. | ```toml [[trigger.cron]] From 2fefcb199affc34c8be1194b6d6f1179118fb9ee Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 12:36:36 +1000 Subject: [PATCH 08/10] TOML parsing error: unexpected character found: `\u{201c}` at line 14 column 16 Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum --- content/api/hub/plugin_spin_cron_trigger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index 3c0d28d53..cf3748699 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -11,7 +11,7 @@ category = "Plugin" language = "Rust" created_at = "2023-12-05T00:22:56Z" last_updated = "2023-12-05T00:22:56Z" -spin_version = “>=v2.0.1" +spin_version = ">=v2.0.1" summary = "An experimental cron trigger for Spin apps" url = "https://github.com/fermyon/spin-trigger-cron" keywords = "trigger, cron" From 46878467693cc214d4f922f6ec13afd18396babb Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 12:38:19 +1000 Subject: [PATCH 09/10] Remove attributes and $ from code blocks Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum --- content/api/hub/plugin_spin_cron_trigger.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index cf3748699..c3f58ea77 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -24,27 +24,21 @@ An experimental plugin that enables cron trigger for Spin applications. You can install the template using the following command: - - ```bash -$ spin templates install --git https://github.com/fermyon/spin-trigger-cron +spin templates install --git https://github.com/fermyon/spin-trigger-cron ``` Once the template is installed, you can create a new application using: - - ```bash -$ spin new -t cron-rust hello_cron --accept-defaults +spin new -t cron-rust hello_cron --accept-defaults ``` To run the newly created app: - - ```bash -$ cd hello_cron -$ spin build --up +cd hello_cron +spin build --up ``` ### Configuring the Cron Trigger From a0ff45d59b93dd72d516ae4e5b8f0e0e3c948dd5 Mon Sep 17 00:00:00 2001 From: Timothy McCallum Date: Fri, 10 May 2024 13:02:14 +1000 Subject: [PATCH 10/10] Update plugin_spin_cron_trigger.md Signed-off-by: tpmccallum tim.mccallum@fermyon.com Signed-off-by: Timothy McCallum --- content/api/hub/plugin_spin_cron_trigger.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/api/hub/plugin_spin_cron_trigger.md b/content/api/hub/plugin_spin_cron_trigger.md index c3f58ea77..1fefe8501 100644 --- a/content/api/hub/plugin_spin_cron_trigger.md +++ b/content/api/hub/plugin_spin_cron_trigger.md @@ -20,6 +20,14 @@ keywords = "trigger, cron" An experimental plugin that enables cron trigger for Spin applications. +## Installing Plugin + +You can install the plugin using the following command: + +```bash +spin plugins install --url https://github.com/fermyon/spin-trigger-cron/releases/download/canary/trigger-cron.json +``` + ## Installing Template You can install the template using the following command: