Skip to content

Commit

Permalink
Fixing deployment (#55)
Browse files Browse the repository at this point in the history
* reverted changes to helm. Still builds, but may still face problems with the audit logging

* Allowing the SEARCH role to see the data

* removing calls to AuditService temporarily, until Cloud Platform changes deployed
  • Loading branch information
JazJax authored Dec 23, 2024
1 parent 02e6867 commit 87b6d1e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ generic-service:
SERVER_PORT: "8080"
APPLICATIONINSIGHTS_CONNECTION_STRING: "InstrumentationKey=$(APPINSIGHTS_INSTRUMENTATIONKEY)"
APPLICATIONINSIGHTS_CONFIGURATION_FILE: applicationinsights.json
HMPPS_SQS_USEWEBTOKEN: true
# HMPPS_SQS_USEWEBTOKEN: true # <== COMMENTED OUT to investigate failing build 20/12/2024

# Pre-existing kubernetes secrets to load as environment variables in the deployment.
# namespace_secrets:
Expand All @@ -30,8 +30,8 @@ generic-service:
namespace_secrets:
hmpps-electronic-monitoring-datastore-api:
APPINSIGHTS_INSTRUMENTATIONKEY: "APPINSIGHTS_INSTRUMENTATIONKEY"
CLIENT_ID: "API_CLIENT_ID"
CLIENT_SECRET: "API_CLIENT_SECRET"
# CLIENT_ID: "API_CLIENT_ID" # <== COMMENTED OUT to investigate failing build 20/12/2024
# CLIENT_SECRET: "API_CLIENT_SECRET" # <== COMMENTED OUT to investigate failing build 20/12/2024

allowlist:
groups:
Expand Down
17 changes: 9 additions & 8 deletions helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ generic-service:
host: electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk

env:
SENTRY_ENV: dev
# SENTRY_ENV: dev # <== COMMENTED OUT to investigate failing build 20/12/2024
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth"

namespace_secrets:
hmpps-auth:
CLIENT_ID: "client-id"
CLIENT_SECRET: "client-secret"
other-services:
APPINSIGHTS_INSTRUMENTATIONKEY: "azure-app-insights"
SENTRY_DSN: "sentry"
# <== COMMENTED OUT to investigate failing build 20/12/2024
# namespace_secrets:
# hmpps-auth:
# CLIENT_ID: "client-id"
# CLIENT_SECRET: "client-secret"
# other-services:
# APPINSIGHTS_INSTRUMENTATIONKEY: "azure-app-insights"
# SENTRY_DSN: "sentry"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ class OrderController(
val repository = OrderInformationRepository()
val orderInfo: OrderInformation = repository.getMockOrderInformation(orderId)

auditService.createEvent(
authentication.principal.toString(),
"GET_MOCK_ORDER_SUMMARY",
mapOf("orderId" to orderId),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "GET_MOCK_ORDER_SUMMARY",
// mapOf("orderId" to orderId),
// )

return ResponseEntity.ok(orderInfo)
}
Expand All @@ -51,11 +52,12 @@ class OrderController(

return ResponseEntity.ok(repository.getMockOrderInformation(orderId))

auditService.createEvent(
authentication.principal.toString(),
"GET_SPECIALS_ORDER_SUMMARY",
mapOf("orderId" to orderId),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "GET_SPECIALS_ORDER_SUMMARY",
// mapOf("orderId" to orderId),
// )

return ResponseEntity.ok(
repository.getMockOrderInformation(orderId),
Expand Down Expand Up @@ -85,11 +87,12 @@ class OrderController(
documents = fakeOrder.documents,
)

auditService.createEvent(
authentication.principal.toString(),
"GET_ORDER_SUMMARY",
mapOf("orderId" to orderId),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "GET_ORDER_SUMMARY",
// mapOf("orderId" to orderId),
// )

return ResponseEntity.ok(result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.service.Ath
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.service.internal.AuditService

@RestController
@PreAuthorize("hasAnyAuthority('ROLE_EM_DATASTORE_GENERAL_RO', 'ROLE_EM_DATASTORE_RESTRICTED_RO')")
@PreAuthorize("hasAnyAuthority('ROLE_EM_DATASTORE_GENERAL_RO', 'ROLE_EM_DATASTORE_RESTRICTED_RO', 'ROLE_ELECTRONIC_MONITORING_DATASTORE_API_SEARCH')")
@RequestMapping(value = ["/search"], produces = [MediaType.APPLICATION_JSON_VALUE])
class SearchController(
@Autowired val auditService: AuditService,
Expand Down Expand Up @@ -66,11 +66,12 @@ class SearchController(
val athenaService = AthenaService()
val resultSet: ResultSet = athenaService.getQueryResult(validatedRole, queryString)

auditService.createEvent(
authentication.principal.toString(),
"SEARCH_TEST",
mapOf("queryString" to queryString),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "SEARCH_TEST",
// mapOf("queryString" to queryString),
// )

return ResponseEntity<ResultSet>(
resultSet,
Expand Down Expand Up @@ -106,11 +107,12 @@ class SearchController(
)
}

auditService.createEvent(
authentication.principal.toString(),
"SEARCH_WITH_CUSTOM_QUERY",
mapOf("queryString" to queryString),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "SEARCH_WITH_CUSTOM_QUERY",
// mapOf("queryString" to queryString),
// )

return AthenaQueryResponse<String>(
queryString = queryString,
Expand All @@ -125,11 +127,12 @@ class SearchController(
authentication: Authentication,
@RequestBody orderSearchCriteria: OrderSearchCriteria,
): List<OrderSearchResult> {
auditService.createEvent(
authentication.principal.toString(),
"SEARCH_OLD_ORDERS",
mapOf("legacySubjectId" to orderSearchCriteria.legacySubjectId, "searchType" to orderSearchCriteria.searchType),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "SEARCH_OLD_ORDERS",
// mapOf("legacySubjectId" to orderSearchCriteria.legacySubjectId, "searchType" to orderSearchCriteria.searchType),
// )

return OrderRepository.Companion.getFakeOrders()
}
Expand All @@ -144,11 +147,12 @@ class SearchController(
// 2: query repository
val result: AthenaQueryResponse<List<OrderSearchResult>> = repository.getOrders(orderSearchCriteria)

auditService.createEvent(
authentication.principal.toString(),
"SEARCH_ORDERS",
mapOf("legacySubjectId" to orderSearchCriteria.legacySubjectId, "searchType" to orderSearchCriteria.searchType),
)
// TODO: Re-enable audit once Cloud Platform in place
// auditService.createEvent(
// authentication.principal.toString(),
// "SEARCH_ORDERS",
// mapOf("legacySubjectId" to orderSearchCriteria.legacySubjectId, "searchType" to orderSearchCriteria.searchType),
// )

return ResponseEntity<List<OrderSearchResult>>(
result.queryResponse,
Expand Down

0 comments on commit 87b6d1e

Please sign in to comment.