Skip to content

Commit

Permalink
fix(pipelines): V2 trigger API now correctly returns an execution ref…
Browse files Browse the repository at this point in the history
…erence (#811)
  • Loading branch information
robzienert committed May 30, 2019
1 parent d82010d commit dd78f0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions gate-web/gate-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {

implementation 'commons-io:commons-io'
implementation 'org.springframework.session:spring-session-data-redis'
implementation "de.huxhorn.sulky:de.huxhorn.sulky.ulid"

implementation "org.springframework:spring-web"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector
import com.netflix.spinnaker.kork.core.RetrySupport
import com.netflix.spinnaker.kork.web.exceptions.NotFoundException
import com.netflix.spinnaker.security.AuthenticatedRequest
import groovy.transform.CompileStatic
import de.huxhorn.sulky.ulid.ULID
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
Expand All @@ -35,6 +35,8 @@ import org.springframework.stereotype.Component
class PipelineService {
private static final String GROUP = "pipelines"

private final ULID ulid = new ULID();

@Autowired(required = false)
Front50Service front50Service

Expand Down Expand Up @@ -98,7 +100,9 @@ class PipelineService {

Map triggerViaEcho(String application, String pipelineNameOrId, Map parameters) {
def eventId = UUID.randomUUID()
def executionId = ulid.nextValue().toString()
parameters.put("eventId", eventId)
parameters.put("executionId", executionId)

Map eventMap = [
content: [
Expand All @@ -112,7 +116,10 @@ class PipelineService {
]
]
echoService.postEvent(eventMap)
return [eventId: eventId]
return [
eventId: eventId,
ref: String.format("/pipelines/%s", executionId)
]
}

Map startPipeline(Map pipelineConfig, String user) {
Expand Down

0 comments on commit dd78f0e

Please sign in to comment.