* deployit: The main gateway to interfacing with XL Deploy. When you start the CLI you can get a list of these objects by running the help() command as follows:Īdmin > help() XL Deploy Objects available on the CLI: When we start the CLI there are several objects that are loaded to allow the CLI to interact with the XL Deploy server. This is the use case that I was initially interested in. That is the first way you can extend the XL Deploy CLI.Īnother interesting way of extending the CLI is to put scripts in the ext folder. We can see how that might work as follows:Īdmin > import Pizza admin > p = Pizza.Pizza( 12, ) admin > print p.getSize() 12 admin > p.listToppings() peperoni mushrooms sausage cheese green peper onion admin > Now when we run the CLI, this module will be available to us. We will save this module file in /opt/xebialabs/xl-deploy-5.0.1-cli/lib/Lib/Pizza.py. Since I like pizza I’m going to make a little Pizza class and put it in a Pizza (Pizza.py) module as follows:ĭef _init_(self, size, toppings = ): self.size = size self.toppings = toppingsĭef setSize( self, size ): self.size = sizeĭef addToppings( self, topping ): ( topping )ĭef getToppings( self ): return self.toppingsĭef listToppings( self ): for topping in self.toppings: print topping # End foreach To check this out let’s make a custom module. This is the list of places the CLI is looking for modules. To figure out where you can put your custom modules in the CLI, start the CLI and do the following:Īdmin > import sys admin > sys.path PyList: admin > You can use this fact to create modules that can be reused to make your scripts more powerful. The CLI tool is an implementation of Jython with extensions for XL Deploy. You will likely want to start breaking these CLI scripts up into smaller parts or modules. If you start writing CLI scripts that get complicated, they well become longer. Just like the XL Deploy server, the XL Deploy CLI has a few ways it can be extended. That seemed inconvenient, so in this blog I’m going to show you how to extend the XL Deploy CLI with a new object that will provide all of the ServerService methods from the REST API in the CLI. One of our customers noticed that we did not have a CLI way to put the XL Deploy server in maintenance mode. This allows you to prevent users from making changes to the repository while the administrators are trying to work with the repository or to cleanly restart the server. The selected file does not have the expected format for an importable packageĪll proper parameters have been set in pom and deploy-itpom respectively.In the newer versions of XL Deploy (5.x) there is a new feature that allows you to put the XL Deploy server in maintenance mode. Failed to execute goal :maven-deployit-plugin:3.8.3:import (default-cli)Ĭom.ployit:maven-deployit-plugin:3.8.3:import failed:Ĭom.ImporterException: The following exception is occuring upon importing the project using Jenkins However it is recommended that you set the DEPLOYIT_CLI_HOME environment variable to the root directory where the CLI is installed as per this link set environment variables.ĬLI start script actually changes directory to DEPLOYIT_CLI_HOME before building the classpath and starting the CLI java process, irrespective of where you start the cli.cmd from.Ĭom.ImporterException occuring while importing project using Jenkins So in your example it will not search in ext directory for your script abc.py you will need to pass full path to it or if script is placed in your ext directory you will not have to pass it as parameter to cli.cmd. This feature can be combined with arguments given on the command line when starting up the CLI Extensions are Python scripts, for example with Python class definitions, that will be available in commands or scripts run from the CLI. You can extend the XL Deploy CLI by installing extensions that are loaded during CLI startup. this usually happens when you want to extend CLI, for more details check below as per this link extending the cli When running scripts through XLDeploy CLI you have 2 options,ġ- Passing full absolute path for the script to CLI as parameter.ĭirectory in which all content of ext directory is read upon CLI boot so that you can use any functions defined there.
0 Comments
Leave a Reply. |