Skip to content

Commands

Alex Co edited this page Apr 20, 2023 · 9 revisions

general

init

NAME

wukong init - Prepare the CLI before using it.

SYNOPSIS

wukong init

DESCRIPTION

Start the initialization process. This step will ask user to authenticate with a new credentials or keep their current credentials (if any). It also will ask user to select a default application to work with.

login

NAME

wukong login - Login the CLI with Okta credentials.

SYNOPSYS

wukong login

DESCRIPTION

Command to force re-login to Okta. Normally the wukong init already includes the login process, however there are certain cases that user will need to re-login, or using a different credentials.

config

list

NAME

wukong config list - List the current configuration object.

SYNOPSIS

wukong config list

DESCRIPTION

List the configurations of the CLI.

get

NAME

wukong config get - Get a specific config value.

SYNOPSIS

wukong config get NAME

DESCRIPTION

Get a specific config value. The name of the config key can take from a suggested list. For example if you want to set the output log director, just run wukong config get log then the CLI will show you the suggestion about which config key to use.

$ wukong config get log
error: "log" isn't a valid value for '<CONFIG_NAME>'
	[possible values: application, collect-telemetry, enable-log, log-dir]

	Did you mean "log-dir"?

For more information try --help

set

NAME

wukong config set - Set a specific config value

SYNOPSIS

wukong config set NAME VALUE

DESCRIPTION

Set a specific config value. For example if you want to change the default application, run wukong config set application foo, the CLI will change the default application to foo.

application

info

NAME

wukong application info - show the application’s relevant informations.

SYNOPSIS

wukong application info

DESCRIPTION

Show the current application’s informations. The command will show the important information that can be used for day to day operation. It will help the developers to find the information quicker without asking around.

dev config

lint

NAME

wukong dev config int - Linting the dev.exs and config.exs files and show possible warnings, as well as suggestion how to fix the violations.

SYNOPSIS

wukong dev config lint

DESCRIPTION

Performing linting on the development config and show the rules violations, as well as proposing the fix.

OUTPUT

This command works similarly as other language linter. For the demonstration purposes we’re borrowing the output syntax from the Rust’s Clippy library. Clippy is a linter for Rust.

/path/to/elixir/project
$ wukong dev config lint
Detecting language and framework.......
Looks like you're using Elixir language and Phoenix framework.
Detecting possible dev.exs config....
Found the following files:
- config/dev.exs
error[E0308]: using environment variable during compilation phase
  --> config/dev.exs:16:25
   |
16 |         jenkins_username = System.get_env("JENKINS_USERNAME", "jenkins-user")
   |                ---------   ^^^^- help: Use a static value instead of using environment variables
   |                |        |
   |                |        expected static value, found environment variable
   |                expected due to this 

pull

NAME

wukong dev config pull - Pull the development config with secrets file from Bunker.

SYNOPSIS

wukong dev config pull

DESCRIPTION

Checking the development config and decides whether it should synthesise the final config by pulling the secrets file from Bunker. An application may or may not need to pull the secrets file from Bunker but if it does, this command will pull the latest secrets file. It is useful to incorporate this command into existing framework toolchains, for example make it a target before running the development server.

push

NAME

wukong dev config push - Allow to view the current secrets file from Bunker and make the necessary changes.

SYNOPSIS

wukong dev config push

DESCRIPTION

This command pulls the latest development secrets file from Bunker, compares it with the local version. If there are any changes have been made, it will show the diff between local and remote version. Then upon user’s confirmation, overwrite the changes in the remote with the local version.

NOTES:

If the Wukong CLI is detecting multiple secrets eligible for editing, it will display a selection prompt for users to choose before editing the secret.

OUTPUTS

/path/to/elixir/project
$ wukong dev config push
Finding config with annotation.....
There are (3) config files found !
Comparing local vs remote ....

Which one do you like to push the changes ?
  Config file                       Secrets Location
> config/dev.secrets.exs            vault:secret/path/to/secret#secret_key
  apps/api/config/dev.secrets.exs   vault:secret/path/to/secret#secret_key

File config/dev.exs has been selected. Calculating diff.....

+ add_some_line
- remove_some_line

Confirm this change & push ? (Y/n) n

diff

NAME

wukong dev config diff - View diff between the local config secrets and the remote secrets.

SYNOPSIS

wukong dev config diff

DESCRIPTION

This command pulls the latest development secrets file from Bunker, compares it with the local version. If there are any changes have been made, it will show the diff between local and remote version.

OUTPUTS

/path/to/elixir/project
$ wukong dev config diff
Finding config with annotation.....
There are (3) config files found !
Comparing local vs remote ....

diff --git a/config/dev.exs b/config/dev.exs
index 2702607..f4ce258 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -63,3 +63,10 @@ config :phoenix, :stacktrace_depth, 20

 # Initialize plugs at runtime for faster development compilation
 config :phoenix, :plug_init_mode, :runtime
+
+# wukong.mindvalley.dev/config-secrets-location: vault:secret/wukong-cli/development/asdfsa#test33
+if File.exists?("dev.secrets.exs") do
+  import_config("dev.secrets.exs")
+end
+
+

diff --git a/config/dev1.exs b/config/dev1.exs
index 2702607..f4ce258 100644
--- a/config/dev1.exs
+++ b/config/dev1.exs
@@ -63,3 +63,10 @@ config :phoenix, :stacktrace_depth, 20

 # Initialize plugs at runtime for faster development compilation
 config :phoenix, :plug_init_mode, :runtime
+
+# wukong.mindvalley.dev/config-secrets-location: vault:secret/wukong-cli/development/asdfsa#test33
+if File.exists?("dev.secrets.exs") do
+  import_config("dev.secrets.exs")
+end
+
+

pipeline

list

NAME

wukong pipeline list - List the current available pipelines of an application.

SYNOPSIS

wukong pipeline list

DESCRIPTION

List the current pipelines of the application.

describe

NAME

wukong pipeline describe - Show the details of a pipeline.

SYNOPSIS

wukong pipeline describe NAME

DESCRIPTION

Show the details of a pipeline. If a pipeline is a multi-branch, show the current status of the branch/PRs.

ci-status

NAME

wukong pipeline ci-status - Show the build status and (possible) errors on branch ci pipeline.

SYNOPSIS

wukong pipeline ci-status

DESCRIPTION

Show the ci status (status of the latest build) of your current branch’s PR.This command requires your current path is inside a supported Mindvalley application. IT WILL NOT WORK otherwise. Branches (other than master/main/staging) that do not have an open PR will return an error stating that there are no builds associated with the branch.

deployment

list

NAME

wukong deployment list - List the current available deployment pipelines of an application.

SYNOPSIS

wukong deployment list

DESCRIPTION

List the current available deployment pipelines of an application.

execute

NAME

wukong deployment execute - Start the deployment pipeline.

SYNOPSIS

wukong deployment execute [FLAGS….]

DESCRIPTION

Start the deployment pipeline with a (optional) image tag and parameters.

FLAGS

--namespapce          # (optional) The namespace to deploy to
--version             # (optional) The version that the deployment will perform
                      # against. It can only be either green or blue. 
                      # Default is green 
--artifact            # (optional) The build artifact that the deployment will use.

rollback

NAME

wukong deployment rollback - rolling back the application to the previous deployment.

SYNOPSIS

wukong deployment rollback

DESCRIPTION

Rolling back the deployment to the previous deployed artifact. This command will looks for the last succeed deployment and create a new deployment execution with the build artifact from the last succeed deployment.

FLAGS

--namespapce          # (optional) The namespace to deploy to
--version             # (optional) The version that the deployment will perform
                      # against. It can only be either green or blue. 
                      # Default is green 
Clone this wiki locally