Skip to content

[JENKINS-52009] Added support for timezone in cron and percent sign in parameter key/value #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 1, 2021

Conversation

shbhardwaj
Copy link

Current behavior : No way to set timezone for all the parameterized cron expressions.
After this change : Timezone in first line will be applied to all the cron expressions see below for example.
TZ=Australia/Sydney
H/15 * * * * %name=value
H(0-29)/10 * * * * % name=value; othername=othervalue

The timezone Australia/Sydney will be applied for both the crons.

Current behavior : If percent sign is part of some parameter key or value then all the parameters of the job are ignored.
After this change : Only the first % sign will be used to separate the cron expression from the parameters. Any other percent sign in key/value will be part of the key/value see below for example

H/15 * * * * %name=value;key=10%;
The parameters will be name=value, key=10%

@shbhardwaj
Copy link
Author

The hpi file generated for this PR can be found at
https://ci.jenkins.io/job/Plugins/job/parameterized-scheduler-plugin/job/PR-47/1/artifact/target/parameterized-scheduler.hpi

Use hpi file to upload the plugin with above mentioned features.

}

@Test
public void with_no_params_seperator() throws Exception {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling should be separator not seperator

great PR otherwise - I came here looking for a way to use timezone :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shbhardwaj
Did you have chance to look at above comment?
Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling fixed

@bawjensen
Copy link

Question for the maintainers: Would it be quicker to get this timezone functionality merged if there were a separate PR with just that functionality? I can create that PR, if so, given that's what my team has the most use for (granted I would be shamelessly copying @shbhardwaj's code to do so)

@jef
Copy link

jef commented Mar 23, 2020

Question for the maintainers: Would it be quicker to get this timezone functionality merged if there were a separate PR with just that functionality? I can create that PR, if so, given that's what my team has the most use for (granted I would be shamelessly copying @shbhardwaj's code to do so)

This should happen or merge this! Long over due.

@chdwlch
Copy link

chdwlch commented Apr 10, 2020

Would be great to have this merged in!

@balaarunreddyv1
Copy link

please merge it.

@davidmoralc
Copy link

davidmoralc commented Apr 15, 2020

Hi @batmat it would be great to review and merge the changes. Do you think a different pull request only for timezone should be needed as @bawjensen suggested to have the release faster? cc: @shbhardwaj
Relates to: https://issues.jenkins-ci.org/browse/JENKINS-55516

@sichao-uber
Copy link

Can anyone merge this?

@nvwls
Copy link

nvwls commented Jul 25, 2020

@batmat Please advise if there is anything that needs to be done to get this merged.

This is really important for orgs that have a centralized jenkins installation and teams spread across the world. Developers want their jobs to run in their local time and this helps deal with Daylight Savings. Not all time zones switch at the same time and scheduled jobs that are expected to run at a given time are now running an hour earlier or later depending on the time of the year.

@genehynson
Copy link

let's get this merged!

@artem-kosenko
Copy link

merge this feature please. ppl need it

@hestrompa
Copy link

Can anyone merge this please?? This would be a great fix!

@res0nance res0nance changed the title Added support for timezone in cron and percent sign in parameter key/value [JENKINS-52009] Added support for timezone in cron and percent sign in parameter key/value Dec 22, 2020
@chunming08
Copy link

@shbhardwaj Can you please kindly resolve the conflict and update your PR? Then @res0nance, if you would be able to merge this into the master at an early convenience, it would be great!
I am looking forward to having the change in 0.9.3 before my team's Jenkins instance upgrade. Much appreciated!

@shbhardwaj
Copy link
Author

@andymcf @mpasat Spelling fixed
@chunming08 Updated the PR and resolved the conflicts
I hope this can be merged soon its more than a year that this PR is open.

Copy link

@res0nance res0nance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shbhardwaj sorry about that, I recently took over as maintainer roughly 2 weeks ago

@res0nance res0nance merged commit 8a19bd3 into jenkinsci:master Jan 1, 2021
@mikeprigodich
Copy link

What is the ETA for making this fix available in a new release? We would like to make use of it.

@res0nance
Copy link

What is the ETA for making this fix available in a new release? We would like to make use of it.

Waiting for a reply on #44 followed by some testing, then a release. Can't give an exact ETA, but maybe a week or two after that PR is merged.

@waded
Copy link

waded commented Jun 25, 2024

It would be nice if README had an example usage that included timezone, e.g.

    parameterizedCron('''
        TZ=America/Denver
        */2 * * * * %GREETING=Hola;PLANET=Pluto
        */3 * * * * %PLANET=Mars
    ''')

(FYI, currently the TZ expression can only be on the first line, applies to all lines if present.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.