Skip to content

Commit

Permalink
chore(dependencies): Autobump fiatVersion (#4811)
Browse files Browse the repository at this point in the history
* chore(dependencies): Autobump fiatVersion

* refactor(retrofit2): refactor the code to align with the retrofit2 upgrade of fiat-api

---------

Co-authored-by: root <root@4f180b5207b5>
Co-authored-by: kirangodishala <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent f327686 commit 35418cd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 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
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 35418cd

Please sign in to comment.