From 3b23b39400d6200a3f516baadc8252c01657fe44 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 08:13:13 -0300 Subject: [PATCH] [1.43.x] KOGITO-9460: Create a new guide describing the workflow CLI (#481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * KOGITO-9460: Create a new guide describing the workflow CLI (#432) * KOGITO-9460: Update KN CLI plugin guide * KOGITO-9460: Create a new guide describing the workflow CLI Updates the guide to include run, create, deploy and undeploy commands without quarkus sections. Moves quarkus section down and improves them to reflect latest changes. Adds new additional resource that will be added later. * KOGITO-9460: Fix quarkus CLI guides * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> * KOGITO-9460: Remove obsolete part in deploy * Improve /kn-plugin-workflow-overview.adoc to mention devUI auto opens Co-authored-by: Zbyněk Drápela <61500440+zdrapela@users.noreply.github.com> --------- Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> Co-authored-by: Zbyněk Drápela <61500440+zdrapela@users.noreply.github.com> * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc * Update serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc --------- Co-authored-by: Dominik Hanák Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> Co-authored-by: Zbyněk Drápela <61500440+zdrapela@users.noreply.github.com> Co-authored-by: Marián Macik --- .../kn-plugin-workflow-overview.adoc | 163 ++++++++++++++---- 1 file changed, 132 insertions(+), 31 deletions(-) diff --git a/serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc b/serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc index ec9e18336..809ee8870 100644 --- a/serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc +++ b/serverlessworkflow/modules/ROOT/pages/testing-and-troubleshooting/kn-plugin-workflow-overview.adoc @@ -60,32 +60,35 @@ kn-workflow .Example output [source,text] ---- -Manage Kogito Serverless Workflow projects +Manage SonataFlow projects Usage: kn workflow [command] Available Commands: - build Build a Kogito Serverless Workflow project and generate a container image completion Generate the autocompletion script for the specified shell - create Create a Kogito Serverless Workflow project - deploy Deploy a Kogito Serverless Workflow project + create Creates a new SonataFlow project + deploy Deploy a SonataFlow project on Kubernetes via SonataFlow Operator help Help about any command + quarkus Manage SonataFlow projects built in Quarkus + run Run a SonataFlow project in development mode + undeploy Undeploy a SonataFlow project on Kubernetes via SonataFlow Operator + version Show the version Flags: - -h, --help help for kn-workflow - -v, --verbose Print verbose logs + -h, --help help for kn + -v, --version version for kn -Use "kn workflow [command] --help" for more information about a command. +Use "kn [command] --help" for more information about a command. ---- -- [[proc-create-sw-project-kn-cli]] == Creating a workflow project using Knative CLI -After installing the {product_name} plug-in, you can use the `create` command with `kn workflow` to scaffold a new workflow project in your current directory. +After installing the {product_name} plug-in, you can use the `create` command with `kn workflow` to scaffold a new {product_name} project in your current directory. -The `create` command sets up Quarkus project containing minimal extensions to build a workflow project. Also, the generated workflow project contains a "hello world" `workflow.sw.json` file in your `.//src/main/resources` directory. +The `create` command sets up {product_name} project containing a minimal "hello world" `workflow.sw.json` file in your `./` directory. .Prerequisites * {product_name} plug-in for Knative CLI is installed. @@ -114,27 +117,123 @@ kn workflow create --name my-project ---- -- -. Add more extensions to the Quarkus project during its creation by using the `[-e|--extension]` flag as follows: +[[proc-build-sw-project-kn-cli]] +== Running a workflow project using Knative CLI + +After creating your workflow project, you can use the `run` command with `kn workflow` to build & run your workflow project in your current directory. + +This will start a {product_name} docker image and map your local folder to this image. + +.Prerequisites +* {product_name} plug-in for Knative CLI is installed. ++ +For more information about installing the plug-in, see <>. + +* A workflow project is created. ++ +For more information about creating a workflow project, see <>. +* Minikube cluster is running locally. + + +.Procedure +. In Knative CLI, enter the following command to build and run your workflow project: + -- -.Create a project with `quarkus-jsonp` and `quarkus-smallrye-openapi` extensions +.Run the project and start a local development image. [source,shell] ---- -kn workflow create --extension quarkus-jsonp,quarkus-smallrye-openapi +kn workflow run ---- +-- +. Once the project is ready, the Development UI will be opened up in a browser automatically (on `localhost:8080/q/dev`). -You can add multiple extensions using the comma-separated names of the extensions in the previous command. +[[proc-deploy-sw-project-kn-cli]] +== Deploying a workflow project using Knative CLI + +You can use the `deploy` command combined with `kn workflow` to deploy your workflow project in your current directory. + +.Prerequisites +* {product_name} plug-in for Knative CLI is installed. ++ +For more information about installing the plug-in, see <>. + +* A workflow project is created. ++ +For more information about creating a workflow project, see <>. + +* A minikube cluster is running locally. + +.Procedure +. In Knative CLI, enter the following command to deploy your workflow project: ++ +-- +.Deploy a workflow project +[source,shell] +---- +kn workflow deploy +---- + +Also, ensure that you have access to your cluster and your cluster can access the generated container image. +For more options with `deploy` command use `[-h|--help]`. [NOTE] -==== +==== +You can use the `kubectl` command line if you want to use a complex deployment setup for your workflow project. +==== +-- + +[[proc-create-quarkus-sw-project-kn-cli]] +== Creating a Quarkus Workflow project using Knative CLI + +After installing the {product_name} plug-in, you can use the `quarkus create` command with `kn workflow` to scaffold a new Quarkus Workflow project in your current directory. + +The `quarkus create` command sets up a {product_name} Quarkus project containing minimal extensions to build a workflow project. Also, the generated workflow project contains a "hello world" `workflow.sw.json` file in your `.//src/main/resources` directory. + +.Prerequisites +* {product_name} plug-in for Knative CLI is installed. +For more information about installing the plug-in, see <>. +ifeval::["{kogito_version_redhat}" != ""] +* You followed the steps in xref:getting-started/create-your-first-workflow-service.adoc#proc-configuring-maven-rhbq[Configuring your Maven project to Red Hat build of Quarkus and OpenShift Serverless Logic] +endif::[] + +.Procedure +. In Knative CLI, enter the following command to create a new project: ++ +-- +.Creates a project named `new-project` +[source,shell] +---- +kn workflow quarkus create +---- + +By default, the generated project is named as `new-project`. You can overwrite the project name by using the `[-n|--name]` flag as follows: + +.Create a project named `my-project` +[source,shell] +---- +kn workflow quarkus create --name my-project +---- +-- + +. Add more extensions to the Quarkus project during its creation by using the `[-e|--extension]` flag as follows: ++ +-- +.Create a project with `quarkus-jsonp and quarkus-smallrye-openapi` extensions +[source,shell] +---- +kn workflow quarkus create --extension quarkus-jsonp,quarkus-smallrye-openapi +---- +You can add multiple extensions using the comma-separated names of the extensions in the previous command. +[NOTE] +==== When you run the `create` command for the first time, it might take a while due to the necessity of downloading the required dependencies for the Quarkus project. ==== -- -[[proc-build-sw-project-kn-cli]] -== Building a workflow project using Knative CLI +[[proc-build-quarkus-sw-project-kn-cli]] +== Building a Quarkus workflow project using Knative CLI -After creating your workflow project, you can use the `build` command with `kn workflow` to build your workflow project in your current directory and to generate a container image. +After creating your workflow project, you can use the `quarkus build` command with `kn workflow` to build your workflow project in your current directory and to generate a container image. The process of building your workflow project produces a `knative.yml` file in the `./target/kubernetes` folder. If your workflow contains events, then the building process also generates a `kogito.yml` file. @@ -154,7 +253,7 @@ For more information about creating a workflow project, see <