0

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

  • Welcome to stack_overflow. Add the error and what u have tried in question section... You can edit/update the question and help others to understand your requirement. – Bhanuchander Udhayakumar Aug 02 '18 at 12:06

1 Answers1

0

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

}
yong
  • 13,357
  • 1
  • 16
  • 27