Timezone in triggers at pipeline using Jenkins

Viewed 2792

I want to set timezone with trigger using pipeline.

I can set manually Build Triggers in Job config.

check Build periodically

Schedule :

0 0 * * *
TZ=Asia/Seoul

This works!

But in pipeline, below syntax works

pipeline {
  triggers {
    cron ('0 0 * * *')
  }
}

but here does not work.

cron('0 0 * * *; TZ=Asia/Seoul')

cron('''
  0 0 * * *
  TZ=Asia/Seoul
''')
cron('0 0 * * *')
cron('TZ=Asia/Seoul')

How can I set TZ with cron ?

1 Answers

I found it,

cron('TZ=Asia/Seoul\n0 0 * * *') works!

Related