无法从xl-deploy CLI创建任务

时间:2019-05-08 07:03:57

标签: xl-deploy deployit

我想尝试使用cli部署dar文件。我已经在我们的一台构建机器上设置了cli。

我也仔细阅读了文档(https://docs.xebialabs.com/xl-deploy/4.5.x/climanual.html)。但是当我运行下面的代码时。在创建任务的步骤上出现错误。

# 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) 

错误:

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
-------------------------------

能否请您指导我如何解决此问题。

1 个答案:

答案 0 :(得分:0)

这里是一个示例,您可以在其中启动部署任务,检查每个步骤的状态并打印失败日志,

# 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)

此外,您还可以在XLDeploy服务器的“ XLD_INSTALL_HOME / log / deployit.log ”下查看XLDeploy日志文件,以获取更多详细信息,以防发生错误。