Skip to content

Commands

Alex Co edited this page Mar 23, 2024 · 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.

logs

NAME

wukong application logs - Getting the logs of the applications from the Google Cloud Logging.

SYNOPSIS

wukong application logs

DESCRIPTION

Displaying the logs of the application from the Google Cloud Logging. By default it will displays the last 100 lines of the logs. Extra flags are provided to add more capabilities, for example filter by text, severity or tailing the logs.

FLAGS

--namespace          # (optional) The namespace to deploy to. Default is Prod.
--version             # (optional) The version that the deployment will perform
                      # against. It can only be either green or blue. 
                      # Default is green 
--errors              # Only print out logs line with severity >= ERROR.
--include -i          # (allow multiple flags) Logs lines to include.
--exclude -e          # (allow multiple flags) Logs lines to exclude.
--since   -s          # Show logs lines newer from relative duration, e.g 5m, 1h, 1d.
                      # Also accept datetime in RFC 3339 format.
--until   -u          # Show logs lines older than relative duration, e.g 30m, 2h, 2d.
                      # Also accept datetime in RFC 3339 format.
--limit               # Limiting the number of log entries to return. 
                      # By default it will return the last 500 lines.
--tail                # Streaming logs lines in real time.
--url-mode            # Generate the URL to view the logs in browser.

OUTPUT

$ wukong application logs
Checking if you're authenticated to Google Cloud......

You're either not authenticated to Google Cloud or your token has expired. 
Before reading logs from `mv-platform` application, you must agree to authenticate 
against Google Cloud using your credentials. 

By agreeing to authenticate against Google Cloud, you will be sending to 
a browser window for the authentication process. Do you agree ? (Y/n) Y

Opening your browser......If your browser is not opening, you can copy the
link below and paste it into your browser window.

(HTTP URL)

Congratulations ! You are authenticated against Google Cloud. Please press ENTER to
start viewing your logs. 

time="2023-03-03T06:41:29Z" level=info msg="Ignore status for CustomResourceDefinitions"

time="2023-03-03T06:41:29Z" level=info msg="Refreshing app status (comparison expired. reconciledAt: 2023-03-03 06:38:29 +0000 UTC, expiry: 3m0s), level (2)" application=alertmanager

time="2023-03-03T06:41:29Z" level=info msg="Reconciliation completed" application=spinnaker-headless-becs0 dedup_ms=0 dest-name=gke_mv-prod-applications-hub_us-east4_mv-prod-apphub-use4-gke-01 dest-namespace=spinnaker dest-server="https://34.150.176.69" diff_ms=8 fields.level=2 git_ms=178 health_ms=0 live_ms=106 settings_ms=0 sync_ms=0 time_ms=648

time="2023-03-03T06:41:29Z" level=info msg="Update successful" application=spinnaker-headless-becs0


time="2023-03-03T06:41:28Z" level=info msg="getRepoObjs stats" application=mv-stg-spinnaker-appconsole build_options_ms=0 helm_ms=0 plugins_ms=0 repo_ms=0 time_ms=195 unmarshal_ms=195 version_ms=0


time="2023-03-03T06:41:28Z" level=info msg="getRepoObjs stats" application=spinnaker-slo-rules build_options_ms=0 helm_ms=0 plugins_ms=0 repo_ms=0 time_ms=196 unmarshal_ms=196 version_ms=0

time="2023-03-03T06:41:28Z" level=info msg="getRepoObjs stats" application=vault-webhook-spinnaker build_options_ms=0 helm_ms=0 plugins_ms=0 repo_ms=0 time_ms=189 unmarshal_ms=189 version_ms=0

time="2023-03-03T06:41:28Z" level=info msg="getRepoObjs stats" application=botkube-prah8 build_options_ms=0 helm_ms=0 plugins_ms=0 repo_ms=0 time_ms=195 unmarshal_ms=194 version_ms=0

time="2023-03-03T06:41:28Z" level=info msg="Comparing app state (cluster: https://34.87.56.10, namespace: spinnaker-operator)" application=spinnaker-operator-6n

instances list

NAME

wukong application instances list - Listing the currently running Elixir instances, normally under a GKE Pod.

SYNOPSIS

wukong application instances list

DESCRIPTION

List all the available running Pods for an application. It will show the Pod’s name and IP address.

FLAGS

--namespace           # (optional) The namespace to list the running instances.
                      # Default is Prod.
--version             # (optional) The version of the application to filter the 
                      # returning running instances. Default is Green

OUTPUT

$ wukong application instances list
Checking your permission to connect to the remote instance....(:check_mark:)

### If does not have permission
You don't have permission to connect to this instance.
Please check with your team manager to get approval first.
###

Listing running instances of the application mv-wukong-ci-mock on namespace production....

INSTANCE-NAME                                            INSTANCE-IP
blue@prod/mv-wukong-ci-mock-blue-75c9d447c7-k2lbf        10.1.2.66
green@staging/mv-wukong-ci-mock-green-54bdd795bf-f6kvg   10.1.3.67

instances connect

NAME

wukong application instances connect - Start the interactive session to connect to the remote Elixir instance.

SYNOPSIS

wukong application instances connect [NAME]

DESCRIPTION

Start the interactive session to connect to the remote Elixir running instance. It will deploy a Livebook server, along with a LoadBalancer to allow developer to access the Livebook WebUI. User will authenticate with the Livebook using a random-generated password.

When started, the Wukong CLI will keep watching the Livebook instance. On the event of exiting the interactive session, the Wukong CLI will performing cleanup by deleting the associated resources with the Livebook instance.

OUTPUT

Checking your permission to connect to the remote instance...✅
Provisioning your livebook instance...✅
Testing connectivity to your livebook instance...✅

✅ Your livebook instance is ready! Use the following details to access:

URL 🔗: https://foo-bar.livebook.mindvalley.dev
Password 🔑: some-random-password

⠚ Your livebook instance is running. Press Ctrl-C to terminate... 

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 

status

NAME

wukong deployment status - Get the status of the latest deployment.

SYNOPSIS

wukong deployment status

DESCRIPTION

Showing the performance data from available sources. Additionally, it will generate some magic links, whenever possible, so developers can quickly jump to the latest performance data on various external platforms.

FLAGS

--version             # (optional) The version that the deployment will perform
                      # against. It can only be either green or blue. 
                      # Default is green