Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #39 from guardian/remove-commit-message-from-TipCo…
Browse files Browse the repository at this point in the history
…nfig

Remove commit message from tip config
  • Loading branch information
Mario Galic authored Jul 31, 2018
2 parents d64cc7e + 89b82ea commit 9bdc100
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 33 deletions.
4 changes: 1 addition & 3 deletions cloud/tip-create-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function registerBoard(sha, board, repo, commitMessage, deployTime) {
sha: sha,
board: board,
repo: repo,
commitMessage: commitMessage,
deployTime: deployTime
}
}
Expand All @@ -23,9 +22,8 @@ exports.handler = (event, context, callback) => {
const board = body.board;
const sha = body.sha;
const repo = body.repo;
const commitMessage = body.commitMessage;
const deployTime = body.deployTime;

registerBoard(sha, board, repo, commitMessage, deployTime)
registerBoard(sha, board, repo, deployTime)
.then(() => callback(null, {statusCode: 200, body: `{"field": "value"}`}));
};
5 changes: 0 additions & 5 deletions cloud/tip-get-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function renderBoard(data) {

const sha = data.Item.sha;
const repo = data.Item.repo;
const commitMessage = data.Item.commitMessage.replace(/\n/g, '<br />');
const numberOfVerifiedPaths = data.Item.board.filter( path => path.verified == true).length;
const coverage = Math.round((100 * numberOfVerifiedPaths) / data.Item.board.length);
const deployTime = data.Item.deployTime
Expand Down Expand Up @@ -110,11 +109,7 @@ function renderBoard(data) {
<div id="container">
<h3>
<a href="${linkToCommit}">${repo} ${sha}</a>
</h3>
<p>
${commitMessage}
</p>
<hr>
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sbt._

object Dependencies {
val http4sVersion = "0.18.0-M7"
val http4sVersion = "0.18.15"
val akkaVersion = "2.5.8"

lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.4" % Test
Expand Down
10 changes: 3 additions & 7 deletions src/main/scala/com/gu/tip/Configuration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import net.ceedubs.ficus.readers.ArbitraryTypeReader._
import net.jcazevedo.moultingyaml._

import scala.util.Try
import scala.io.Source.fromFile
import scala.io.Source

// $COVERAGE-OFF$

Expand All @@ -18,7 +18,6 @@ case class TipConfig(
personalAccessToken: String,
label: String,
boardSha: String = "",
commitMessage: String = "",
deployTime: String = ""
)

Expand Down Expand Up @@ -59,11 +58,8 @@ class Configuration(config: TipConfig) {
val tipConfig = config

private def readFile(filename: String): String =
Option(getClass.getClassLoader.getResource(filename))
.map { path =>
fromFile(path.getPath).mkString
}
.getOrElse(throw new FileNotFoundException(
Try(Source.fromResource(filename).getLines.mkString("\n")).getOrElse(
throw new FileNotFoundException(
s"Path definition file not found on the classpath: $filename"))

def readPaths(filename: String): List[Path] =
Expand Down
15 changes: 6 additions & 9 deletions src/main/scala/com/gu/tip/Tip.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ object Tip
val sha = configuration.tipConfig.boardSha
val repo =
s"${configuration.tipConfig.owner}/${configuration.tipConfig.repo}"
val commitMessage = configuration.tipConfig.commitMessage
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, commitMessage, deployTime).run.attempt
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, deployTime).run.attempt
.unsafeRunSync()
}
}
Expand All @@ -139,9 +138,8 @@ object TipFactory {
val sha = configuration.tipConfig.boardSha
val repo =
s"${configuration.tipConfig.owner}/${configuration.tipConfig.repo}"
val commitMessage = configuration.tipConfig.commitMessage
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, commitMessage, deployTime).run.attempt
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, deployTime).run.attempt
.unsafeRunSync()
}
}
Expand All @@ -156,9 +154,8 @@ object TipFactory {
val sha = configuration.tipConfig.boardSha
val repo =
s"${configuration.tipConfig.owner}/${configuration.tipConfig.repo}"
val commitMessage = configuration.tipConfig.commitMessage
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, commitMessage, deployTime).run.attempt
val deployTime = configuration.tipConfig.deployTime
createBoard(sha, repo, deployTime).run.attempt
.unsafeRunSync()
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/main/scala/com/gu/tip/cloud/TipCloudApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ import net.liftweb.json._
trait TipCloudApiIf { this: HttpClientIf with ConfigurationIf =>
def createBoard(sha: String,
repo: String,
commitMessage: String,
deployTime: String): WriterT[IO, List[Log], String]
def verifyPath(sha: String, name: String): WriterT[IO, List[Log], String]
def getBoard(sha: String): WriterT[IO, List[Log], String]

val tipCloudApiRoot =
"https://1g3v0a5b5h.execute-api.eu-west-1.amazonaws.com/PROD"
}

trait TipCloudApi extends TipCloudApiIf with LazyLogging {
this: HttpClientIf with ConfigurationIf =>

val tipCloudApiRoot =
"https://1g3v0a5b5h.execute-api.eu-west-1.amazonaws.com/PROD"

override def createBoard(
sha: String,
repo: String,
commitMessage: String,
deployTime: String): WriterT[IO, List[Log], String] = {
val paths = configuration.readPaths("tip.yaml")

Expand All @@ -43,8 +41,7 @@ trait TipCloudApi extends TipCloudApiIf with LazyLogging {
|{
| "sha": "$sha",
| "repo": "$repo",
| "commitMessage": "$commitMessage",
| "deployTime": "$deployTime"
| "deployTime": "$deployTime",
| "board": [
| ${board.mkString(",")}
| ]
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.4.3-SNAPSHOT"
version in ThisBuild := "0.4.4-SNAPSHOT"

0 comments on commit 9bdc100

Please sign in to comment.