Skip to content

Commit

Permalink
GEODE-8458: Use build metadata properties as task inputs (apache#5480)
Browse files Browse the repository at this point in the history
GEODE-8458: Use build metadata properties as task inputs

* Rebuilds GemFireVersion.properties on Git repo or property changes
  * version
  * HEAD sha
  * build user
  * java version
  * productName
  * etc
* Drops the 'Build-Date' field from GemFireVersion.properties
  * This changes output of `gfsh version --full`
  * Source commit-date is still available, as is source-SHA
* Removes `Build-Date` from tests and pulse
  • Loading branch information
robbadler authored Aug 28, 2020
1 parent 93efb80 commit d9d1310
Show file tree
Hide file tree
Showing 22 changed files with 16 additions and 74 deletions.
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ tasks.register('writeBuildInfo') {
def scmInfo = this.readScmInfo("geode-core")

inputs.property("Source-Revision", scmInfo.getProperty("Source-Revision"))
outputs.file buildInfo
outputs.files {
buildInfo
}
doLast {
buildInfo.getParentFile().mkdirs()
new FileOutputStream(buildInfo).withStream { fos ->
Expand Down
20 changes: 10 additions & 10 deletions geode-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ task createVersionPropertiesFile(dependsOn: ':writeBuildInfo') {
propertiesFile
}

def props = [
"Product-Name" : productName,
"Product-Version" : version,
"Build-Id" : "${System.env.USER} ${buildId}".toString(),
"Build-Platform" : "${System.properties['os.name']} ${System.properties['os.version']} ${System.properties['os.arch']}".toString(),
"Build-Java-Vendor" : System.properties['java.vendor'],
"Build-Java-Version": System.properties['java.version']
] as Properties

inputs.properties(props)

doLast {
def scmInfo = new Properties()
new FileInputStream(scmInfoFile.singleFile).withStream { fis ->
scmInfo.load(fis)
}

def props = [
"Product-Name" : productName,
"Product-Version" : version,
"Build-Id" : "${System.env.USER} ${buildId}".toString(),
"Build-Date" : new Date().format('yyyy-MM-dd HH:mm:ss Z'),
"Build-Platform" : "${System.properties['os.name']} ${System.properties['os.version']} ${System.properties['os.arch']}".toString(),
"Build-Java-Vendor" : System.properties['java.vendor'],
"Build-Java-Version": System.properties['java.version']
] as Properties
props.putAll(scmInfo)

propertiesFile.getParentFile().mkdirs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
package org.apache.geode.internal;

import static org.apache.geode.internal.VersionDescription.BUILD_DATE;
import static org.apache.geode.internal.VersionDescription.BUILD_ID;
import static org.apache.geode.internal.VersionDescription.BUILD_JAVA_VERSION;
import static org.apache.geode.internal.VersionDescription.BUILD_PLATFORM;
Expand Down Expand Up @@ -80,10 +79,6 @@ public static String getBuildId() {
return getDescription().getProperty(BUILD_ID);
}

public static String getBuildDate() {
return getDescription().getProperty(BUILD_DATE);
}

public static String getBuildPlatform() {
return getDescription().getProperty(BUILD_PLATFORM);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public class VersionDescription {
*/
public static final String SOURCE_REPOSITORY = "Source-Repository";

/**
* Constant for the build date Resource Property entry
*/
public static final String BUILD_DATE = "Build-Date";

/**
* Constant for the build id Resource Property entry
*/
Expand Down Expand Up @@ -175,12 +170,6 @@ private Optional<String> validate(Properties props) {
SOURCE_REPOSITORY, RESOURCE_NAME));
}

if (props.get(BUILD_DATE) == null) {
return Optional
.of(String.format("<Missing property %s from resource org/apache/geode/internal/%s>",
BUILD_DATE, RESOURCE_NAME));
}

if (props.get(BUILD_ID) == null) {
return Optional
.of(String.format("<Missing property %s from resource org/apache/geode/internal/%s>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ private void printASFLicense(PrintWriter out) {
public enum BannerHeader {

LICENSE_START("Licensed to the Apache Software Foundation (ASF) under one or more"),
BUILD_DATE(VersionDescription.BUILD_DATE),
BUILD_ID(VersionDescription.BUILD_ID),
BUILD_JAVA_VERSION(VersionDescription.BUILD_JAVA_VERSION),
BUILD_PLATFORM(VersionDescription.BUILD_PLATFORM),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public void testPrintInfo() {
assertTrue(versionOutput.contains(VersionDescription.SOURCE_DATE));
assertTrue(versionOutput.contains(VersionDescription.SOURCE_REVISION));
assertTrue(versionOutput.contains(VersionDescription.SOURCE_REPOSITORY));
assertTrue(versionOutput.contains(VersionDescription.BUILD_DATE));
assertTrue(versionOutput.contains(VersionDescription.BUILD_ID));
assertTrue(versionOutput.contains(VersionDescription.BUILD_PLATFORM));
assertTrue(versionOutput.contains(VersionDescription.BUILD_JAVA_VERSION));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
package org.apache.geode.management.internal.cli.commands;

import static org.apache.geode.internal.VersionDescription.BUILD_DATE;
import static org.apache.geode.internal.VersionDescription.BUILD_ID;
import static org.apache.geode.internal.VersionDescription.BUILD_JAVA_VERSION;
import static org.apache.geode.internal.VersionDescription.BUILD_PLATFORM;
Expand Down Expand Up @@ -42,7 +41,7 @@
@RunWith(JUnitParamsRunner.class)
public class VersionCommandJUnitTest {
private static final String[] EXPECTED_FULL_DATA =
{BUILD_DATE, BUILD_ID, BUILD_JAVA_VERSION, BUILD_PLATFORM, PRODUCT_NAME, PRODUCT_VERSION,
{BUILD_ID, BUILD_JAVA_VERSION, BUILD_PLATFORM, PRODUCT_NAME, PRODUCT_VERSION,
SOURCE_DATE, SOURCE_REPOSITORY, SOURCE_REVISION, "Running on"};

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ public void pulseUpdateForPulseVersion() throws Exception {
.andExpect(jsonPath("$.PulseVersion.sourceRepository").value("not empty"))
.andExpect(jsonPath("$.PulseVersion.pulseVersion").value("not empty"))
.andExpect(jsonPath("$.PulseVersion.sourceRevision").value("not empty"))
.andExpect(jsonPath("$.PulseVersion.buildId").value("not empty"))
.andExpect(jsonPath("$.PulseVersion.buildDate").value("not empty"));
.andExpect(jsonPath("$.PulseVersion.buildId").value("not empty"));
}

@Test
Expand Down Expand Up @@ -680,7 +679,6 @@ public void pulseVersion() throws Exception {
.andExpect(status().isOk())
.andExpect(jsonPath("$.pulseVersion").isNotEmpty())
.andExpect(jsonPath("$.buildId").isNotEmpty())
.andExpect(jsonPath("$.buildDate").isNotEmpty())
.andExpect(jsonPath("$.sourceDate").isNotEmpty())
.andExpect(jsonPath("$.sourceRevision").isNotEmpty())
.andExpect(jsonPath("$.sourceRepository").isNotEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public String defaultLogoutTargetURL() {
public PropertiesFileLoader propertiesLoader() {
PropertiesFileLoader propertiesFileLoader = mock(PropertiesFileLoader.class);
Properties properties = new Properties();
properties.setProperty(PulseConstants.PROPERTY_BUILD_DATE, "not empty");
properties.setProperty(PulseConstants.PROPERTY_BUILD_ID, "not empty");
properties.setProperty(PulseConstants.PROPERTY_PULSE_VERSION, "not empty");
properties.setProperty(PulseConstants.PROPERTY_SOURCE_DATE, "not empty");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ private void loadPulseVersionDetails() {
.setPulseVersion(properties.getProperty(PulseConstants.PROPERTY_PULSE_VERSION, ""));
pulseController.getPulseVersion()
.setPulseBuildId(properties.getProperty(PulseConstants.PROPERTY_BUILD_ID, ""));
pulseController.getPulseVersion()
.setPulseBuildDate(properties.getProperty(PulseConstants.PROPERTY_BUILD_DATE, ""));
pulseController.getPulseVersion()
.setPulseSourceDate(properties.getProperty(PulseConstants.PROPERTY_SOURCE_DATE, ""));
pulseController.getPulseVersion().setPulseSourceRevision(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public void pulseVersion(@SuppressWarnings("unused") HttpServletRequest request,
// Response
responseJSON.put("pulseVersion", pulseVersion.getPulseVersion());
responseJSON.put("buildId", pulseVersion.getPulseBuildId());
responseJSON.put("buildDate", pulseVersion.getPulseBuildDate());
responseJSON.put("sourceDate", pulseVersion.getPulseSourceDate());
responseJSON.put("sourceRevision", pulseVersion.getPulseSourceRevision());
responseJSON.put("sourceRepository", pulseVersion.getPulseSourceRepository());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class PulseConstants {
public static final String PULSE_VERSION_PROPERTIES_FILE = "GemFireVersion.properties";
public static final String PROPERTY_PULSE_VERSION = "Product-Version";
public static final String PROPERTY_BUILD_ID = "Build-Id";
public static final String PROPERTY_BUILD_DATE = "Build-Date";
public static final String PROPERTY_SOURCE_DATE = "Source-Date";
public static final String PROPERTY_SOURCE_REVISION = "Source-Revision";
public static final String PROPERTY_SOURCE_REPOSITORY = "Source-Repository";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ public void setPulseBuildId(String pulseBuildId) {
this.pulseBuildId = pulseBuildId;
}

private String pulseBuildDate;

public String getPulseBuildDate() {
return pulseBuildDate;
}

public void setPulseBuildDate(String pulseBuildDate) {
this.pulseBuildDate = pulseBuildDate;
}

private String pulseSourceDate;

public String getPulseSourceDate() {
Expand Down Expand Up @@ -102,7 +92,7 @@ public void setPulseSourceRepository(String pulseSourceRepository) {
public String getPulseVersionLogMessage() {
ResourceBundle resourceBundle = repository.getResourceBundle();
return resourceBundle.getString("LOG_MSG_PULSE_VERSION") + " "
+ this.getPulseVersion() + " " + this.getPulseBuildId() + " " + this.getPulseBuildDate();
+ this.getPulseVersion() + " " + this.getPulseBuildId();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public ObjectNode execute(final HttpServletRequest request) throws Exception {
// Response
responseJSON.put("pulseVersion", pulseController.getPulseVersion().getPulseVersion());
responseJSON.put("buildId", pulseController.getPulseVersion().getPulseBuildId());
responseJSON.put("buildDate", pulseController.getPulseVersion().getPulseBuildDate());
responseJSON.put("sourceDate", pulseController.getPulseVersion().getPulseSourceDate());
responseJSON.put("sourceRevision", pulseController.getPulseVersion().getPulseSourceRevision());
responseJSON.put("sourceRepository",
Expand Down
4 changes: 0 additions & 4 deletions geode-pulse/src/main/webapp/accessDenied.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@
<label class="width-40 display-inline-block" >Build Id:</label>
<label class="width-58 display-inline-block" id="buildId"></label>
</li>
<li class="left widthfull-100per" >
<label class="width-40 display-inline-block" >Build Date:</label>
<label class="width-58 display-inline-block" id="buildDate"></label>
</li>
<li class="left widthfull-100per" >
<label class="width-40 display-inline-block" >Source Date:</label>
<label class="width-58 display-inline-block" id="sourceDate"></label>
Expand Down
3 changes: 0 additions & 3 deletions geode-pulse/src/main/webapp/clusterDetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,6 @@
<label class="width-40 display-inline-block" >Build Id:</label>
<label class="width-58 display-inline-block" id="buildId"></label>
</li>
<li class="left widthfull-100per" >
<label class="width-40 display-inline-block" >Build Date:</label>
<label class="width-58 display-inline-block" id="buildDate"></label>
</li>
<li class="left widthfull-100per" >
<label class="width-40 display-inline-block" >Source Date:</label>
Expand Down
3 changes: 0 additions & 3 deletions geode-pulse/src/main/webapp/dataBrowser.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Build Id:</label> <label
class="width-58 display-inline-block" id="buildId"></label></li>
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Build Date:</label> <label
class="width-58 display-inline-block" id="buildDate"></label></li>
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Source Date:</label> <label
class="width-58 display-inline-block" id="sourceDate"></label></li>
Expand Down
4 changes: 0 additions & 4 deletions geode-pulse/src/main/webapp/memberDetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,6 @@
<label class="width-40 display-inline-block">Build Id:</label>
<label class="width-58 display-inline-block" id="buildId"></label>
</li>
<li class="left widthfull-100per">
<label class="width-40 display-inline-block">Build Date:</label>
<label class="width-58 display-inline-block" id="buildDate"></label>
</li>
<li class="left widthfull-100per">
<label class="width-40 display-inline-block">Source Date:</label>
<label class="width-58 display-inline-block" id="sourceDate"></label>
Expand Down
3 changes: 0 additions & 3 deletions geode-pulse/src/main/webapp/queryStatistics.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Build Id:</label> <label
class="width-58 display-inline-block" id="buildId"></label></li>
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Build Date:</label> <label
class="width-58 display-inline-block" id="buildDate"></label></li>
<li class="left widthfull-100per"><label
class="width-40 display-inline-block">Source Date:</label> <label
class="width-58 display-inline-block" id="sourceDate"></label></li>
Expand Down
4 changes: 0 additions & 4 deletions geode-pulse/src/main/webapp/regionDetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,6 @@ <h3><span id="idMemberName">M1</span></h3>
<label class="width-40 display-inline-block">Build Id:</label>
<label class="width-58 display-inline-block" id="buildId"></label>
</li>
<li class="left widthfull-100per">
<label class="width-40 display-inline-block">Build Date:</label>
<label class="width-58 display-inline-block" id="buildDate"></label>
</li>
<li class="left widthfull-100per">
<label class="width-40 display-inline-block">Source Date:</label>
<label class="width-58 display-inline-block" id="sourceDate"></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var getPulseVersionBack = function(data) {
$('#pulseVersion').html(data.pulseVersion);
$('#pulseVer').html(data.pulseVersion);
$('#buildId').html(data.buildId);
$('#buildDate').html(data.buildDate);
$('#sourceDate').html(data.sourceDate);
$('#sourceRevision').html(data.sourceRevision);
$('#sourceRepository').html(data.sourceRepository);
Expand Down
1 change: 0 additions & 1 deletion geode-pulse/src/main/webapp/scripts/pulsescript/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,6 @@ function getPulseVersion() {
$('#pulseVersion').html(pulseVersion);
$('#pulseVer').html(data.pulseVersion);
$('#buildId').html(data.buildId);
$('#buildDate').html(data.buildDate);
$('#sourceDate').html(data.sourceDate);
$('#sourceRevision').html(data.sourceRevision);
$('#sourceRepository').html(data.sourceRepository);
Expand Down

0 comments on commit d9d1310

Please sign in to comment.