简体   繁体   中英

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 .

I have tried the XML to DSL converter plugin but it is also excluding this section.

Can someone help in this?

Build Step

You can use the Jenkins job DSL method: publishOverSsh to archive your goal.

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

}

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