Skip to content

Commit

Permalink
chore(dependencies): Spring Boot 2.2.4 upgrade (#3383)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Delagrave authored and dreynaud committed Jan 27, 2020
1 parent d4b6765 commit 2eebac7
Show file tree
Hide file tree
Showing 22 changed files with 94 additions and 40 deletions.
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Thu Jan 23 21:06:18 UTC 2020
fiatVersion=1.12.0
enablePublishing=false
korkVersion=7.12.0
fiatVersion=1.13.0
keikoVersion=3.4.0
korkVersion=7.13.0
spinnakerGradleVersion=7.0.1
keikoVersion=3.3.0
enablePublishing=false
org.gradle.parallel=true
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.netflix.spinnaker.orca.pipeline.model

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.netflix.spinnaker.kork.artifacts.model.Artifact
import com.netflix.spinnaker.kork.artifacts.model.ExpectedArtifact
Expand All @@ -31,8 +32,11 @@ interface Trigger {
val parameters: Map<String, Any>
val artifacts: List<Artifact>
val notifications: List<Map<String, Any>>
@get:JsonProperty("rebake")
var isRebake: Boolean
@get:JsonProperty("dryRun")
var isDryRun: Boolean
@get:JsonProperty("strategy")
var isStrategy: Boolean
var resolvedExpectedArtifacts: List<ExpectedArtifact>
@set:JsonAnySetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ContextParameterProcessorSpec extends Specification {
result.test == source.test
summary[escapedExpression].size() == 1
summary[escapedExpression][0].level as String == ExpressionEvaluationSummary.Result.Level.ERROR.name()
summary[escapedExpression][0].exceptionType == SpelEvaluationException
summary[escapedExpression][0].exceptionType == SpelEvaluationException.typeName

where:
testCase | desc
Expand All @@ -184,7 +184,7 @@ class ContextParameterProcessorSpec extends Specification {
result.test == source.test
summary[escapedExpression].size() == 1
summary[escapedExpression][0].level as String == ExpressionEvaluationSummary.Result.Level.ERROR.name()
summary[escapedExpression][0].exceptionType == SpelEvaluationException
summary[escapedExpression][0].exceptionType == SpelEvaluationException.typeName

where:
testCase | desc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import org.springframework.stereotype.Component
class AssociateElasticIpTask extends AbstractElasticIpTask {
@Override
ElasticIpResult performRequest(StageData stageData) {
stageData.with {
flexService.associateElasticIp(application, account, cluster, region, elasticIp)
}
flexService.associateElasticIp(stageData.application,
stageData.account,
stageData.cluster,
stageData.region,
stageData.elasticIp)
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import org.springframework.stereotype.Component
class DisassociateElasticIpTask extends AbstractElasticIpTask {
@Override
ElasticIpResult performRequest(StageData stageData) {
stageData.with {
flexService.disassociateElasticIp(application, account, cluster, region, elasticIp.address)
}
flexService.disassociateElasticIp(stageData.application,
stageData.account,
stageData.cluster,
stageData.region,
stageData.elasticIp.address)
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class PluginInfo {
@Nonnull private String id;
private String description;
private String provider;
@Nonnull private List<Release> releases;

@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Release {
private String version;
private String date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class DependentPipelineStarterSpec extends Specification {
name : "triggered",
id : "triggered",
expectedArtifacts: [[
id: "id1",
matchArtifact: [
kind: "gcs",
name: "gs://test/file.yaml",
Expand Down Expand Up @@ -234,6 +235,7 @@ class DependentPipelineStarterSpec extends Specification {
name : "triggered",
id : "triggered",
expectedArtifacts: [[
id: "id1",
matchArtifact: [
kind: "gcs",
name: "gs://test/file.yaml",
Expand Down Expand Up @@ -303,6 +305,7 @@ class DependentPipelineStarterSpec extends Specification {
name : "triggered",
id : "triggered",
expectedArtifacts: [[
id: "id1",
matchArtifact: [
kind: "gcs",
name: "gs://test/file.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.spinnaker.kork.artifacts.model.ExpectedArtifact;
import com.netflix.spinnaker.orca.front50.PipelineModelMutator;
import com.netflix.spinnaker.orca.pipelinetemplate.exceptions.TemplateLoaderException;
import com.netflix.spinnaker.orca.pipelinetemplate.loader.TemplateLoader;
Expand All @@ -29,6 +28,7 @@
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.render.RenderContext;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.render.RenderUtil;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.render.Renderer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -128,7 +128,6 @@ private void applyConfigurationsFromTemplate(
}
}

@SuppressWarnings("unchecked")
private void applyConfigurations(
PipelineConfiguration configuration, Map<String, Object> pipeline) {
if (configuration.getConcurrentExecutions() != null) {
Expand Down Expand Up @@ -165,7 +164,7 @@ private void applyConfigurations(
TemplateMerge.mergeDistinct(
pipelineTemplateObjectMapper.convertValue(
pipeline.get("expectedArtifacts"),
new TypeReference<List<ExpectedArtifact>>() {}),
new TypeReference<List<HashMap<String, Object>>>() {}),
configuration.getExpectedArtifacts()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ public List<V2StageDefinition> getStages() {
return Collections.emptyList();
}
ObjectMapper oj = new ObjectMapper();
TypeReference v2StageDefTypeRef = new TypeReference<List<V2StageDefinition>>() {};
return oj.convertValue(pipelineStages, v2StageDefTypeRef);
return oj.convertValue(pipelineStages, new TypeReference<List<V2StageDefinition>>() {});
}

public void setStages(List<V2StageDefinition> stages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ class TemplatedPipelineModelMutatorSpec extends Specification {
0 * subject.applyConfigurationsFromTemplate(_, _, pipeline)
}

def "should merge expectedArtifacts when configured to inherit them"() {
given:
def pipeline = [
config: [
schema: '1',
pipeline: [
template: [
source: 'static-template'
]
],
configuration: [
inherit: ['expectedArtifacts'],
expectedArtifacts: [
[
id: 'artifact1'
] as NamedHashMap
]
]
]
]

when:
subject.mutate(pipeline)

then:
1 * templateLoader.load(_) >> { [new PipelineTemplate(
schema: '1',
configuration: new Configuration(
expectedArtifacts: [
[
id: 'artifact2'
] as NamedHashMap
]
)
)]}
pipeline.expectedArtifacts.size() == 2
}

def "should apply configurations from template if template is statically sourced"() {
given:
def pipeline = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisCluster
import redis.clients.util.Pool
import redis.clients.jedis.util.Pool
import java.time.Clock
import java.util.Optional

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import redis.clients.jedis.HostAndPort
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisCluster
import redis.clients.jedis.Protocol
import redis.clients.util.Pool
import redis.clients.jedis.util.Pool
import java.net.URI
import java.time.Clock
import java.time.Duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import com.fasterxml.jackson.module.kotlin.readValue
import com.netflix.spinnaker.orca.q.pending.PendingExecutionService
import com.netflix.spinnaker.q.Message
import redis.clients.jedis.Jedis
import redis.clients.util.Pool
import redis.clients.jedis.util.Pool

class RedisPendingExecutionService(
private val pool: Pool<Jedis>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.test.context.junit4.SpringRunner
import redis.clients.jedis.Jedis
import redis.clients.util.Pool
import redis.clients.jedis.util.Pool

@Configuration
class RedisTestConfig {
Expand Down
3 changes: 0 additions & 3 deletions orca-redis/orca-redis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ apply from: "$rootDir/gradle/kotlin.gradle"
apply from: "$rootDir/gradle/spock.gradle"

dependencies {
api("redis.clients:jedis:2.10.2") {
force = true
}
api("com.netflix.spinnaker.kork:kork-jedis")

implementation(project(":orca-core"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.net.URI;
import redis.clients.jedis.Protocol;
import redis.clients.util.JedisURIHelper;
import redis.clients.jedis.util.JedisURIHelper;

public class RedisConnectionInfo {
public boolean hasPassword() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.jetbrains.annotations.NotNull;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.params.SetParams;

public class RedisClusterNotificationClusterLock implements NotificationClusterLock {

private final JedisCluster cluster;

public RedisClusterNotificationClusterLock(JedisCluster cluster) {
Expand All @@ -13,6 +15,10 @@ public RedisClusterNotificationClusterLock(JedisCluster cluster) {
@Override
public boolean tryAcquireLock(@NotNull String notificationType, long lockTimeoutSeconds) {
String key = "lock:" + notificationType;
return "OK".equals(cluster.set(key, "\uD83D\uDD12", "NX", "EX", lockTimeoutSeconds));
// assuming lockTimeoutSeconds will be < 2147483647
return "OK"
.equals(
cluster.set(
key, "\uD83D\uDD12", SetParams.setParams().nx().ex((int) lockTimeoutSeconds)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.netflix.spinnaker.kork.jedis.RedisClientDelegate;
import com.netflix.spinnaker.kork.jedis.RedisClientSelector;
import javax.annotation.Nonnull;
import redis.clients.jedis.params.SetParams;

public class RedisNotificationClusterLock implements NotificationClusterLock {

Expand All @@ -32,7 +33,14 @@ public boolean tryAcquireLock(@Nonnull String notificationType, long lockTimeout
String key = "lock:" + notificationType;
return redisClientDelegate.withCommandsClient(
client -> {
return "OK".equals(client.set(key, "\uD83D\uDD12", "NX", "EX", lockTimeoutSeconds));
return "OK"
.equals(
client
// assuming lockTimeoutSeconds will be < 2147483647
.set(
key,
"\uD83D\uDD12",
SetParams.setParams().nx().ex((int) lockTimeoutSeconds)));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import static java.lang.System.currentTimeMillis;
import static java.util.Collections.*;
import static net.logstash.logback.argument.StructuredArguments.value;
import static redis.clients.jedis.BinaryClient.LIST_POSITION.AFTER;
import static redis.clients.jedis.BinaryClient.LIST_POSITION.BEFORE;
import static redis.clients.jedis.ListPosition.AFTER;
import static redis.clients.jedis.ListPosition.BEFORE;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
Expand Down Expand Up @@ -58,7 +58,7 @@
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.BinaryClient;
import redis.clients.jedis.ListPosition;
import redis.clients.jedis.Response;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
Expand Down Expand Up @@ -786,7 +786,7 @@ public List<String> retrieveAllApplicationNames(@Nullable ExecutionType type, in
});
}

cursor = chunk.getStringCursor();
cursor = chunk.getCursor();
if (cursor.equals("0")) {
break;
}
Expand Down Expand Up @@ -1360,8 +1360,7 @@ private void storeStageInternal(RedisClientDelegate delegate, Stage stage, Boole
tx.hdel(key, keysToRemove.toArray(new String[0]));
}
if (updateIndex) {
BinaryClient.LIST_POSITION pos =
stage.getSyntheticStageOwner() == STAGE_BEFORE ? BEFORE : AFTER;
ListPosition pos = stage.getSyntheticStageOwner() == STAGE_BEFORE ? BEFORE : AFTER;
tx.linsert(indexKey, pos, stage.getParentStageId(), stage.getId());
}
tx.exec();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.util.Pool;
import redis.clients.jedis.util.Pool;

@Component
public class RedisPoolMetricsPostProcessor extends AbstractMetricsPostProcessor<JedisPool> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.netflix.spinnaker.orca.pipeline.model.Stage
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionNotFoundException
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepositoryTck
import redis.clients.jedis.Jedis
import redis.clients.util.Pool
import redis.clients.jedis.util.Pool
import spock.lang.AutoCleanup
import spock.lang.Shared
import spock.lang.Unroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.Jedis;
import redis.clients.util.Pool;
import redis.clients.jedis.util.Pool;

@Configuration
public class EmbeddedRedisConfiguration {
Expand Down

0 comments on commit 2eebac7

Please sign in to comment.