简体   繁体   中英

isUnix for jenkins job dsl?

I use the isUnix function in my pipeline jobs, it would be nice if the jobs dsl also had this feature (I still need to use it for some things pipelines cant do). If not how do you check for windows or linux inside of a jenkins job dsl script?

Job DSL script:

import org.apache.commons.lang.SystemUtils

if (SystemUtils.IS_OS_UNIX || SystemUtils.IS_OS_MAC) {
  println 'linux'
  job('jobname') {
    //job steps
  }
}
else {
  println 'windows'
}

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