Skip to content

Commit

Permalink
feat!: rename faas to function (#210)
Browse files Browse the repository at this point in the history
* rename faas to function

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* function.yaml -> func.yaml

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
zroubalik committed Nov 6, 2020
1 parent 57e1236 commit cd57692
Show file tree
Hide file tree
Showing 35 changed files with 5,924 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
@@ -1 +1 @@
/faas
/function
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Expand Up @@ -29,21 +29,21 @@ jobs:
- name: Lint
run: make check
- name: Permissions
run: chmod a+x faas_*amd*
run: chmod a+x function_*amd*

# Upload all build artifacts whether it's a release or not
- uses: actions/upload-artifact@v2
with:
name: OSX Binary
path: faas_darwin_amd64
path: function_darwin_amd64
- uses: actions/upload-artifact@v2
with:
name: Linux Binary
path: faas_linux_amd64
path: function_linux_amd64
- uses: actions/upload-artifact@v2
with:
name: Windows Binary
path: faas_windows_amd64.exe
path: function_windows_amd64.exe

# Build and push a latest image with each commit
- name: Image
Expand All @@ -59,7 +59,7 @@ jobs:
# The following steps are only executed if this is a release
- name: Compress Binaries
if: ${{ steps.release.outputs.release_created }}
run: gzip faas_darwin_amd64 faas_linux_amd64 faas_windows_amd64.exe
run: gzip function_darwin_amd64 function_linux_amd64 function_windows_amd64.exe

# Upload all binaries
- name: Upload Darwin Binary
Expand All @@ -69,8 +69,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./faas_darwin_amd64.gz
asset_name: faas_darwin_amd64.gz
asset_path: ./function_darwin_amd64.gz
asset_name: function_darwin_amd64.gz
asset_content_type: application/x-gzip
- name: Upload Linux Binary
uses: actions/upload-release-asset@v1
Expand All @@ -79,8 +79,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./faas_linux_amd64.gz
asset_name: faas_linux_amd64.gz
asset_path: ./functionlinux_amd64.gz
asset_name: function_linux_amd64.gz
asset_content_type: application/x-gzip
- name: Upload Windows Binary
uses: actions/upload-release-asset@v1
Expand All @@ -89,6 +89,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./faas_windows_amd64.exe.gz
asset_name: faas_windows_amd64.exe.gz
asset_path: ./function_windows_amd64.exe.gz
asset_name: function_windows_amd64.exe.gz
asset_content_type: application/x-gzip
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,5 +1,5 @@
/faas
/faas_*
/function
/function_*
/templates/go/events/go.sum
/templates/go/http/go.sum
/coverage.out
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -6,5 +6,5 @@ RUN make

FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=build /src/faas /bin/
ENTRYPOINT ["faas"]
COPY --from=build /src/function /bin/
ENTRYPOINT ["function"]
4 changes: 2 additions & 2 deletions Makefile
@@ -1,5 +1,5 @@
REPO := quay.io/boson/faas
BIN := faas
REPO := quay.io/boson/function
BIN := function

DARWIN=$(BIN)_darwin_amd64
LINUX=$(BIN)_linux_amd64
Expand Down
4 changes: 2 additions & 2 deletions README.md
@@ -1,4 +1,4 @@
# faas
# Boson Function CLI

[![Main Build Status](https://github.com/boson-project/faas/workflows/Main/badge.svg?branch=main)](https://github.com/boson-project/faas/actions?query=workflow%3AMain+branch%3Amain)
[![Develop Build Status](https://github.com/boson-project/faas/workflows/Develop/badge.svg?branch=develop&label=develop)](https://github.com/boson-project/faas/actions?query=workflow%3ADevelop+branch%3Adevelop)
Expand All @@ -9,7 +9,7 @@

[Demo Screencast]

faas is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
`function` is a Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.

[Read the Documentation](docs/README.md)

Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Expand Up @@ -161,9 +161,9 @@ func TestDefaultTrigger(t *testing.T) {
// using a custom path to a template repository on disk. Custom repository
// 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
// $FAAS_TEMPLATES, a Go template named 'json' which is provided in the
// $FUNCTIONTEMPLATES, a Go template named 'json' which is provided in the
// repository 'boson-experimental', would be expected to be in the location:
// $FAAS_TEMPLATES/boson-experimental/go/json
// $FUNCTION_TEMPLATES/boson-experimental/go/json
// See the CLI for full details, but a standard default location is
// $HOME/.config/templates/boson-experimental/go/json
func TestExtensibleTemplates(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions cmd/build.go
Expand Up @@ -14,10 +14,10 @@ import (
func init() {
root.AddCommand(buildCmd)
buildCmd.Flags().StringP("builder", "b", "default", "Buildpacks builder")
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_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) - $FAAS_IMAGE")
buildCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FAAS_REGISTRY")
buildCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_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("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
buildCmd.Flags().StringP("registry", "r", "", "Registry for built images, ex 'docker.io/myuser' or just 'myuser'. Optional if --image provided. - $FUNCTION_REGISTRY")

err := buildCmd.RegisterFlagCompletionFunc("builder", CompleteBuilderList)
if err != nil {
Expand All @@ -31,12 +31,12 @@ var buildCmd = &cobra.Command{
Long: `Build an existing Function project as an OCI image
Builds the Function project in the current directory or in the directory
specified by the --path flag. The faas.yaml file is read to determine the
specified by the --path flag. The func.yaml file is read to determine the
image name and registry. If both of these values are unset in the
configuration file the --registry or -r flag should be provided and an image
name will be derived from the project name.
Any value provided for the --image flag will be persisted in the faas.yaml
Any value provided for the --image flag will be persisted in the func.yaml
configuration file. On subsequent invocations of the "build" command
these values will be read from the configuration file.
Expand Down
8 changes: 4 additions & 4 deletions cmd/completion.go
Expand Up @@ -18,14 +18,14 @@ var completionCmd = &cobra.Command{
Long: `To load completion run
For zsh:
source <(faas completion zsh)
source <(function completion zsh)
If you would like to use alias:
alias f=faas
compdef _faas f
alias f=function
compdef _function f
For bash:
source <(faas completion bash)
source <(function completion bash)
`,
ValidArgs: []string{"bash", "zsh", "fish"},
Expand Down
8 changes: 4 additions & 4 deletions cmd/create.go
Expand Up @@ -13,10 +13,10 @@ import (

func init() {
root.AddCommand(createCmd)
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
createCmd.Flags().StringP("runtime", "l", faas.DefaultRuntime, "Function runtime language/framework. Default runtime is 'node'. Available runtimes: 'node', 'quarkus' and 'go'. - $FAAS_RUNTIME")
createCmd.Flags().StringP("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FAAS_TEMPLATES")
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FAAS_TRIGGER")
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FFUNCTION_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("templates", "", filepath.Join(configPath(), "templates"), "Extensible templates path. - $FUNCTION_TEMPLATES")
createCmd.Flags().StringP("trigger", "t", faas.DefaultTrigger, "Function trigger. Default trigger is 'http'. Available triggers: 'http' and 'events' - $FUNCTION_TRIGGER")

if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
fmt.Println("Error while calling RegisterFlagCompletionFunc: ", err)
Expand Down
10 changes: 5 additions & 5 deletions cmd/delete.go
Expand Up @@ -13,8 +13,8 @@ import (

func init() {
root.AddCommand(deleteCmd)
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FAAS_PATH")
deleteCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
deleteCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be deleted - $FUNCTION_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")
}

Expand All @@ -25,13 +25,13 @@ var deleteCmd = &cobra.Command{
Removes a deployed function from the cluster. The user may specify a function
by name, path using the --path or -p flag, or if neither of those are provided,
the current directory will be searched for a faas.yaml configuration file to
the current directory will be searched for a func.yaml configuration file to
determine the function to be removed.
The namespace defaults to the value in faas.yaml or the namespace currently
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 using the --namespace or -n flag, and if so this will
overwrite the value in faas.yaml.
overwrite the value in func.yaml.
`,
SuggestFor: []string{"remove", "rm", "del"},
ValidArgsFunction: CompleteFunctionList,
Expand Down
16 changes: 8 additions & 8 deletions cmd/deploy.go
Expand Up @@ -15,12 +15,12 @@ import (

func init() {
root.AddCommand(deployCmd)
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FAAS_CONFIRM")
deployCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options - $FUNCTION_CONFIRM")
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) - $FAAS_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 - $FAAS_NAMESPACE")
deployCmd.Flags().StringP("path", "p", cwd(), "Path to the function project directory - $FAAS_PATH")
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FAAS_REGISTRY")
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("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("path", "p", cwd(), "Path to the function project directory - $FUNCTION_PATH")
deployCmd.Flags().StringP("registry", "r", "", "Image registry for built images, ex 'docker.io/myuser' or just 'myuser'. - $FUNCTION_REGISTRY")
}

var deployCmd = &cobra.Command{
Expand All @@ -30,18 +30,18 @@ var deployCmd = &cobra.Command{
Builds and Deploys the Function project in the current directory.
A path to the project directory may be provided using the --path or -p flag.
Reads the faas.yaml configuration file to determine the image name.
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.
If the Function is already deployed, it is updated with a new container image
that is pushed to an image registry, and the Knative Service is updated.
The namespace into which the project is deployed defaults to the value in the
faas.yaml configuration file. If NAMESPACE is not set in the configuration,
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 faas.yaml file.
or -n flag, and if so this will overwrite the value in the func.yaml file.
`,
Expand Down
10 changes: 5 additions & 5 deletions cmd/describe.go
Expand Up @@ -17,9 +17,9 @@ import (

func init() {
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 - $FAAS_NAMESPACE")
describeCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FAAS_PATH")
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("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")
describeCmd.Flags().StringP("path", "p", cwd(), "Path to the project which should be described - $FUNCTION_PATH")

err := describeCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
if err != nil {
Expand All @@ -36,9 +36,9 @@ Prints the name, route and any event subscriptions for a deployed Function in
the current directory. A path to a Function project directory may be supplied
using the --path or -p flag.
The namespace defaults to the value in faas.yaml or the namespace currently
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
using the --namespace or -n flag, and if so this will overwrite the value in faas.yaml.
using the --namespace or -n flag, and if so this will overwrite the value in func.yaml.
`,
SuggestFor: []string{"desc", "get"},
ValidArgsFunction: CompleteFunctionList,
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions cmd/list.go
Expand Up @@ -18,8 +18,8 @@ import (

func init() {
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 - $FAAS_NAMESPACE")
listCmd.Flags().StringP("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FAAS_FORMAT")
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("format", "f", "human", "optionally specify output format (human|plain|json|xml|yaml) $FUNCTION_FORMAT")

err := listCmd.RegisterFlagCompletionFunc("format", CompleteOutputFormatList)
if err != nil {
Expand All @@ -32,10 +32,10 @@ var listCmd = &cobra.Command{
Short: "Lists deployed Functions",
Long: `Lists deployed Functions
Lists all deployed functions. The namespace defaults to the value in faas.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 may be specified on the command line using the --namespace or -n flag.
If specified this will overwrite the value in faas.yaml.
If specified this will overwrite the value in func.yaml.
`,
SuggestFor: []string{"ls", "lsit"},
PreRunE: bindEnv("namespace", "format"),
Expand Down
20 changes: 10 additions & 10 deletions cmd/root.go
Expand Up @@ -17,13 +17,13 @@ import (
// available flags, etc. It has no action of its own, such that running the
// resultant binary with no arguments prints the help/usage text.
var root = &cobra.Command{
Use: "faas",
Short: "Function as a Service",
Use: "function",
Short: "Manage function projects",
SilenceErrors: true, // we explicitly handle errors in Execute()
SilenceUsage: true, // no usage dump on error
Long: `Function as a Service
Long: `Manage function projects.
Create and run Functions as a Service.`,
Create, build and deploy functions as Knative Services.`,
}

// NewRootCmd is used to initialize faas as kn plugin
Expand Down Expand Up @@ -53,8 +53,8 @@ func init() {
// version subcommand: nothing but the version.
root.SetVersionTemplate(`{{printf "%s\n" .Version}}`)

// Prefix all environment variables with "FAAS_" to avoid collisions with other apps.
viper.SetEnvPrefix("faas")
// Prefix all environment variables with "FUNCTION_" to avoid collisions with other apps.
viper.SetEnvPrefix("function")
}

// Execute the command tree by executing the root command, which runs
Expand Down Expand Up @@ -97,15 +97,15 @@ func cwd() (cwd string) {
// function defaults and extensible templates.
func configPath() (path string) {
if path = os.Getenv("XDG_CONFIG_HOME"); path != "" {
path = filepath.Join(path, "faas")
path = filepath.Join(path, "function")
return
}
home, err := homedir.Expand("~")
if err != nil {
fmt.Fprintf(os.Stderr, "could not derive home directory for use as default templates path: %v", err)
path = filepath.Join(".config", "faas")
path = filepath.Join(".config", "function")
} else {
path = filepath.Join(home, ".config", "faas")
path = filepath.Join(home, ".config", "function")
}
return
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
// will be prepended.
//
// If the image flag is provided, this value is used directly (the user supplied
// --image or $FAAS_IMAGE). Otherwise, the Function at 'path' is loaded, and
// --image or $FUNCTION_IMAGE). Otherwise, the Function at 'path' is loaded, and
// the Image name therein is used (i.e. it was previously calculated).
// Finally, the default registry is used, which is prepended to the Function
// name, and appended with ':latest':
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Expand Up @@ -14,7 +14,7 @@ func init() {
// Add the run command as a subcommand of root.
root.AddCommand(runCmd)
runCmd.Flags().StringArrayP("env", "e", []string{}, "Sets environment variables for the Function.")
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FAAS_PATH")
runCmd.Flags().StringP("path", "p", cwd(), "Path to the Function project directory - $FUNCTION_PATH")
}

var runCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion config.go
Expand Up @@ -9,7 +9,7 @@ import (
)

// ConfigFile is the name of the config's serialized form.
const ConfigFile = "faas.yaml"
const ConfigFile = "func.yaml"

// Config represents the serialized state of a Function's metadata.
// See the Function struct for attribute documentation.
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
@@ -1,8 +1,8 @@
# FAAS Documentation
# Function Documentation

[Demo Screencast]

`faas` is a "Function as a Service" Client Library and CLI for enabling the development of implicitly deployed, platform agnostic code.
`function` 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).

Expand Down

0 comments on commit cd57692

Please sign in to comment.