如何在声明式管道中使用Deploy to container Plugin

时间:2019-12-12 20:34:29

标签: tomcat jenkins jenkins-pipeline jenkins-plugins jenkins-groovy

有人可以帮助我了解如何在声明性管道中使用“部署到容器插件”插件吗?

然后尝试这种方式,什么也没做……我不明白如何在行中使用对参数进行排序。

deploy container: tomcat8, url:"http://xxx.xxx.xxx.xxx:8082/", credentialsId: "test", war: 'target/app.war', contextPath: '/app1'

编辑:

这是文档: https://jenkins.io/doc/pipeline/steps/deploy/#deploy-deploy-warear-to-a-container

edit2:我尝试_

deploy adapters: tomcat8(url:"http://x.x.x.x:8080/", credentialsId: "asdasd"), war: 'target/app.war', contextPath: '/app' 

我有:

java.lang.UnsupportedOperationException: Undefined symbol ‘tomcat8’
    at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:448)
    at org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable.instantiate(UninstantiatedDescribable.java:165)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:372)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:318)
    at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:259)
Caused: java.lang.IllegalArgumentException: Could not instantiate {adapters=@tomcat8(...

1 个答案:

答案 0 :(得分:0)

adapters参数的类型为list。您可以检查类型签名Deploy to container。以下是正确的语法:

    deploy adapters: [tomcat8(url: 'http://localhost:8666/', 
                              credentialsId: 'tomcat')], 
                     war: 'target/*.war',
                     contextPath: 'app'