Skip to content
Snippets Groups Projects
Commit 3d5e1ad4 authored by srosse's avatar srosse
Browse files

no-jira: use revision number and change set as build identifier

parent a8ecb8b4
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ package org.olat.core.dispatcher.impl; ...@@ -22,6 +22,7 @@ package org.olat.core.dispatcher.impl;
import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.StringOutput;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
import org.olat.core.logging.LogDelegator; import org.olat.core.logging.LogDelegator;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
/** /**
...@@ -98,7 +99,11 @@ public class StaticMediaDispatcher extends LogDelegator { ...@@ -98,7 +99,11 @@ public class StaticMediaDispatcher extends LogDelegator {
// Add version to make URL change after new release and force browser to // Add version to make URL change after new release and force browser to
// load new static files // load new static files
if (addVersionID) { if (addVersionID) {
target.append(Settings.getBuildIdentifier()); if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) {
target.append(WebappHelper.getRevisionNumber()).append(":").append(WebappHelper.getChangeSet());
} else {
target.append(Settings.getBuildIdentifier());
}
} else { } else {
target.append(NOVERSION); target.append(NOVERSION);
} }
......
...@@ -758,7 +758,6 @@ public class RichTextConfiguration implements Disposable { ...@@ -758,7 +758,6 @@ public class RichTextConfiguration implements Disposable {
for (Map.Entry<String, String> entry : copyNonValues.entrySet()) { for (Map.Entry<String, String> entry : copyNonValues.entrySet()) {
tinyMenuSb.append(entry.getKey()).append(": ").append(entry.getValue()).append(",\n"); tinyMenuSb.append(entry.getKey()).append(": ").append(entry.getValue()).append(",\n");
} }
System.out.println(tinyMenuSb);
out.append(tinyMenuSb); out.append(tinyMenuSb);
} }
......
...@@ -137,7 +137,6 @@ public class Settings implements Initializable, Destroyable, GenericEventListene ...@@ -137,7 +137,6 @@ public class Settings implements Initializable, Destroyable, GenericEventListene
repoRevision = repoRev; repoRevision = repoRev;
} }
//fxdiff: get the mercurial changeset Information from the time this release had been built
public static String getRepoRevision(){ public static String getRepoRevision(){
return repoRevision; return repoRevision;
} }
......
...@@ -33,6 +33,7 @@ import org.olat.core.gui.media.ServletUtil; ...@@ -33,6 +33,7 @@ import org.olat.core.gui.media.ServletUtil;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
/** /**
...@@ -82,7 +83,12 @@ public class StaticServlet extends HttpServlet { ...@@ -82,7 +83,12 @@ public class StaticServlet extends HttpServlet {
staticRelPath = pathInfo.substring(NOVERSION.length() + 1, pathInfo.length()); staticRelPath = pathInfo.substring(NOVERSION.length() + 1, pathInfo.length());
} else { } else {
// version provided - remove it // version provided - remove it
String version = Settings.getBuildIdentifier(); String version;
if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) {
version = WebappHelper.getRevisionNumber() + ":" + WebappHelper.getChangeSet();
} else {
version = Settings.getBuildIdentifier();
}
int start = version.length() + 1; int start = version.length() + 1;
int end = pathInfo.length(); int end = pathInfo.length();
if(start <= end) { if(start <= end) {
......
...@@ -35,6 +35,7 @@ import javax.ws.rs.core.Response; ...@@ -35,6 +35,7 @@ import javax.ws.rs.core.Response;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
import org.olat.restapi.system.vo.EnvironmentInformationsVO; import org.olat.restapi.system.vo.EnvironmentInformationsVO;
import org.olat.restapi.system.vo.ReleaseInfosVO; import org.olat.restapi.system.vo.ReleaseInfosVO;
...@@ -104,7 +105,14 @@ public class SystemWebService { ...@@ -104,7 +105,14 @@ public class SystemWebService {
} }
ReleaseInfosVO version = new ReleaseInfosVO(); ReleaseInfosVO version = new ReleaseInfosVO();
version.setBuildVersion(Settings.getBuildIdentifier()); if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) {
String v = WebappHelper.getRevisionNumber() + ":" + WebappHelper.getChangeSet();
version.setBuildVersion(v);
version.setRepoRevision(v);
} else {
version.setBuildVersion(Settings.getBuildIdentifier());
version.setRepoRevision(Settings.getRepoRevision());
}
version.setOlatVersion(Settings.getVersion()); version.setOlatVersion(Settings.getVersion());
version.setInstanceID(WebappHelper.getInstanceId()); version.setInstanceID(WebappHelper.getInstanceId());
return Response.ok(version).build(); return Response.ok(version).build();
......
...@@ -132,10 +132,5 @@ public class Examples { ...@@ -132,10 +132,5 @@ public class Examples {
SAMPLE_RELEASEVO.setBuildVersion(""); SAMPLE_RELEASEVO.setBuildVersion("");
SAMPLE_RELEASEVO.setOlatVersion(""); SAMPLE_RELEASEVO.setOlatVersion("");
SAMPLE_RELEASEVO.setRepoRevision(""); SAMPLE_RELEASEVO.setRepoRevision("");
SAMPLE_RELEASEVO.setAllowAutoPatch(true);
SAMPLE_RELEASEVO.setAllowAutoUpdate(false);
SAMPLE_RELEASEVO.setPatchAvailable(true);
SAMPLE_RELEASEVO.setUpdateAvailable(false);
SAMPLE_RELEASEVO.setUpgradeAvailable(false);
} }
} }
...@@ -45,34 +45,10 @@ public class ReleaseInfosVO { ...@@ -45,34 +45,10 @@ public class ReleaseInfosVO {
private String repoRevision; private String repoRevision;
@XmlAttribute(name="instanceID",required=true) @XmlAttribute(name="instanceID",required=true)
private String instanceID; private String instanceID;
@XmlAttribute(name="allowAutoPatch", required=false)
private boolean allowAutoPatch;
@XmlAttribute(name="patchAvailable", required=false)
private boolean patchAvailable;
@XmlAttribute(name="allowAutoUpdate", required=false)
private boolean allowAutoUpdate;
@XmlAttribute(name="updateAvailable", required=false)
private boolean updateAvailable;
@XmlAttribute(name="upgradeAvailable", required=false)
private boolean upgradeAvailable;
public ReleaseInfosVO() { public ReleaseInfosVO() {
//make JAXB happy //make JAXB happy
} }
public ReleaseInfosVO(String buildVersion, String olatVersion, String repoRevision,String instanceID, boolean allowAutoPatch, boolean patchAvailable,
boolean allowAutoUpdate, boolean updateAvailable, boolean upgradeAvailable) {
this.buildVersion = buildVersion;
this.olatVersion = olatVersion;
this.repoRevision = repoRevision;
this.instanceID = instanceID;
this.allowAutoPatch = allowAutoPatch;
this.allowAutoUpdate = allowAutoUpdate;
this.patchAvailable = patchAvailable;
this.updateAvailable = updateAvailable;
this.upgradeAvailable = upgradeAvailable;
}
public String getBuildVersion() { public String getBuildVersion() {
return buildVersion; return buildVersion;
...@@ -105,44 +81,4 @@ public class ReleaseInfosVO { ...@@ -105,44 +81,4 @@ public class ReleaseInfosVO {
public void setRepoRevision(String repoRevision) { public void setRepoRevision(String repoRevision) {
this.repoRevision = repoRevision; this.repoRevision = repoRevision;
} }
public boolean isAllowAutoPatch() {
return allowAutoPatch;
}
public void setAllowAutoPatch(boolean allowAutoPatch) {
this.allowAutoPatch = allowAutoPatch;
}
public boolean isPatchAvailable() {
return patchAvailable;
}
public void setPatchAvailable(boolean patchAvailable) {
this.patchAvailable = patchAvailable;
}
public boolean isAllowAutoUpdate() {
return allowAutoUpdate;
}
public void setAllowAutoUpdate(boolean allowAutoUpdate) {
this.allowAutoUpdate = allowAutoUpdate;
}
public boolean isUpdateAvailable() {
return updateAvailable;
}
public void setUpdateAvailable(boolean updateAvailable) {
this.updateAvailable = updateAvailable;
}
public boolean isUpgradeAvailable() {
return upgradeAvailable;
}
public void setUpgradeAvailable(boolean upgradeAvailable) {
this.upgradeAvailable = upgradeAvailable;
}
} }
\ No newline at end of file
...@@ -316,7 +316,7 @@ public class SystemTest extends OlatJerseyTestCase { ...@@ -316,7 +316,7 @@ public class SystemTest extends OlatJerseyTestCase {
} }
@Test @Test
public void testUpdate() throws IOException, URISyntaxException { public void testReleaseInfos() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection(); RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat")); assertTrue(conn.login("administrator", "openolat"));
...@@ -324,8 +324,10 @@ public class SystemTest extends OlatJerseyTestCase { ...@@ -324,8 +324,10 @@ public class SystemTest extends OlatJerseyTestCase {
ReleaseInfosVO versionInfos = conn.get(systemUri, ReleaseInfosVO.class); ReleaseInfosVO versionInfos = conn.get(systemUri, ReleaseInfosVO.class);
assertNotNull(versionInfos); assertNotNull(versionInfos);
assertNotNull(versionInfos.getInstanceID());
assertNotNull(versionInfos.getBuildVersion()); assertNotNull(versionInfos.getBuildVersion());
assertNotNull(versionInfos.getOlatVersion()); assertNotNull(versionInfos.getOlatVersion());
assertNotNull(versionInfos.getRepoRevision());
conn.shutdown(); conn.shutdown();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment