cmd-1.4.0

KOSI Plugin cmd Version 1.4.0

Summary

The cmd command calls either the bash plugin (the plugin that executes commands in the bash terminal in linux), or if not available the sh plugin (the plugin that executes commands in the sh terminal in linux) and passes the parameters through.
This plugin also supports chaining of multiple commands with the semicolon ; as a divider.

Plugin dependencies

If you want to use the plugin cmd you need one of following plugins:

Keys

Key Description
command Mandatory set this to a command for the bash or the sh terminal .

Note: The command has to be surrounded by double quotes, otherwise it will not be recognized.

usage

Example 1 - Single commands

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the cmd-plugin"');
    cmd(command='"echo Hello World"');
}

Result

This will be printed to the console:

2023-12-01 10:44:30 Info:      use plugin bash if available
Using the cmd-plugin
Hello World

Example 2 - Multiple commands

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the cmd-plugin"');
    cmd(command='"echo Hello World! > test.txt; cat test.txt"');
}

Result

A file named test.txt is created and “Hello World!” is written to the file.
The second command outputs the contents of the file.

2023-12-01 11:06:17 Info:      run cmd plugin
Using the cmd-plugin
2023-12-01 11:06:17 Info:      run cmd plugin
Hello World!