0

I'm attempting to run jenkins on an AWS EC2 instance. I have updated the EC2 instance to the correct timezone and I've updated the JAVA_ARGS in /etc/default/jenkins to have the same timezone as my EC2 instance. I'm not even sure if timezone is the problem. But in my Poll SCM section when I update the settings it shows the next time the job will run is the following day. Here is a screenshot take at 7/25/2020 9:35 my local time. As you can see it shows that it won't run until 7/26/2020 at 1:34.

enter image description here

I also just now noticed that while it's building (triggered manually) it shows the date as tomorrow

enter image description here

But once it's done building and I refresh the jenkins page it shows the right date

enter image description here

EDIT Following are screenshots of my user's timezone in the jenkins GUI and the timezone shown in the systemInfo page of the jenkins server

enter image description here enter image description here

kamcknig
  • 883
  • 3
  • 9
  • 27
  • Is the job running on the `master` ? Can you run a `date` command on the master and confirm if it is in UTC? – mdabdullah Jul 26 '20 at 04:45
  • It is running on master indeed and date command returns my current local time. `Sun Jul 26 09:19:32 EDT 2020`. This is the correct date at the time of running the command (in my local time) – kamcknig Jul 26 '20 at 13:20
  • Weird! So your `local` is in EDT and `master` is in EDT but the `Poll SCM` plugin shows a time in UTC. Can you run the `date` command on the GitLab `server` (or whatever `git` you are polling) and share the time. – mdabdullah Jul 26 '20 at 14:11
  • So I actually "fixed" it by removing the symlink I had at `/etc/localtime` on the EC2 instance. This put the EC2 instance back on UTC time and now jenkins runs the jobs correctly. But of course all dates are then displayed in UTC which I prefer not to have. The repo is hosted at GitHub so I'm not hosting that – kamcknig Jul 26 '20 at 14:14
  • Oh thats simple: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html – mdabdullah Jul 26 '20 at 14:18
  • So that's what I did originally, which is why I had /etc/localtime symlinked – kamcknig Jul 26 '20 at 14:18
  • Removing that and putting it back into UTC is what "fixed" it – kamcknig Jul 26 '20 at 14:19
  • Then you should not do it at `EC2 instance` level, do it at `Jenkins` level. https://stackoverflow.com/questions/42202070/how-to-change-the-time-zone-in-jenkins – mdabdullah Jul 26 '20 at 14:20
  • I had also added this `JENKINS_ARGS="-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Detroit --webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT"` to /etc/default/jenkins but that didn't work either. That's actually still in my /etc/default/jenkins file. (And I had restarted jenkins yeah) – kamcknig Jul 26 '20 at 14:24
  • Hmm, is that same as this UI option https://www.jenkins.io/doc/book/using/change-time-zone/ – mdabdullah Jul 26 '20 at 14:26
  • I don't think so. If I update my jenkins user's configuration and update the timezone there in the GUI, then the time displayed to me in jenkins is in that timezone (aside from when the job is running like mentioned in the OP), but it's still on the incorrect Etc/UTC timezone when viewing https:///systemInfo – kamcknig Jul 26 '20 at 14:29
  • I've added images of the jenkins GUI timezone and systemInfo and it also shows the startup command args that show that it should be started in the America/Detroit timezone – kamcknig Jul 26 '20 at 14:32
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/218621/discussion-between-mdabdullah-and-kamcknig). – mdabdullah Jul 26 '20 at 14:53
  • It was identified during chat conversation that the though the `jenkins user config` was pointing to EDT , the EC2 instance was pointing to UTC and the `Git Plugin` was referring to the timezone of the EC2 instance. The timezone printed in `Poll SCM` as well as `Git Polling Log` were in UTC. @kamcknig has agreed to open a ticket with the plugin provider as that appears to be the root cause. – mdabdullah Jul 26 '20 at 15:18

0 Answers0