简体   繁体   English

Jenkins配置到DSL代码转换

[英]Jenkins configuration to DSL code conversion

I am trying to write the corresponding dsl code for a jenkins job and i am stuck at Build step and don't know how to code Send Files or Execute commands over SSH . 我正在尝试为jenkins作业编写相应的dsl代码,而我却停留在Build步骤,并且不知道如何通过SSH编写发送文件或执行命令

I have tried the XML to DSL converter plugin but it is also excluding this section. 我已经尝试过XML到DSL转换器插件,但是它也排除了本节。

Can someone help in this? 有人可以帮忙吗?

Build Step 建立步骤

You can use the Jenkins job DSL method: publishOverSsh to archive your goal. 您可以使用Jenkins作业DSL方法: publishOverSsh存档目标。

job('test') {

    def cmd = 'mkdir -p $MICROSERVICE_NAME\n' +
              'mv docker-compse.deploy.yml ${MICROSERVICE_NAME}\n' +
              'cd ${MICROSERVICE_NAME}\n'

    steps {
        publishOverSsh {
            server('MiSe_New_External') {
                transferSet {
                    sourceFiles('docker-compse.deploy.yml')
                    execCommand(cmd)
                }
            }
        }
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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