From c0c76c2f899337bb912898f91af2246ed43bec39 Mon Sep 17 00:00:00 2001 From: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> Date: Sat, 20 Mar 2021 10:39:50 +0100 Subject: [PATCH] Allow overriding max age for recent releases (#497) Co-authored-by: Daniel Beck --- site/generate.sh | 3 +++ .../java/io/jenkins/update_center/json/RecentReleasesRoot.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/site/generate.sh b/site/generate.sh index 67e51507e..55158eaf0 100755 --- a/site/generate.sh +++ b/site/generate.sh @@ -67,6 +67,9 @@ unzip -q "$MAIN_DIR"/tmp/generator-$version.zip -d "$MAIN_DIR"/tmp/generator/ function execute { # To use a locally built snapshot, use the following line instead: # java -Dfile.encoding=UTF-8 -jar target/update-center2-*-bin/update-center2-*.jar "$@" + # Commonly provided system properties: + # -DRECENT_RELEASES_MAX_AGE_HOURS=30 in case the build failed for a while + # -DCERTIFICATE_MINIMUM_VALID_DAYS=14 in case the cert is about to expire java -DCERTIFICATE_MINIMUM_VALID_DAYS=14 -Dfile.encoding=UTF-8 -jar "$MAIN_DIR"/tmp/generator/update-center2-*.jar "$@" # TODO once we have a new cert, no longer override the duration } diff --git a/src/main/java/io/jenkins/update_center/json/RecentReleasesRoot.java b/src/main/java/io/jenkins/update_center/json/RecentReleasesRoot.java index cbb108430..d687a4673 100644 --- a/src/main/java/io/jenkins/update_center/json/RecentReleasesRoot.java +++ b/src/main/java/io/jenkins/update_center/json/RecentReleasesRoot.java @@ -4,6 +4,7 @@ import io.jenkins.update_center.HPI; import io.jenkins.update_center.MavenRepository; import io.jenkins.update_center.Plugin; +import io.jenkins.update_center.util.Environment; import java.io.IOException; import java.time.Duration; @@ -27,5 +28,5 @@ public RecentReleasesRoot(MavenRepository repository) throws IOException { } } - private static final Duration MAX_AGE = Duration.ofHours(3); + private static final Duration MAX_AGE = Duration.ofHours(Environment.getInteger("RECENT_RELEASES_MAX_AGE_HOURS", 3)); }