11. Skipper Shell

The shell is based on the Spring Shell project. Two of the shell’s best features are tab-completion and colorization of commands. Use the 'help' command or the --help argument when starting the shell to get help information. The output of using the --help argument follows:

Skipper Options:

  --spring.cloud.skipper.client.serverUri=<uri>                        Address of the Skipper Server [default: http://localhost:7577].
  --spring.cloud.skipper.client.username=<USER>                        Username of the Skipper Server [no default].
  --spring.cloud.skipper.client.password=<PASSWORD>                    Password of the Skipper Server [no default].
  --spring.cloud.skipper.client.credentials-provider-command=<COMMAND> Executes an external command which must return an OAuth Access Token [no default].
  --spring.cloud.skipper.client.skip-ssl-validation=<true|false>       Accept any SSL certificate (even self-signed) [default: no].

  --spring.shell.historySize=<SIZE>                 Default size of the shell log file [default: 3000].
  --spring.shell.commandFile=<FILE>                 Skipper Shell executes commands read from the file(s) and then exits.

  --help                                            This message.

11.1 Shell Modes

The shell can be started in either interactive or non-interactive mode. In the case of the non-interactive mode, command line arguments are executed as Skipper commands, and then the shell exits. If there are any arguments that do not have the prefix spring.cloud.skipper.client, they are considered as skipper commands to execute.

Consider the following example:

java -jar spring-cloud-skipper-shell-1.0.4.RELEASE.jar --spring.cloud.skipper.client.serverUri=http://localhost:9123/api

The preceding example brings up the interactive shell and connects to localhost:9123/api. Now consider the following command:

$ java -jar spring-cloud-skipper-shell-1.0.4.RELEASE.jar --spring.cloud.skipper.client.serverUri=http://localhost:9123/api search

The preceding command connects to localhost:9123/api, executes the search command, and then exits.

A more common use case would be to update a package from within a CI job — for example, in a Jenkins Stage, as shown in the following example:

stage ('Build') {
    steps {
        checkout([
            $class: 'GitSCM',
            branches: [
                [name: "*/master"]
            ],
            userRemoteConfigs: [
                [url: "https://github.com/markpollack/skipper-samples.git"]
            ]
        ])
        sh '''
            VERSION="1.0.0.M1-$(date +%Y%m%d_%H%M%S)-VERSION"
            mvn org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion="${VERSION}"
            mvn install
            java -jar /home/mpollack/software/skipper.jar upgrade --package-name helloworld --release-name helloworld-jenkins --properties version=${VERSION}
        '''
    }
}