Skip to content

Commit

Permalink
fix(mptv1): revert back Jinjava to 2.2.3 (#2921)
Browse files Browse the repository at this point in the history
* fix(mptv1): revert back Jinjava to 2.2.3
Also, making some related calls anonymous to not be noisy
Also, had to pull specific version of guava since kork doesn't specify it
  • Loading branch information
marchello2000 committed May 16, 2019
1 parent bb4efbc commit 468dead
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ allprojects {
group = "com.netflix.spinnaker.orca"

ext {
korkVersion = "5.2.3"
korkVersion = "5.3.3"
keikoVersion = "2.10.1"
fiatVersion = "1.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion orca-core/orca-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {
api("io.reactivex:rxjava")

implementation(project(":orca-extensionpoint"))
implementation("com.google.guava:guava")
implementation("com.github.ben-manes.caffeine:guava")
implementation("org.slf4j:slf4j-api")
implementation("com.fasterxml.jackson.core:jackson-annotations")
implementation("com.fasterxml.jackson.core:jackson-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.netflix.spinnaker.orca.front50.Front50Service;
import com.netflix.spinnaker.orca.pipelinetemplate.exceptions.TemplateLoaderException;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.model.PipelineTemplate;
import com.netflix.spinnaker.security.AuthenticatedRequest;
import java.net.URI;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -53,7 +54,8 @@ public PipelineTemplate load(URI uri) {

String id = uri.getRawAuthority();
try {
Map<String, Object> pipelineTemplate = front50Service.getPipelineTemplate(id);
Map<String, Object> pipelineTemplate =
AuthenticatedRequest.allowAnonymous(() -> front50Service.getPipelineTemplate(id));
return objectMapper.convertValue(pipelineTemplate, PipelineTemplate.class);
} catch (Exception e) {
throw new TemplateLoaderException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ private void renderStage(StageDefinition stage, RenderContext context, String lo
.withCause("Received type " + rendered.getClass().toString())
.withLocation(context.getLocation()));
}
context.getVariables().putAll((Map<String, Object>) rendered);
stage.setConfig((Map<String, Object>) rendered);

stage.setName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.netflix.spinnaker.orca.front50.Front50Service;
import com.netflix.spinnaker.orca.pipelinetemplate.exceptions.TemplateRenderException;
import com.netflix.spinnaker.orca.pipelinetemplate.validator.Errors.Error;
import com.netflix.spinnaker.security.AuthenticatedRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -79,9 +80,12 @@ public String interpret(TagNode tagNode, JinjavaInterpreter interpreter) {
String name = paramPairs.get(NAME).replaceAll("^[\"\']|[\"\']$", "");
name = checkContext(name, context);

final String appName = application;
List<Map<String, Object>> pipelines =
Optional.ofNullable(front50Service.getPipelines(application, false))
.orElse(Collections.emptyList());
AuthenticatedRequest.allowAnonymous(
() ->
Optional.ofNullable(front50Service.getPipelines(appName, false))
.orElse(Collections.emptyList()));
Map<String, Object> result = findPipeline(pipelines, application, name);
return (String) result.get("id");
}
Expand Down
1 change: 1 addition & 0 deletions orca-queue/orca-queue.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
implementation("com.netflix.spinnaker.keiko:keiko-spring:$keikoVersion")
implementation("javax.ws.rs:jsr311-api:1.1.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.github.ben-manes.caffeine:guava")

testImplementation(project(":orca-test-kotlin"))
testImplementation(project(":orca-queue-tck"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class OperationsController {
throw new UnsupportedOperationException("Front50 is not enabled, no way to retrieve pipeline configs. Fix this by setting front50.enabled: true")
}

List<Map> history = front50Service.getPipelineHistory(pipelineConfigId, 1)
List<Map> history = AuthenticatedRequest.allowAnonymous({front50Service.getPipelineHistory(pipelineConfigId, 1)})
if (history.isEmpty()) {
throw new NotFoundException("Pipeline config $pipelineConfigId not found")
}
Expand Down

0 comments on commit 468dead

Please sign in to comment.