Skip to content

Commit

Permalink
Merge pull request #14 from takipi/OOE-50
Browse files Browse the repository at this point in the history
[OOE-50] Refactored the logging into the API
  • Loading branch information
Ben Morrise authored Jun 26, 2020
2 parents ceac148 + 6777d0f commit 2a85bfb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- api-client local dev build with https://github.com/takipi/api-client/pull/147 -->
<takipi.version>2.34.0</takipi.version>
<takipi.version>2.34.1</takipi.version>
</properties>

<dependencies>
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/com/overops/plugins/bamboo/TaskType.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,12 @@ public TaskResult execute(@NotNull TaskContext context) throws TaskException {
boolean isDebug = Boolean.parseBoolean(context.getConfigurationMap().get(Const.DEBUG));
String appUrl = (String)globalSettings.get(Const.GLOBAL_APP_URL);

Properties props = Utils.getOverOpsProperties();
PrintStream printStream = null;
if (isDebug)
{
printStream = new BambooPrintWriter(System.out, logger);
logger.addBuildLogEntry(props.get("com.overops.plugins.bamboo.task.config.apiUrl") + ": " + endPoint);
logger.addBuildLogEntry(props.get("com.overops.plugins.bamboo.task.config.appUrl") + ": " + appUrl);
logger.addBuildLogEntry(props.get("com.overops.plugins.bamboo.task.config.envId") + ": " + query.getServiceId());
logger.addBuildLogEntry(props.get("com.overops.plugins.bamboo.task.config.applicationName") + ": " + query.getApplicationName());
logger.addBuildLogEntry(props.get("com.overops.plugins.bamboo.task.config.deploymentName") + ": " + query.getDeploymentName());
}
PrintStream printStream = isDebug ? new BambooPrintWriter(System.out, logger) : null;

Boolean displayLink = Boolean.parseBoolean(context.getConfigurationMap().get(Const.LINK));
if (displayLink)
{
HtmlParts htmlParts = new HtmlParts(overOpsService.generateReportLinkHtml(appUrl, query), "");
HtmlParts htmlParts = new HtmlParts(overOpsService.generateReportLinkHtml(appUrl, query, printStream, isDebug), "");
context.getBuildContext().getBuildResult().getCustomBuildData().put("overOpsReport", objectMapper.writeValueAsString(htmlParts));
context.getBuildContext().getBuildResult().getCustomBuildData().put("isOverOpsStep", "true");
return resultBuilder.success().build();
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/com/overops/plugins/bamboo/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ public static String getArtifactId() throws IOException {
return getProperty("artifactId");
}

public static Properties getOverOpsProperties() throws IOException
{
Properties props = new Properties();
props.load(Utils.class.getResourceAsStream("overops.properties"));
return props;
}

private static String getProperty(String prop) throws IOException {
Properties props = new Properties();
props.load(Utils.class.getResourceAsStream("/version.properties"));
Expand Down

0 comments on commit 2a85bfb

Please sign in to comment.