Skip to content

Commit

Permalink
feat(artifacts): Add actualArtifacts to Pipeline model.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtk54 committed Sep 26, 2017
1 parent d62e000 commit a15f545
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ allprojects {
group = "com.netflix.spinnaker.orca"

ext {
spinnakerDependenciesVersion = project.hasProperty('spinnakerDependenciesVersion') ? project.property('spinnakerDependenciesVersion') : '0.109.2'
spinnakerDependenciesVersion = project.hasProperty('spinnakerDependenciesVersion') ? project.property('spinnakerDependenciesVersion') : '0.110.5'
}

def checkLocalVersions = [spinnakerDependenciesVersion: spinnakerDependenciesVersion]
Expand Down
1 change: 1 addition & 0 deletions orca-core/orca-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
compile spinnaker.dependency('spectatorApi')
compile spinnaker.dependency('kork')
compile spinnaker.dependency('korkExceptions')
compile spinnaker.dependency('korkArtifacts')
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${spinnaker.version('jackson')}"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${spinnaker.version('jackson')}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

package com.netflix.spinnaker.orca.pipeline;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.spinnaker.orca.ExecutionStatus;
import com.netflix.spinnaker.orca.pipeline.model.Execution;
Expand All @@ -28,6 +24,12 @@
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import static java.lang.Boolean.parseBoolean;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@

package com.netflix.spinnaker.orca.pipeline;

import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;
import com.netflix.spinnaker.orca.pipeline.model.Execution.ExecutionEngine;
import com.netflix.spinnaker.orca.pipeline.model.Pipeline;
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Optional;

@Component
public class PipelineLauncher extends ExecutionLauncher<Pipeline> {

Expand Down Expand Up @@ -65,6 +67,7 @@ public PipelineLauncher(ObjectMapper objectMapper,
.withNotifications((List<Map<String, Object>>) config.get("notifications"))
.withExecutionEngine(getEnum(config, "executionEngine", ExecutionEngine.class))
.withOrigin(getString(config, "origin"))
.withActualArtifacts((List<Artifact>) config.get("actualArtifacts"))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;

public class Pipeline extends Execution<Pipeline> {

Expand All @@ -42,6 +43,16 @@ public Pipeline(

private String pipelineConfigId;

private List<Artifact> actualArtifacts = new ArrayList<>();

public void setActualArtifacts(List<Artifact> actualArtifacts) {
this.actualArtifacts = actualArtifacts;
}

public @Nonnull List<Artifact> getActualArtifacts() {
return actualArtifacts;
}

public @Nullable String getPipelineConfigId() {
return pipelineConfigId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.netflix.spinnaker.orca.pipeline.model

import com.netflix.spinnaker.kork.artifacts.model.Artifact

import java.util.concurrent.atomic.AtomicInteger
import com.netflix.spectator.api.Registry
import com.netflix.spinnaker.orca.ExecutionStatus
Expand Down Expand Up @@ -45,6 +47,14 @@ class PipelineBuilder {
return this
}

PipelineBuilder withActualArtifacts(List actualArtifacts = []) {
pipeline.actualArtifacts.clear()
if (actualArtifacts) {
pipeline.actualArtifacts.addAll(actualArtifacts)
}
return this
}

PipelineBuilder withNotifications(List<Map<String, Object>> notifications = []) {
pipeline.notifications.clear()
if (notifications) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ class JedisExecutionRepository implements ExecutionRepository {
map.pipelineConfigId = execution.pipelineConfigId
map.trigger = mapper.writeValueAsString(execution.trigger)
map.notifications = mapper.writeValueAsString(execution.notifications)
map.actualArtifacts = mapper.writeValueAsString(execution.actualArtifacts)
map.initialConfig = mapper.writeValueAsString(execution.initialConfig)
} else if (execution instanceof Orchestration) {
map.description = execution.description
Expand Down Expand Up @@ -653,6 +654,7 @@ class JedisExecutionRepository implements ExecutionRepository {
execution.pipelineConfigId = map.pipelineConfigId
execution.trigger.putAll(mapper.readValue(map.trigger, Map))
execution.notifications.addAll(mapper.readValue(map.notifications, List))
execution.actualArtifacts.addAll(mapper.readValue(map.actualArtifacts, List))
execution.initialConfig.putAll(mapper.readValue(map.initialConfig, Map))
} else if (execution instanceof Orchestration) {
execution.description = map.description
Expand Down

0 comments on commit a15f545

Please sign in to comment.