Skip to content

Commit 6b94419

Browse files
committed
[SRVOCF-427]: Add kn func run command docs
1 parent a01385e commit 6b94419

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

modules/serverless-kn-func-run.adoc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/cli_tools/kn-func-ref.adoc
4+
// * serverless/functions/serverless-functions-getting-started.adoc
5+
6+
:_content-type: REFERENCE
7+
[id="serverless-kn-func-run_{context}"]
8+
= Running a function locally
9+
10+
You can use the `kn func run` command to run a function locally in the current directory or in the directory specified by the `--path` flag. If the function that you are running has never previously been built, or if the project files have been modified since the last time it was built, the `kn func run` command builds the function before running it by default.
11+
12+
.Example command to run a function in the current directory
13+
[source,terminal]
14+
----
15+
$ kn func run
16+
----
17+
18+
.Example command to run a function in a directory specified as a path
19+
[source,terminal]
20+
----
21+
$ kn func run --path=<directory_path>
22+
----
23+
24+
You can also force a rebuild of an existing image before running the function, even if there have been no changes to the project files, by using the `--build` flag:
25+
26+
.Example run command using the build flag
27+
[source,terminal]
28+
----
29+
$ kn func run --build
30+
----
31+
32+
If you set the `build` flag as false, this disables building of the image, and runs the function using the previously built image:
33+
34+
.Example run command using the build flag
35+
[source,terminal]
36+
----
37+
$ kn func run --build=false
38+
----
39+
40+
You can use the help command to learn more about `kn func run` command options:
41+
42+
.Build help command
43+
[source,terminal]
44+
----
45+
$ kn func help run
46+
----

serverless/cli_tools/kn-func-ref.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include::_attributes/common-attributes.adoc[]
77
toc::[]
88

99
include::modules/serverless-create-func-kn.adoc[leveloffset=+1]
10+
include::modules/serverless-kn-func-run.adoc[leveloffset=+1]
1011
include::modules/serverless-build-func-kn.adoc[leveloffset=+1]
1112
include::modules/serverless-deploy-func-kn.adoc[leveloffset=+1]
1213
include::modules/functions-list-kn.adoc[leveloffset=+1]

serverless/functions/serverless-functions-getting-started.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ include::snippets/technology-preview.adoc[leveloffset=+2]
1717
Before you can complete the following procedures, you must ensure that you have completed all of the prerequisite tasks in xref:../../serverless/functions/serverless-functions-setup.adoc#serverless-functions-setup[Setting up {FunctionsProductName}].
1818

1919
include::modules/serverless-create-func-kn.adoc[leveloffset=+1]
20+
include::modules/serverless-kn-func-run.adoc[leveloffset=+1]
2021
include::modules/serverless-build-func-kn.adoc[leveloffset=+1]
2122
include::modules/serverless-functions-on-cluster-builds.adoc[leveloffset=+1]
2223
include::modules/serverless-deploy-func-kn.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)