Skip to content

Commit

Permalink
added --wait flag, clarified info output, rebuilt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Oct 20, 2023
1 parent 18e94f8 commit e802cd3
Show file tree
Hide file tree
Showing 40 changed files with 428 additions and 462 deletions.
47 changes: 4 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
# KubeFox CLI (Fox)
# KubeFox CLI (🦊 Fox)

[![Go Report Card](https://goreportcard.com/badge/github.com/xigxog/kubefox-cli)](https://goreportcard.com/report/github.com/xigxog/kubefox-cli)

CLI for interacting with the KubeFox platform.

## Synopsis

Fox 🦊 is a CLI for interacting with the KubeFox platform. You can use it to
create, build, validate, and manage your KubeFox Components, Applications, and
Systems.

## Example Usage

> Note: this assumes an already configured KubeFox installation.
### Initialization

1. Create a new repository in your GitHub organization. This will be the repo
for your new system.
2. run `git clone <your repo here>` to clone the repo to your machine.
3. run `cd <your repo name>` to change into your git repos directory.
4. run `fox init`

> At this point your system will be setup to work with KubeFox, added to your
> KubeFox Platform, and checked into git.
### Publish, Deploy, Release

1. Check in all your application code in the components directory, and necessary
information in your application yaml file
2. Create configuration and environment files, and apply them using `fox apply
-f <path/to/file>`
3. Tag your config and environments using `fox create tag <env|config/name>
--tag <semver>--id <id of object>`
4. run `fox publish -t <semver>` to build your application images and tag your
System. This will update your system in KubeFox with this System Ref. NOTE:
This command requires access to a docker daemon.
5. run `fox create deployment --system <system name> -t <semver of system ref>`
to deploy your specific System Reference.
6. run `fox create release --systemref <path/to/sysref> --environment
<path/to/env>` to release your applications to your users.

## NOTES

> See docs folder for full documentation on the CLI.
🦊 Fox is a CLI for interacting with KubeFox. You can use it to build, deploy,
and release your KubeFox apps. See
[docs](https://github.com/xigxog/kubefox-cli/blob/main/docs/fox.md) for details.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ "$GOOS" == "windows" ]; then
bin="fox.exe"
fi

echo "Creating Fox release package..."
echo "Creating 🦊 Fox release package..."
echo "Git Commit: $GIT_COMMIT, Git Ref: $GIT_REF, Package: ${rel_dir}/${tar}"

go build \
Expand Down
10 changes: 7 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ var buildCmd = &cobra.Command{
Args: cobra.ExactArgs(1),
PreRun: setup,
Run: build,
Short: "Build and publish an OCI image of your component",
Short: "Build and optionally push an OCI image of component",
Long: `
This will use the specified Cloud Native BuildPack to build, package, and optionally publish the component provided as an OCI image to the registry.
The build command will use Docker to build the specified component. By default
components are built using a KubeFox defined Dockerfile. A custom Dockerfile can
be provided my placing it in the root directory of the component. Please note
that the build working directory is the root of the repository, not the
component directory.
Examples:
# Build and push container image for my-component
# Build and push OCI image for my-component.
fox build my-component --publish
`,
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ var cfgCmd = &cobra.Command{
Use: "config",
Args: cobra.NoArgs,
PersistentPreRun: setup,
Short: "Configure your KubeFox Client",
Short: "Configure 🦊 Fox",
Long: `
Use the config subcommand to help setup your local CLI environment.
Use the config subcommand to help setup your local environment.
`,
}

Expand All @@ -21,7 +21,7 @@ var cfgShowCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
log.Marshal(cfg)
},
Short: "Show your current KubeFox configuration",
Short: "Show the current configuration",
}

var cfgSetupCmd = &cobra.Command{
Expand All @@ -32,7 +32,7 @@ var cfgSetupCmd = &cobra.Command{
cfg.Setup()
}
},
Short: "Update your current KubeFox configuration",
Short: "Run setup to configure 🦊 Fox",
}

func init() {
Expand Down
9 changes: 5 additions & 4 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
)

var deployCmd = &cobra.Command{
Use: "deploy [name]",
Use: "deploy [deployment name]",
Args: cobra.ExactArgs(1),
PreRun: setup,
Run: runDeploy,
Short: "Deploy components to the KubeFox platform",
Short: "Deploy app using the version of the currently checked out Git commit",
Long: ``,
}

Expand All @@ -22,8 +22,9 @@ func init() {
}

func addCommonDeployFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&cfg.Flags.Platform, "platform", "p", "", "Platform to run Components with")
cmd.Flags().StringVarP(&cfg.Flags.Namespace, "namespace", "n", "", "Namespace of Platform")
cmd.Flags().StringVarP(&cfg.Flags.Platform, "platform", "p", "", "platform to run components with")
cmd.Flags().StringVarP(&cfg.Flags.Namespace, "namespace", "n", "", "namespace of platform")
cmd.Flags().DurationVarP(&cfg.Flags.WaitTime, "wait", "", 0, "wait up the specified time for components to be ready")
}

func checkCommonDeployFlags(name string) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
var docsCmd = &cobra.Command{
Use: "docs",
Run: generateDocs,
Short: "Generate docs for Fox CLI",
Short: "Generate docs for 🦊 Fox",
Long: `
Run this command to automatically generate Fox CLI documentation. Output is
Run this command to automatically generate 🦊 Fox documentation. Output is
placed in the subdirectory docs of the working directory.`,
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (

var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize a KubeFox repo",
Short: "Initialize a KubeFox app",
Args: cobra.NoArgs,
PreRun: setup,
Run: initRepo,
Long: `
The init command create the skelton of a KubeFox repo with sample components in
the provided dir.
The init command creates the skelton of a KubeFox app and ensures a Git
repository is present. It will optionally create simple 'hello-world' app to get
you started.
`,
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var publishCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
PreRun: setup,
RunE: runPublish,
Short: "The publish commands builds all components, publishes images, and deploys them to KubeFox.",
Short: "Builds, pushes, and deploys app using the version of the currently checked out Git commit",
}

var (
Expand Down
23 changes: 12 additions & 11 deletions cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,29 @@ import (
)

var releaseCmd = &cobra.Command{
Use: "release [name]",
Use: "release [release name]",
Args: cobra.ExactArgs(1),
PreRun: setup,
Run: release,
Short: "Release a deployed system",
Short: "Release app using the version of the currently checked out Git commit",
Long: `
The release command will activate the specified deployed KubeFox. This will
trigger events matching routes of the system to be automatically sent to the
deployed components. The system must be deployed to release it. Either id or
tag must be provided.
The release command will ensure all components are deployed and then activate
their routes. This causes genesis events matching component's routes to be
automatically sent to the component with the specified environment being
injected.
Examples:
#
fox release --system demo/tag/v1.0.3 --environment dev/tag/v1.2
# Create a release named 'staging' using the 'qa' environment.
fox release staging --env qa
`,
}

func init() {
releaseCmd.Flags().StringVarP(&cfg.Flags.Env, "env", "e", "", "Environment resource to release to (required)")
releaseCmd.Flags().StringVarP(&cfg.Flags.EnvUID, "env-uid", "", "", "Environment resource UID to release to")
releaseCmd.Flags().StringVarP(&cfg.Flags.EnvVersion, "env-version", "", "", "Environment resource version to release to")
releaseCmd.Flags().StringVarP(&cfg.Flags.Env, "env", "e", "", "environment resource to release to (required)")
releaseCmd.Flags().StringVarP(&cfg.Flags.EnvUID, "env-uid", "", "", "environment resource UID to release to")
releaseCmd.Flags().StringVarP(&cfg.Flags.EnvVersion, "env-version", "", "", "environment resource version to release to")
addCommonBuildFlags(releaseCmd)
addCommonDeployFlags(releaseCmd)
releaseCmd.MarkFlagRequired("env")

rootCmd.AddCommand(releaseCmd)
Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ var rootCmd = &cobra.Command{
PersistentPreRun: initViper,
Short: "CLI for interacting with KubeFox",
Long: `
🦊 Fox is a CLI for interacting with KubeFox. You can use it to create, build,
deploy, and release your KubeFox components.
🦊 Fox is a CLI for interacting with KubeFox. You can use it to build, deploy,
and release your KubeFox apps.
`,
}

func init() {
rootCmd.PersistentFlags().StringVarP(&cfg.Flags.RepoPath, "repo", "r", pwd(), "path of git repo")
rootCmd.PersistentFlags().StringVarP(&cfg.Flags.OutFormat, "output", "o", "yaml", `output format. One of: "json", "yaml"`)
rootCmd.PersistentFlags().StringVarP(&cfg.Flags.RepoPath, "repo", "r", pwd(), "path of Git repository to operate against")
rootCmd.PersistentFlags().StringVarP(&cfg.Flags.OutFormat, "output", "o", "yaml", `output format, one of ["json", "yaml"]`)
rootCmd.PersistentFlags().BoolVarP(&cfg.Flags.Info, "info", "i", false, "enable info output")
rootCmd.PersistentFlags().BoolVarP(&cfg.Flags.Verbose, "verbose", "v", false, "enable verbose output")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var verCmd = &cobra.Command{
Use: "version",
Run: runVer,
Short: "Show version information of Fox CLI",
Short: "Show version information of 🦊 Fox",
}

func init() {
Expand Down
38 changes: 17 additions & 21 deletions docs/fox.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,30 @@ CLI for interacting with KubeFox
### Synopsis


🦊 Fox is a CLI for interacting with KubeFox. You can use it to create, build,
validate, deploy, and release your KubeFox components, apps, and systems.
🦊 Fox is a CLI for interacting with KubeFox. You can use it to build, deploy,
and release your KubeFox Apps.


### Options

```
-h, --help help for fox
-o, --output string output format. One of: "json", "yaml" (default "yaml")
-r, --system-repo string path of the system git repo (default "/home/xadhatter/Workspace/src/github.com/xigxog/kubefox-cli")
-u, --url string url to the KubeFox API
-v, --verbose enable verbose output
-h, --help help for fox
-i, --info enable info output
-o, --output string output format, one of ["json", "yaml"] (default "yaml")
-r, --repo string path of Git repository to operate against (default "/home/xadhatter/Workspace/src/github.com/xigxog/kubefox-cli")
-v, --verbose enable verbose output
```

### SEE ALSO

* [fox apply](fox_apply.md) - Create or update a KubeFox resource from a file
* [fox build](fox_build.md) - Build and publish an OCI image of your component
* [fox build](fox_build.md) - Build and optionally push an OCI image of component
* [fox completion](fox_completion.md) - Generate the autocompletion script for the specified shell
* [fox config](fox_config.md) - Configure your KubeFox Client
* [fox delete](fox_delete.md) - Delete KubeFox resources
* [fox deploy](fox_deploy.md) - Deploy a system to the KubeFox platform
* [fox docs](fox_docs.md) - Generate docs for Fox CLI
* [fox generate](fox_generate.md) - Generates a system object from a KubeFox managed git repo
* [fox get](fox_get.md) - Get KubeFox resource by path
* [fox init](fox_init.md) - Initialize a KubeFox System
* [fox publish](fox_publish.md) - The publish commands builds all components, publishes images, and adds the system to KubeFox.
* [fox release](fox_release.md) - Release a deployed system
* [fox tag](fox_tag.md) - Tag a KubeFox object

###### Auto generated by spf13/cobra on 24-Apr-2023
* [fox config](fox_config.md) - Configure 🦊 Fox
* [fox deploy](fox_deploy.md) - Deploy app using the version of the currently checked out Git commit
* [fox docs](fox_docs.md) - Generate docs for 🦊 Fox
* [fox init](fox_init.md) - Initialize a KubeFox app
* [fox publish](fox_publish.md) - Builds, pushes, and deploys app using the version of the currently checked out Git commit
* [fox release](fox_release.md) - Release app using the version of the currently checked out Git commit
* [fox version](fox_version.md) - Show version information of 🦊 Fox

###### Auto generated by spf13/cobra on 20-Oct-2023
38 changes: 0 additions & 38 deletions docs/fox_apply.md

This file was deleted.

30 changes: 17 additions & 13 deletions docs/fox_build.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
## fox build

Build and publish an OCI image of your component
Build and optionally push an OCI image of component

### Synopsis


This will use the specified Cloud Native BuildPack to build, package, and optionally publish the component provided as an OCI image to the registry.
The build command will use Docker to build the specified component. By default
components are built using a KubeFox defined Dockerfile. A custom Dockerfile can
be provided my placing it in the root directory of the component. Please note
that the build working directory is the root of the repository, not the
component directory.

Examples:
# Build and push container image for my-component
# Build and push OCI image for my-component.
fox build my-component --publish


Expand All @@ -19,24 +23,24 @@ fox build [component name] [flags]
### Options

```
-b, --builder string BuildPack builder to use (default "paketobuildpacks/builder:base")
-c, --clear-cache clear BuildPack cache
-h, --help help for build
-i, --publish publish image to OCI image registry
-g, --registry string OCI image registry to publish images to (default "ghcr.io")
--force force build even if component image exists
-h, --help help for build
-k, --kind string if provided the built image will be loaded into the Kind cluster
--no-cache do not use cache when building image
--push publish image to OCI image registry
```

### Options inherited from parent commands

```
-o, --output string output format. One of: "json", "yaml" (default "yaml")
-r, --system-repo string path of the system git repo (default "/home/xadhatter/Workspace/src/github.com/xigxog/kubefox-cli")
-u, --url string url to the KubeFox API
-v, --verbose enable verbose output
-i, --info enable info output
-o, --output string output format, one of ["json", "yaml"] (default "yaml")
-r, --repo string path of Git repository to operate against (default "/home/xadhatter/Workspace/src/github.com/xigxog/kubefox-cli")
-v, --verbose enable verbose output
```

### SEE ALSO

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 24-Apr-2023
###### Auto generated by spf13/cobra on 20-Oct-2023
Loading

0 comments on commit e802cd3

Please sign in to comment.