mirror of https://github.com/knative/func.git
rename function -> func (#217)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
This commit is contained in:
parent
cd57692c9d
commit
470ebb9da4
|
|
@ -1 +1 @@
|
||||||
/function
|
/func
|
||||||
|
|
|
||||||
|
|
@ -29,21 +29,21 @@ jobs:
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: make check
|
run: make check
|
||||||
- name: Permissions
|
- name: Permissions
|
||||||
run: chmod a+x function_*amd*
|
run: chmod a+x func_*amd*
|
||||||
|
|
||||||
# Upload all build artifacts whether it's a release or not
|
# Upload all build artifacts whether it's a release or not
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: OSX Binary
|
name: OSX Binary
|
||||||
path: function_darwin_amd64
|
path: func_darwin_amd64
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Linux Binary
|
name: Linux Binary
|
||||||
path: function_linux_amd64
|
path: func_linux_amd64
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Windows Binary
|
name: Windows Binary
|
||||||
path: function_windows_amd64.exe
|
path: func_windows_amd64.exe
|
||||||
|
|
||||||
# Build and push a latest image with each commit
|
# Build and push a latest image with each commit
|
||||||
- name: Image
|
- name: Image
|
||||||
|
|
@ -59,7 +59,7 @@ jobs:
|
||||||
# The following steps are only executed if this is a release
|
# The following steps are only executed if this is a release
|
||||||
- name: Compress Binaries
|
- name: Compress Binaries
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
run: gzip function_darwin_amd64 function_linux_amd64 function_windows_amd64.exe
|
run: gzip func_darwin_amd64 func_linux_amd64 func_windows_amd64.exe
|
||||||
|
|
||||||
# Upload all binaries
|
# Upload all binaries
|
||||||
- name: Upload Darwin Binary
|
- name: Upload Darwin Binary
|
||||||
|
|
@ -69,8 +69,8 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
asset_path: ./function_darwin_amd64.gz
|
asset_path: ./func_darwin_amd64.gz
|
||||||
asset_name: function_darwin_amd64.gz
|
asset_name: func_darwin_amd64.gz
|
||||||
asset_content_type: application/x-gzip
|
asset_content_type: application/x-gzip
|
||||||
- name: Upload Linux Binary
|
- name: Upload Linux Binary
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
|
|
@ -79,8 +79,8 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
asset_path: ./functionlinux_amd64.gz
|
asset_path: ./func_linux_amd64.gz
|
||||||
asset_name: function_linux_amd64.gz
|
asset_name: func_linux_amd64.gz
|
||||||
asset_content_type: application/x-gzip
|
asset_content_type: application/x-gzip
|
||||||
- name: Upload Windows Binary
|
- name: Upload Windows Binary
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
|
|
@ -89,6 +89,6 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
asset_path: ./function_windows_amd64.exe.gz
|
asset_path: ./func_windows_amd64.exe.gz
|
||||||
asset_name: function_windows_amd64.exe.gz
|
asset_name: func_windows_amd64.exe.gz
|
||||||
asset_content_type: application/x-gzip
|
asset_content_type: application/x-gzip
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/function
|
/func
|
||||||
/function_*
|
/func_*
|
||||||
/templates/go/events/go.sum
|
/templates/go/events/go.sum
|
||||||
/templates/go/http/go.sum
|
/templates/go/http/go.sum
|
||||||
/coverage.out
|
/coverage.out
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ RUN make
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
COPY --from=build /src/function /bin/
|
COPY --from=build /src/func /bin/
|
||||||
ENTRYPOINT ["function"]
|
ENTRYPOINT ["func"]
|
||||||
|
|
|
||||||
4
Makefile
4
Makefile
|
|
@ -1,5 +1,5 @@
|
||||||
REPO := quay.io/boson/function
|
REPO := quay.io/boson/func
|
||||||
BIN := function
|
BIN := func
|
||||||
|
|
||||||
DARWIN=$(BIN)_darwin_amd64
|
DARWIN=$(BIN)_darwin_amd64
|
||||||
LINUX=$(BIN)_linux_amd64
|
LINUX=$(BIN)_linux_amd64
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
[Demo Screencast]
|
[Demo Screencast]
|
||||||
|
|
||||||
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
`func` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||||
|
|
||||||
[Read the Documentation](docs/README.md)
|
[Read the Documentation](docs/README.md)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,9 @@ func TestDefaultTrigger(t *testing.T) {
|
||||||
// using a custom path to a template repository on disk. Custom repository
|
// using a custom path to a template repository on disk. Custom repository
|
||||||
// location is not defined herein but expected to be provided because, for
|
// location is not defined herein but expected to be provided because, for
|
||||||
// example, a CLI may want to use XDG_CONFIG_HOME. Assuming a repository path
|
// example, a CLI may want to use XDG_CONFIG_HOME. Assuming a repository path
|
||||||
// $FUNCTIONTEMPLATES, a Go template named 'json' which is provided in the
|
// $FUNC_TEMPLATES, a Go template named 'json' which is provided in the
|
||||||
// repository 'boson-experimental', would be expected to be in the location:
|
// repository 'boson-experimental', would be expected to be in the location:
|
||||||
// $FUNCTION_TEMPLATES/boson-experimental/go/json
|
// $FUNC_TEMPLATES/boson-experimental/go/json
|
||||||
// See the CLI for full details, but a standard default location is
|
// See the CLI for full details, but a standard default location is
|
||||||
// $HOME/.config/templates/boson-experimental/go/json
|
// $HOME/.config/templates/boson-experimental/go/json
|
||||||
func TestExtensibleTemplates(t *testing.T) {
|
func TestExtensibleTemplates(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(buildCmd)
|
root.AddCommand(buildCmd)
|
||||||
buildCmd.Flags().StringP("builder", "b", "default", "Buildpacks builder")
|
buildCmd.Flags().StringP("builder", "b", "default", "Buildpacks builder")
|
||||||
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
|
||||||
buildCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNCTION_IMAGE")
|
buildCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNC_IMAGE")
|
||||||
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
|
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNC_PATH")
|
||||||
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNCTION_REGISTRY")
|
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNC_REGISTRY")
|
||||||
|
|
||||||
err := buildCmd.RegisterFlagCompletionFunc("builder", CompleteBuilderList)
|
err := buildCmd.RegisterFlagCompletionFunc("builder", CompleteBuilderList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@ var completionCmd = &cobra.Command{
|
||||||
Long: `To load completion run
|
Long: `To load completion run
|
||||||
|
|
||||||
For zsh:
|
For zsh:
|
||||||
source <(function completion zsh)
|
source <(func completion zsh)
|
||||||
|
|
||||||
If you would like to use alias:
|
If you would like to use alias:
|
||||||
alias f=function
|
alias f=func
|
||||||
compdef _function f
|
compdef _func f
|
||||||
|
|
||||||
For bash:
|
For bash:
|
||||||
source <(function completion bash)
|
source <(func completion bash)
|
||||||
|
|
||||||
`,
|
`,
|
||||||
ValidArgs: []string{"bash", "zsh", "fish"},
|
ValidArgs: []string{"bash", "zsh", "fish"},
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(createCmd)
|
root.AddCommand(createCmd)
|
||||||
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FFUNCTION_CONFIRM")
|
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
|
||||||
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FUNCTION_RUNTIME")
|
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FUNC_RUNTIME")
|
||||||
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FUNCTION_TEMPLATES")
|
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FUNC_TEMPLATES")
|
||||||
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FUNCTION_TRIGGER")
|
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FUNC_TRIGGER")
|
||||||
|
|
||||||
if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
|
if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
|
||||||
fmt.Println("Error while calling RegisterFlagCompletionFunc: ", err)
|
fmt.Println("Error while calling RegisterFlagCompletionFunc: ", err)
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(deleteCmd)
|
root.AddCommand(deleteCmd)
|
||||||
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
|
||||||
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNCTION_PATH")
|
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNC_PATH")
|
||||||
deleteCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
deleteCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FAAS_NAMESPACE")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(deployCmd)
|
root.AddCommand(deployCmd)
|
||||||
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
|
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNC_CONFIRM")
|
||||||
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
||||||
deployCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNCTION_IMAGE")
|
deployCmd.Flags().StringP("image", "i", "", "Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --registry) - $FUNC_IMAGE")
|
||||||
deployCmd.Flags().StringP("namespace", "n", "", "Override namespace into which the Function is deployed (on supported platforms). Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
deployCmd.Flags().StringP("namespace", "n", "", "Override namespace into which the Function is deployed (on supported platforms). Default is to use currently active underlying platform setting - $FUNC_NAMESPACE")
|
||||||
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FUNCTION_PATH")
|
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FUNC_PATH")
|
||||||
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNCTION_REGISTRY")
|
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNC_REGISTRY")
|
||||||
}
|
}
|
||||||
|
|
||||||
var deployCmd = &cobra.Command{
|
var deployCmd = &cobra.Command{
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(describeCmd)
|
root.AddCommand(describeCmd)
|
||||||
describeCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for the Function. Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
describeCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for the Function. Default is to use currently active underlying platform setting - $FUNC_NAMESPACE")
|
||||||
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
|
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNC_FORMAT")
|
||||||
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNCTION_PATH")
|
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNC_PATH")
|
||||||
|
|
||||||
err := describeCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
err := describeCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
root.AddCommand(listCmd)
|
root.AddCommand(listCmd)
|
||||||
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FUNCTION_NAMESPACE")
|
listCmd.Flags().StringP("namespace", "n", "", "Override namespace in which to search for Functions. Default is to use currently active underlying platform setting - $FUNC_NAMESPACE")
|
||||||
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
|
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNC_FORMAT")
|
||||||
|
|
||||||
err := listCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
err := listCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
14
cmd/root.go
14
cmd/root.go
|
|
@ -17,7 +17,7 @@ import (
|
||||||
// available flags, etc. It has no action of its own, such that running the
|
// available flags, etc. It has no action of its own, such that running the
|
||||||
// resultant binary with no arguments prints the help/usage text.
|
// resultant binary with no arguments prints the help/usage text.
|
||||||
var root = &cobra.Command{
|
var root = &cobra.Command{
|
||||||
Use: "function",
|
Use: "func",
|
||||||
Short: "Manage function projects",
|
Short: "Manage function projects",
|
||||||
SilenceErrors: true, // we explicitly handle errors in Execute()
|
SilenceErrors: true, // we explicitly handle errors in Execute()
|
||||||
SilenceUsage: true, // no usage dump on error
|
SilenceUsage: true, // no usage dump on error
|
||||||
|
|
@ -53,8 +53,8 @@ func init() {
|
||||||
// version subcommand: nothing but the version.
|
// version subcommand: nothing but the version.
|
||||||
root.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
|
root.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
|
||||||
|
|
||||||
// Prefix all environment variables with "FUNCTION_" to avoid collisions with other apps.
|
// Prefix all environment variables with "FUNC_" to avoid collisions with other apps.
|
||||||
viper.SetEnvPrefix("function")
|
viper.SetEnvPrefix("func")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the command tree by executing the root command, which runs
|
// Execute the command tree by executing the root command, which runs
|
||||||
|
|
@ -97,15 +97,15 @@ func cwd() (cwd string) {
|
||||||
// function defaults and extensible templates.
|
// function defaults and extensible templates.
|
||||||
func configPath() (path string) {
|
func configPath() (path string) {
|
||||||
if path = os.Getenv("XDG_CONFIG_HOME"); path != "" {
|
if path = os.Getenv("XDG_CONFIG_HOME"); path != "" {
|
||||||
path = filepath.Join(path, "function")
|
path = filepath.Join(path, "func")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
home, err := homedir.Expand("~")
|
home, err := homedir.Expand("~")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "could not derive home directory for use as default templates path: %v", err)
|
fmt.Fprintf(os.Stderr, "could not derive home directory for use as default templates path: %v", err)
|
||||||
path = filepath.Join(".config", "function")
|
path = filepath.Join(".config", "func")
|
||||||
} else {
|
} else {
|
||||||
path = filepath.Join(home, ".config", "function")
|
path = filepath.Join(home, ".config", "func")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +217,7 @@ func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
|
||||||
// will be prepended.
|
// will be prepended.
|
||||||
//
|
//
|
||||||
// If the image flag is provided, this value is used directly (the user supplied
|
// If the image flag is provided, this value is used directly (the user supplied
|
||||||
// --image or $FUNCTION_IMAGE). Otherwise, the Function at 'path' is loaded, and
|
// --image or $FUNC_IMAGE). Otherwise, the Function at 'path' is loaded, and
|
||||||
// the Image name therein is used (i.e. it was previously calculated).
|
// the Image name therein is used (i.e. it was previously calculated).
|
||||||
// Finally, the default registry is used, which is prepended to the Function
|
// Finally, the default registry is used, which is prepended to the Function
|
||||||
// name, and appended with ':latest':
|
// name, and appended with ':latest':
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ func init() {
|
||||||
// Add the run command as a subcommand of root.
|
// Add the run command as a subcommand of root.
|
||||||
root.AddCommand(runCmd)
|
root.AddCommand(runCmd)
|
||||||
runCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
runCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
|
||||||
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
|
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNC_PATH")
|
||||||
}
|
}
|
||||||
|
|
||||||
var runCmd = &cobra.Command{
|
var runCmd = &cobra.Command{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[Demo Screencast]
|
[Demo Screencast]
|
||||||
|
|
||||||
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
`func` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
|
||||||
|
|
||||||
For examples of what's possible, see the [Screencast Series](getting_started_screencast.md) or the [Functions Cookbook](functions_cookbook.md).
|
For examples of what's possible, see the [Screencast Series](getting_started_screencast.md) or the [Functions Cookbook](functions_cookbook.md).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ Creates a new Function project at _`path`_. If _`path`_ is unspecified, assumes
|
||||||
Similar `kn` command: none.
|
Similar `kn` command: none.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function create <path> [-l <runtime> -t <trigger>]
|
func create <path> [-l <runtime> -t <trigger>]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function create <path> [-l <runtime> -t <trigger>]
|
kn func create <path> [-l <runtime> -t <trigger>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `build`
|
## `build`
|
||||||
|
|
@ -25,84 +25,84 @@ The value(s) provided for image and registry are persisted to the `func.yaml` fi
|
||||||
Similar `kn` command: none.
|
Similar `kn` command: none.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function build [-i <image> -r <registry> -p <path>]
|
func build [-i <image> -r <registry> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function build [-i <image> -r <registry> -p <path>]
|
kn func build [-i <image> -r <registry> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `run`
|
## `run`
|
||||||
|
|
||||||
Runs the Function project locally in the container. If a container has not yet been created, prompts the user to run `function build`. The user may specify a path to the project directory using the `--path` or `-p` flag.
|
Runs the Function project locally in the container. If a container has not yet been created, prompts the user to run `func build`. The user may specify a path to the project directory using the `--path` or `-p` flag.
|
||||||
|
|
||||||
Similar `kn` command: none.
|
Similar `kn` command: none.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function run
|
func run
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function run [-p <path>]
|
kn func run [-p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `deploy`
|
## `deploy`
|
||||||
|
|
||||||
Builds and deploys the Function project in the current directory. The user may specify a path to the project directory using the `--path` or `-p` flag. Reads the `func.yaml` configuration file to determine the image name. An image and registry may be specified on the command line using the `--image` or `-i` and `--registry` or `-r` flag.
|
Builds and deploys the Function project in the current directory. The user may specify a path to the project directory using the `--path` or `-p` flag. Reads the `func.yaml` configuration file to determine the image name. An image and registry may be specified on the command line using the `--image` or `-i` and `--registry` or `-r` flag.
|
||||||
|
|
||||||
Derives the service name from the project name. There is no mechanism by which the user can specify the service name. The user must have already initialized the function using `function create` or they will encounter an error.
|
Derives the service name from the project name. There is no mechanism by which the user can specify the service name. The user must have already initialized the function using `func create` or they will encounter an error.
|
||||||
|
|
||||||
If the Function is already deployed, it is updated with a new container image that is pushed to a
|
If the Function is already deployed, it is updated with a new container image that is pushed to a
|
||||||
container image registry, and the Knative Service is updated.
|
container image registry, and the Knative Service is updated.
|
||||||
|
|
||||||
The namespace into which the project is deployed defaults to the value in the `func.yaml` configuration file. If `NAMESPACE` is not set in the configuration, the namespace currently active in the Kubernetes configuration file will be used. The namespace may be specified on the command line using the `--namespace` or `-n` flag, and if so this will overwrite the value in the `func.yaml` file.
|
The namespace into which the project is deployed defaults to the value in the `func.yaml` configuration file. If `NAMESPACE` is not set in the configuration, the namespace currently active in the Kubernetes configuration file will be used. The namespace may be specified on the command line using the `--namespace` or `-n` flag, and if so this will overwrite the value in the `func.yaml` file.
|
||||||
|
|
||||||
Similar `kn` command: `kn service create NAME --image IMAGE [flags]`. This command allows a user to deploy a Knative Service by specifying an image, typically one hosted on a public container registry such as docker.io. The deployment options which the `kn` command affords the user are quite broad. The `kn` command in this case is quite effective for a power user. The `function deploy` command has a similar end result, but is definitely easier for a user just getting started to be successful with.
|
Similar `kn` command: `kn service create NAME --image IMAGE [flags]`. This command allows a user to deploy a Knative Service by specifying an image, typically one hosted on a public container registry such as docker.io. The deployment options which the `kn` command affords the user are quite broad. The `kn` command in this case is quite effective for a power user. The `func deploy` command has a similar end result, but is definitely easier for a user just getting started to be successful with.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
func deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
kn func deploy [-n <namespace> -p <path> -i <image> -r <registry>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `describe`
|
## `describe`
|
||||||
|
|
||||||
Prints the name, route and any event subscriptions for a deployed Function. The user may also specify the name of the function to describe. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
Prints the name, route and any event subscriptions for a deployed Function. The user may also specify the name of the function to describe. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
||||||
|
|
||||||
Similar `kn` command: `kn service describe NAME [flags]`. This flag provides a lot of nice information not available in `function describe`, such as revisions, age, annotations and labels. This command should be renamed to make it distinct from `kn` - e.g. `function status`.
|
Similar `kn` command: `kn service describe NAME [flags]`. This flag provides a lot of nice information not available in `func describe`, such as revisions, age, annotations and labels. This command should be renamed to make it distinct from `kn` - e.g. `func status`.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function describe [-f <format> -n <namespace> -p <path>]
|
func describe [-f <format> -n <namespace> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function describe [-f <format> -n <namespace> -p <path>]
|
kn func describe [-f <format> -n <namespace> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `list`
|
## `list`
|
||||||
|
|
||||||
Lists all deployed functions. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
Lists all deployed functions. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace defaults to the value in `func.yaml` or the namespace currently active in the user's Kubernetes configuration. The namespace may be specified on the command line, and if so this will overwrite the value in `func.yaml`.
|
||||||
|
|
||||||
Similar `kn` command: `kn service list [name] [flags]`. This command lists all deployed Knative `Services`. As with other `kn` commands that have similar functionality, there is more information and flexibilty in the `kn` command. However, `kn` will return _all_ `Services`, while `function list` will only display the boson Functions that have been deployed. Consider improving the output of the `function list` command so that it is at least as informative as `kn service list`.
|
Similar `kn` command: `kn service list [name] [flags]`. This command lists all deployed Knative `Services`. As with other `kn` commands that have similar functionality, there is more information and flexibilty in the `kn` command. However, `kn` will return _all_ `Services`, while `func list` will only display the boson functions that have been deployed. Consider improving the output of the `func list` command so that it is at least as informative as `kn service list`.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function list [-n <namespace> -p <path>]
|
func list [-n <namespace> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function list [-n <namespace> -p <path>]
|
kn func list [-n <namespace> -p <path>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `delete`
|
## `delete`
|
||||||
|
|
@ -112,11 +112,11 @@ Removes a deployed function from the cluster. The user may specify a function by
|
||||||
Similar `kn` command: `kn service delete NAME [flags]`.
|
Similar `kn` command: `kn service delete NAME [flags]`.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
function delete <name> [-n namespace, -p path]
|
func delete <name> [-n namespace, -p path]
|
||||||
```
|
```
|
||||||
|
|
||||||
When run as a `kn` plugin.
|
When run as a `kn` plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kn function delete <name> [-n namespace, -p path]
|
kn func delete <name> [-n namespace, -p path]
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ of a new function.
|
||||||
It is recommended to set your preferred image registry for publishing Functions
|
It is recommended to set your preferred image registry for publishing Functions
|
||||||
by setting the following environment variables:
|
by setting the following environment variables:
|
||||||
```
|
```
|
||||||
export FUNCTION_REGISTRY=quay.io
|
export FUNC_REGISTRY=quay.io
|
||||||
export FUNCTION_NAMESPACE=alice
|
export FUNC_NAMESPACE=alice
|
||||||
```
|
```
|
||||||
Alternately, when using the CLI these values can be provided using the --namespace and --registry
|
Alternately, when using the CLI these values can be provided using the --namespace and --registry
|
||||||
flags.
|
flags.
|
||||||
|
|
@ -23,7 +23,7 @@ flags.
|
||||||
```shell
|
```shell
|
||||||
> mkdir -p example.com/www
|
> mkdir -p example.com/www
|
||||||
> cd example.com/www
|
> cd example.com/www
|
||||||
> function create go
|
> func create go
|
||||||
https://www.example.com
|
https://www.example.com
|
||||||
> curl https://www.example.com
|
> curl https://www.example.com
|
||||||
OK
|
OK
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ Once access to a kubernetes-compatible cluster has been established, it will nee
|
||||||
|
|
||||||
Create a namespace for your Functions:
|
Create a namespace for your Functions:
|
||||||
```
|
```
|
||||||
kubectl create namespace function
|
kubectl create namespace func
|
||||||
```
|
```
|
||||||
Set the default namespace for subsequent commands:
|
Set the default namespace for subsequent commands:
|
||||||
```
|
```
|
||||||
kubectl config set-context --current --namespace=function
|
kubectl config set-context --current --namespace=func
|
||||||
```
|
```
|
||||||
|
|
||||||
### Serving
|
### Serving
|
||||||
|
|
@ -39,7 +39,7 @@ Update the networking layer to
|
||||||
- Use Kourier
|
- Use Kourier
|
||||||
- use TLS
|
- use TLS
|
||||||
- Redirect HTTP requests to HTTPS
|
- Redirect HTTP requests to HTTPS
|
||||||
- Add function subdomain annotations
|
- Add func subdomain annotations
|
||||||
```
|
```
|
||||||
kubectl apply -f knative/config-network.yaml
|
kubectl apply -f knative/config-network.yaml
|
||||||
```
|
```
|
||||||
|
|
@ -109,7 +109,7 @@ kubectl edit configmap config-certmanager --namespace knative-serving
|
||||||
|
|
||||||
### Eventing
|
### Eventing
|
||||||
|
|
||||||
Eventing with In-memory channels, a Channel broker, and enable the default broker in the function namespace.
|
Eventing with In-memory channels, a Channel broker, and enable the default broker in the func namespace.
|
||||||
```
|
```
|
||||||
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yaml
|
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yaml
|
||||||
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yaml
|
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yaml
|
||||||
|
|
@ -122,9 +122,9 @@ kubectl apply --filename https://github.com/knative/eventing-contrib/releases/do
|
||||||
```
|
```
|
||||||
Learn more about the GitHub source at https://knative.dev/docs/eventing/samples/github-source/index.html
|
Learn more about the GitHub source at https://knative.dev/docs/eventing/samples/github-source/index.html
|
||||||
|
|
||||||
Enable Broker for function namespace:
|
Enable Broker for func namespace:
|
||||||
```
|
```
|
||||||
kubectl label namespace function knative-eventing-injection=enabled
|
kubectl label namespace func knative-eventing-injection=enabled
|
||||||
```
|
```
|
||||||
|
|
||||||
### Monitoring
|
### Monitoring
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ The CLI can be used to invoke most features of the function system. One can cho
|
||||||
|
|
||||||
The latest release can be run as a container:
|
The latest release can be run as a container:
|
||||||
```
|
```
|
||||||
docker run quay.io/boson/function
|
docker run quay.io/boson/func
|
||||||
```
|
```
|
||||||
To run a specific version of the CLI, use the version desired as the image tag:
|
To run a specific version of the CLI, use the version desired as the image tag:
|
||||||
```
|
```
|
||||||
docker run quay.io/boson/function:v0.9.0
|
docker run quay.io/boson/func:v0.9.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Prebuilt Binary
|
### Prebuilt Binary
|
||||||
|
|
@ -25,6 +25,6 @@ Each version is built and made available as a prebuilt binary. See [All Release
|
||||||
To build and install from source check out the repository, run `make`, and install the resultant binary:
|
To build and install from source check out the repository, run `make`, and install the resultant binary:
|
||||||
```
|
```
|
||||||
make
|
make
|
||||||
mv function /usr/local/bin/
|
mv func /usr/local/bin/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Integrator's Guide
|
# Integrator's Guide
|
||||||
|
|
||||||
Developer's can integrate directly with the Function system using the client library upon which the `function` CLI is based. Before beginning this section, you should have a configured provider and be familiar with the topics covered in the [developer's guide](docs/developers_guide.md).
|
Developer's can integrate directly with the Function system using the client library upon which the `func` CLI is based. Before beginning this section, you should have a configured provider and be familiar with the topics covered in the [developer's guide](docs/developers_guide.md).
|
||||||
|
|
||||||
## Using the Client Library
|
## Using the Client Library
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ data:
|
||||||
# one entry per TLD+1. Example:
|
# one entry per TLD+1. Example:
|
||||||
boson-project.com: |
|
boson-project.com: |
|
||||||
selector:
|
selector:
|
||||||
function.domain: "boson-project.com"
|
func.domain: "boson-project.com"
|
||||||
boson-project.org: |
|
boson-project.org: |
|
||||||
selector:
|
selector:
|
||||||
function.domain: "boson-project.org"
|
func.domain: "boson-project.org"
|
||||||
# Default is local only.
|
# Default is local only.
|
||||||
svc.cluster.local: ""
|
svc.cluster.local: ""
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ data:
|
||||||
autoTLS: Enabled
|
autoTLS: Enabled
|
||||||
# Redirect HTTP requests to HTTPS
|
# Redirect HTTP requests to HTTPS
|
||||||
httpProtocol: Redirected
|
httpProtocol: Redirected
|
||||||
# If there exists an annotation `function.subdomain` on the service,
|
# If there exists an annotation `func.subdomain` on the service,
|
||||||
# use it instead of the default name.namespace
|
# use it instead of the default name.namespace
|
||||||
domainTemplate: |-
|
domainTemplate: |-
|
||||||
{{if index .Annotations "function.subdomain" -}}
|
{{if index .Annotations "func.subdomain" -}}
|
||||||
{{- index .Annotations "function.subdomain" -}}
|
{{- index .Annotations "func.subdomain" -}}
|
||||||
{{else -}}
|
{{else -}}
|
||||||
{{- .Name}}.{{.Namespace -}}
|
{{- .Name}}.{{.Namespace -}}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ func init() {
|
||||||
type faasPlugin struct {}
|
type faasPlugin struct {}
|
||||||
|
|
||||||
func (f *faasPlugin) Name() string {
|
func (f *faasPlugin) Name() string {
|
||||||
return "kn-function"
|
return "kn-func"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *faasPlugin) Execute(args []string) error {
|
func (f *faasPlugin) Execute(args []string) error {
|
||||||
|
|
@ -22,7 +22,7 @@ func (f *faasPlugin) Execute(args []string) error {
|
||||||
defer (func() {
|
defer (func() {
|
||||||
os.Args = oldArgs
|
os.Args = oldArgs
|
||||||
})()
|
})()
|
||||||
os.Args = append([]string { "kn-function" }, args...)
|
os.Args = append([]string { "kn-func" }, args...)
|
||||||
return rootCmd.Execute()
|
return rootCmd.Execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ func (f *faasPlugin) Description() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *faasPlugin) CommandParts() []string {
|
func (f *faasPlugin) CommandParts() []string {
|
||||||
return []string{ "function"}
|
return []string{ "func"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path is empty because its an internal plugins
|
// Path is empty because its an internal plugins
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ func copyFilesystem(templatesPath, runtime, templateFullName, dest string) error
|
||||||
template := cc[1]
|
template := cc[1]
|
||||||
|
|
||||||
// Example FileSystem path:
|
// Example FileSystem path:
|
||||||
// /home/alice/.config/function/templates/boson-experimental/go/json
|
// /home/alice/.config/func/templates/boson-experimental/go/json
|
||||||
src := filepath.Join(templatesPath, repo, runtime, template)
|
src := filepath.Join(templatesPath, repo, runtime, template)
|
||||||
return copy(src, dest, filesystemAccessor{})
|
return copy(src, dest, filesystemAccessor{})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Welcome to your new Go Function! The boilerplate function code can be found in [
|
||||||
|
|
||||||
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for each feature, and confirm it works with `go test`.
|
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for each feature, and confirm it works with `go test`.
|
||||||
|
|
||||||
Update the running analog of the funciton using the `function` CLI or client library, and it can be invoked using a manually-created CloudEvent:
|
Update the running analog of the funciton using the `func` CLI or client library, and it can be invoked using a manually-created CloudEvent:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
curl -X POST -d '{"hello": "world"}' \
|
curl -X POST -d '{"hello": "world"}' \
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Welcome to your new Go Function! The boilerplate function code can be found in
|
||||||
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for
|
Develop new features by adding a test to [`handle_test.go`](handle_test.go) for
|
||||||
each feature, and confirm it works with `go test`.
|
each feature, and confirm it works with `go test`.
|
||||||
|
|
||||||
Update the running analog of the function using the `function` CLI or client
|
Update the running analog of the function using the `func` CLI or client
|
||||||
library, and it can be invoked from your browser or from the command line:
|
library, and it can be invoked from your browser or from the command line:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ so debugger can be attached if needed.
|
||||||
|
|
||||||
To run test locally run `./mvnw test`.
|
To run test locally run `./mvnw test`.
|
||||||
|
|
||||||
## The `function` CLI
|
## The `func` CLI
|
||||||
|
|
||||||
It's recommended to set `FUNCTION_REGISTRY` environment variable.
|
It's recommended to set `FUNC_REGISTRY` environment variable.
|
||||||
```shell script
|
```shell script
|
||||||
# replace ~/.bashrc by your shell rc file
|
# replace ~/.bashrc by your shell rc file
|
||||||
# replace docker.io/johndoe with your registry
|
# replace docker.io/johndoe with your registry
|
||||||
export FUNCTION_REGISTRY=docker.io/johndoe
|
export FUNC_REGISTRY=docker.io/johndoe
|
||||||
echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
echo "export FUNC_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
@ -30,8 +30,8 @@ echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||||
This command builds OCI image for the function.
|
This command builds OCI image for the function.
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
function build # build jar
|
func build # build jar
|
||||||
function build --builder native # build native binary
|
func build --builder native # build native binary
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running
|
### Running
|
||||||
|
|
@ -39,7 +39,7 @@ function build --builder native # build native binary
|
||||||
This command runs the function locally in a container
|
This command runs the function locally in a container
|
||||||
using the image created above.
|
using the image created above.
|
||||||
```shell script
|
```shell script
|
||||||
function run
|
func run
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying
|
### Deploying
|
||||||
|
|
@ -47,7 +47,7 @@ function run
|
||||||
This commands will build and deploy the function into cluster.
|
This commands will build and deploy the function into cluster.
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
function deploy # also triggers build
|
func deploy # also triggers build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Function invocation
|
## Function invocation
|
||||||
|
|
@ -56,7 +56,7 @@ Do not forget to set `URL` variable to the route of your function.
|
||||||
|
|
||||||
You get the route by following command.
|
You get the route by following command.
|
||||||
```shell script
|
```shell script
|
||||||
function describe
|
func describe
|
||||||
```
|
```
|
||||||
|
|
||||||
### cURL
|
### cURL
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ so debugger can be attached if needed.
|
||||||
|
|
||||||
To run test locally run `./mvnw test`.
|
To run test locally run `./mvnw test`.
|
||||||
|
|
||||||
## The `function` CLI
|
## The `func` CLI
|
||||||
|
|
||||||
It's recommended to set `FUNCTION_REGISTRY` environment variable.
|
It's recommended to set `FUNC_REGISTRY` environment variable.
|
||||||
```shell script
|
```shell script
|
||||||
# replace ~/.bashrc by your shell rc file
|
# replace ~/.bashrc by your shell rc file
|
||||||
# replace docker.io/johndoe with your registry
|
# replace docker.io/johndoe with your registry
|
||||||
export FUNCTION_REGISTRY=docker.io/johndoe
|
export FUNC_REGISTRY=docker.io/johndoe
|
||||||
echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
echo "export FUNC_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
@ -30,16 +30,16 @@ echo "export FUNCTION_REGISTRY=docker.io/johndoe" >> ~/.bashrc
|
||||||
This command builds OCI image for the function.
|
This command builds OCI image for the function.
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
function build # build jar
|
func build # build jar
|
||||||
function build --builder native # build native binary
|
func build --builder native # build native binary
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running
|
### Running
|
||||||
|
|
||||||
This command runs the function locally in a container
|
This command runs the func locally in a container
|
||||||
using the image created above.
|
using the image created above.
|
||||||
```shell script
|
```shell script
|
||||||
function run
|
func run
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying
|
### Deploying
|
||||||
|
|
@ -47,7 +47,7 @@ function run
|
||||||
This commands will build and deploy the function into cluster.
|
This commands will build and deploy the function into cluster.
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
function deploy # also triggers build
|
func deploy # also triggers build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Function invocation
|
## Function invocation
|
||||||
|
|
@ -56,7 +56,7 @@ Do not forget to set `URL` variable to the route of your function.
|
||||||
|
|
||||||
You get the route by following command.
|
You get the route by following command.
|
||||||
```shell script
|
```shell script
|
||||||
function describe
|
func describe
|
||||||
```
|
```
|
||||||
|
|
||||||
### cURL
|
### cURL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue