简体   繁体   中英

Not able to create task from xl-deploy cli

I want to trying to deploy the dar file using cli. I had set up the cli on one of our build machine.

I have gone through the document as well( https://docs.xebialabs.com/xl-deploy/4.5.x/climanual.html ). But when I am running the below code. I am getting an error on the step where task is getting created.

# Import package 
deployit> package = deployit.importPackage('demo-application/1.0') 
# Load environment 
deployit> environment = repository.read('Environments/DiscoveredEnv') 
# Start deployment 
deployit> deploymentRef = deployment.prepareInitial(package.id, environment.id) 
deployit> deploymentRef = deployment.generateAllDeployeds(deploymentRef) 
deployit> taskID = deployment.deploy(deploymentRef).id 
deployit> deployit.startTaskAndWait(taskID) 

Error:

javax.ws.rs.ProcessingException: com.thoughtworks.xstream.converters.ConversionException:
---- Debugging information ----
cause-exception     : java.lang.NullPointerException
cause-message       : Name is null
class               : com.xebialabs.deployit.engine.api.execution.SerializableTask
required-type       : com.xebialabs.deployit.engine.api.execution.SerializableTask
converter-type      : com.xebialabs.deployit.booter.remote.xml.TaskConverterSelector
path                : /task
line number         : 1
version             : not available
-------------------------------

How can I fix this issue?

Here is an Example in which you can start deployment task, check each step status and print logs for Failed ones,

# Load package
package = repository.read('Applications/TestApps/1.0')

# Load environment
environment = repository.read('Environments/TestingEnv')

# Start deployment
deploymentRef = deployment.prepareInitial(package.id, environment.id)
depl = deployment.prepareAutoDeployeds(deploymentRef)
task = deployment.createDeployTask(depl)
deployit.startTaskAndWait(task.id)

# Check on deployment errors

steplist = tasks.steps(task.id)
for s in steplist.steps:
    print(' Step: ' + s.description)
    print(' Status: ' + str(s.state))
    if str(s.state) == 'FAILED':
        print('ERROR ' + s.log)

Also you can have a look on XLDeploy log file located at XLDeploy server under " XLD_INSTALL_HOME/log/deployit.log " to get more details in case of errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM