Skip to content

Commit

Permalink
Merge pull request #49 from MarkEWaite/fix-JCasC-defaultTime
Browse files Browse the repository at this point in the history
[JENKINS-66939] - Allow JCasC schedule time setting
  • Loading branch information
darinpope authored Oct 26, 2021
2 parents 8e6a928 + 9a98ba1 commit 3f2558f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Add to your yaml file:
```yaml
unclassified:
scheduleBuild:
# defaultScheduleTime is not currently supported in JCasC
# See JENKINS-66939 for more details
# defaultScheduleTime: "11:00:00 PM"
defaultScheduleTime: "11:00:00 PM"
timeZone: "Europe/Paris"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jenkinsci.plugins.schedulebuild;

import io.jenkins.plugins.casc.misc.RoundTripAbstractTest;
import java.util.TimeZone;
import jenkins.model.GlobalConfiguration;
import org.jvnet.hudson.test.RestartableJenkinsRule;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

public class JCasCGlobalAllFields extends RoundTripAbstractTest {

@Override
protected void assertConfiguredAsExpected(RestartableJenkinsRule j, String configContent) {
ScheduleBuildGlobalConfiguration globalConfig = GlobalConfiguration.all().getInstance(ScheduleBuildGlobalConfiguration.class);
assertThat(globalConfig, is(not(nullValue())));
assertThat(globalConfig.getDefaultScheduleTime(), is("12:34:56 AM"));
assertThat(globalConfig.getTimeZone(), is("Europe/Rome"));
}

@Override
protected String stringInLogExpected() {
return "timeZone = Europe/Rome";
}

@Override
protected String configResource() {
return "scheduleBuild-all-fields.yaml";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
unclassified:
scheduleBuild:
defaultScheduleTime: "12:34:56 AM"
timeZone: "Europe/Rome"
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
unclassified:
scheduleBuild:
# defaultScheduleTime is not currently supported in JCasC
# See JENKINS-66939 for more details
# defaultScheduleTime: "11:00:00 PM"
timeZone: "Europe/Paris"

0 comments on commit 3f2558f

Please sign in to comment.