Skip to content

Commit

Permalink
fix(triggers): Git trigger should have a hash property
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Mar 14, 2018
1 parent 9f3f4a0 commit f71168d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ class AppEngineBranchFinderSpec extends Specification {
@Unroll
def "(git trigger) should resolve branch in trigger if it matches regex (if provided). If no regex is provided, the branch from the trigger will be used."() {
given:
def trigger = new GitTrigger("github", "spinnaker", triggerBranch, "orca")
def trigger = new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", triggerBranch, "orca")

def operation = [
trigger: [
hash : "c681a6af-1096-4727-ac9e-70d3b2460228",
source : "github",
project: "spinnaker",
slug : "orca",
Expand All @@ -48,10 +49,11 @@ class AppEngineBranchFinderSpec extends Specification {

def "(git trigger) should throw appropriate error if method cannot resolve a branch"() {
given:
def trigger = new GitTrigger("github", "spinnaker", "no-match", "orca")
def trigger = new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca")

def operation = [
trigger : [
hash : "c681a6af-1096-4727-ac9e-70d3b2460228",
source : "github",
project: "spinnaker",
slug : "orca",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ data class GitTrigger
override var isRebake: Boolean = false,
override var isDryRun: Boolean = false,
override var isStrategy: Boolean = false,
val hash: String,
val source: String,
val project: String,
val branch: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal class TriggerDeserializer
get("rebake")?.booleanValue() == true,
get("dryRun")?.booleanValue() == true,
get("strategy")?.booleanValue() == true,
get("hash").textValue(),
get("source").textValue(),
get("project").textValue(),
get("branch").textValue(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class TriggerSpec extends Specification {
expect:
trigger instanceof GitTrigger
with(trigger) {
hash == "adb2554e870ae86622f05de2a15f4539030d87a7"
source == "stash"
project == "CAD"
branch == "bladerunner-release"
Expand Down

0 comments on commit f71168d

Please sign in to comment.