Skip to content

Commit

Permalink
Merge branch 'master' into add-resolved-expected-artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarulg authored Dec 11, 2024
2 parents b622066 + 266ce73 commit 4ea5fe1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fiatVersion=1.52.0
fiatVersion=1.53.0
korkVersion=7.247.0
kotlinVersion=1.6.21
org.gradle.parallel=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class EcsServerGroupCreator implements ServerGroupCreator, DeploymentDetailsAwar
def bakeStage = getPreviousStageWithImage(stage, operation.region, cloudProvider)

if (bakeStage) {
operation.dockerImageAddress = bakeStage.context.amiDetails.imageId.value.get(0).toString()
operation.dockerImageAddress = bakeStage.context.amiDetails.collect(it->it.imageId).get(0).toString()
}
}

Expand Down Expand Up @@ -216,7 +216,7 @@ class EcsServerGroupCreator implements ServerGroupCreator, DeploymentDetailsAwar
throw new IllegalStateException("No image stage found in context for $description.imageLabelOrSha.")
}

description.imageId = imageStage.context.amiDetails.imageId.value.get(0).toString()
description.imageId = imageStage.context.amiDetails.collect(it->it.imageId).get(0).toString()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class EcsServerGroupCreatorSpec extends Specification {
def parentStage = stage {}
parentStage.id = parentStageId
parentStage.refId = parentStageId
parentStage.context.amiDetails = [imageId: [value: ["$testReg/$testRepo:$testTag"]]]
parentStage.context.amiDetails = List.of(Map.of("imageId","$testReg/$testRepo:$testTag"))

stage.context.imageDescription = testDescription
stage.parentStageId = parentStageId
Expand Down Expand Up @@ -120,7 +120,7 @@ class EcsServerGroupCreatorSpec extends Specification {
parentStage.id = parentStageId
parentStage.context.region = testRegion
parentStage.context.cloudProviderType = "ecs"
parentStage.context.amiDetails = [imageId: [value: ["$testReg/$testRepo:$testTag"]]]
parentStage.context.amiDetails = List.of(Map.of("imageId","$testReg/$testRepo:$testTag"))

stage.context.region = testRegion
stage.parentStageId = parentStageId
Expand Down
1 change: 1 addition & 0 deletions orca-web/orca-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ dependencies {
testImplementation("io.strikt:strikt-core")
testImplementation("io.mockk:mockk")
testImplementation("org.apache.groovy:groovy-json")
testImplementation ("com.squareup.retrofit2:retrofit-mock")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.netflix.spinnaker.fiat.shared.FiatService
import com.netflix.spinnaker.fiat.shared.FiatStatus
import com.netflix.spinnaker.kork.exceptions.ConfigurationException
import com.netflix.spinnaker.kork.exceptions.SpinnakerException
import com.netflix.spinnaker.kork.retrofit.Retrofit2SyncCall
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution
Expand Down Expand Up @@ -390,7 +391,7 @@ class OperationsController {
def userPermissionRoles = [new Role.View(new Role("anonymous"))] as Set<Role.View>
try {
String user = AuthenticatedRequest.getSpinnakerUser().orElse("anonymous")
UserPermission.View userPermission = fiatService.getUserPermission(user)
UserPermission.View userPermission = Retrofit2SyncCall.execute(fiatService.getUserPermission(user))
userPermissionRoles = userPermission.roles
} catch (Exception e) {
log.error("Unable to determine roles for current user, falling back to 'anonymous'", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.test.web.servlet.setup.MockMvcBuilders
import retrofit2.mock.Calls
import rx.Observable
import spock.lang.Specification
import spock.lang.Subject
Expand Down Expand Up @@ -682,7 +683,7 @@ class OperationsControllerSpec extends Specification {
def role = new Role().setName("some-role")
def permission = new UserPermission().setId("foo").setAccounts([account] as Set).setRoles([role] as Set)

fiatService.getUserPermission(*_) >> permission.getView()
fiatService.getUserPermission(*_) >> Calls.response(permission.getView())

when:
def preconfiguredWebhooks = controller.preconfiguredWebhooks()
Expand Down
1 change: 1 addition & 0 deletions orca-webhook/orca-webhook.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation(project(":orca-core"))
implementation(project(":orca-api"))
implementation("io.spinnaker.kork:kork-core")
implementation("io.spinnaker.kork:kork-retrofit")
implementation("io.spinnaker.kork:kork-web")
implementation("org.springframework.boot:spring-boot-autoconfigure")
compileOnly("org.projectlombok:lombok")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.netflix.spinnaker.fiat.shared.FiatService;
import com.netflix.spinnaker.kork.exceptions.SystemException;
import com.netflix.spinnaker.kork.retrofit.Retrofit2SyncCall;
import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode;
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution;
import com.netflix.spinnaker.orca.webhook.config.WebhookProperties.PreconfiguredWebhook;
Expand Down Expand Up @@ -70,7 +71,7 @@ public void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder b
var permissions = preconfiguredWebhook.getPermissions();
if (permissions != null && !permissions.isEmpty()) {
String user = AuthenticatedRequest.getSpinnakerUser().orElse("anonymous");
var userPermission = fiatService.getUserPermission(user);
var userPermission = Retrofit2SyncCall.execute(fiatService.getUserPermission(user));

boolean isAllowed = preconfiguredWebhook.isAllowed("WRITE", userPermission.getRoles());
if (!isAllowed) {
Expand Down

0 comments on commit 4ea5fe1

Please sign in to comment.