Skip to content

Commit

Permalink
feat(pipelinetemplate) Add config and type attributes to the trigger …
Browse files Browse the repository at this point in the history
…payload (#149)
  • Loading branch information
gardleopard authored and robzienert committed Jun 21, 2017
1 parent 88c6082 commit 515436c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
@JsonProperty
@NonNull String application;

@JsonProperty
Object config;

@JsonProperty
@NonNull String name;

Expand All @@ -57,6 +60,9 @@
@JsonProperty
List<Trigger> triggers;

@JsonProperty
String type;

@JsonProperty
List<Map<String, Object>> stages;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,39 @@ class PipelineSpec extends Specification {
pipeline.triggers[1].enabled

}

void 'pipeline config deserialization should work fine for templated pipelines'() {
setup:
String pipelineJson = ''' {
"name": "Testing Templates",
"stages": [],
"config": {
"pipeline": {
"application": "testapp",
"name": "testing",
"pipelineConfigId": "4a522db6-b127-47b2-9c42-9b01b2625ce1",
"template": {
"source": "http://my.source"
},
"variables": {}
},
"schema": "1"
},
"triggers": [],
"application": "testapp",
"index": 1,
"id": "68a14710-1ade-11e5-89a8-65c9c7540d0f"
}
'''
when:
Pipeline pipeline = objectMapper.readValue(pipelineJson, Pipeline)

then:
noExceptionThrown()
pipeline != null
pipeline.id == '68a14710-1ade-11e5-89a8-65c9c7540d0f'
pipeline.name == 'Testing Templates'
pipeline.application == 'testapp'
pipeline.config.pipeline.pipelineConfigId == '4a522db6-b127-47b2-9c42-9b01b2625ce1'
}
}

0 comments on commit 515436c

Please sign in to comment.