jenkinsci / plasticscm-plugin

A plugin for Jenkins to be able to use Plastic SCM
MIT License
16 stars 31 forks source link

Fix for polling not working properly when jenkins and plastic servers are in different time zones #70

Closed amgtf closed 6 months ago

amgtf commented 1 year ago

Time zone information is not added to the timestamp when running the cm find changesets command making the plastic server think it is local to it. If the Jenkins and plastic servers are set to different time zones build triggers might be delayed or missed. This PR addresses this by adding time zone info to the timestamp.

Testing done

This was tested by running a Jenkins server set to UTC and a plastic server set to UTC+2. A Jenkins job was created with a plastic checkout step and pollSCM trigger. A check-in was then done on the plastic server.

Before the fix it would take two hours before the change was picked up by the Jenkins server. After the fix it picked it up the next polling event.

Snippet from the Jenkins polling log:

[REDACTED] $ cm find changeset where date between '2023-08-14T14:25:01+0000' and '2023-08-15T08:19:10+0000' and branch='REDACTED' on repositories 'REDACTED' --xml --file=C:\REDACTED\output_10770472108764842262.xml --dateformat=yyyy'-'MM'-'dd'T'HH':'mm':'sszzz --server=REDACTED
Done. Took 1 sec
Changes found

No automated test was added since I'm unsure of how this could be achieved without an actual plastic server.

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue
mig42 commented 7 months ago

Resolves #72