Skip to content

Commit

Permalink
Merge pull request #191 from navikt/upgrade-packages
Browse files Browse the repository at this point in the history
Upgrade packages
  • Loading branch information
enstulen authored Jun 12, 2024
2 parents 6db9bea + 8988a0a commit 1e16f2f
Show file tree
Hide file tree
Showing 14 changed files with 769 additions and 417 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: prod
byosbom: target/bom.json
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-build-push.outputs.image }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
environment:
description: 'Environment to deploy'
required: true
default: 'preprod-q1'
default: 'preprod-q2'
type: choice
options:
- none
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: ${{ github.event.inputs.environment }}
byosbom: target/bom.json
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-build-push.outputs.image }}

Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:


deploy-alerts-preprod:
needs: [deploy-preprod-q1, deploy-preprod-q2]
needs: [ deploy-preprod-q1, deploy-preprod-q2 ]
if: always() && (needs.deploy-preprod-q1.result == 'success' || needs.deploy-preprod-q2.result == 'success')
name: Deploy alerts to dev
runs-on: ubuntu-latest
Expand Down
10 changes: 6 additions & 4 deletions arkiverer/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand Down Expand Up @@ -55,10 +55,11 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>${prometheus.client.version}</version>
<artifactId>prometheus-metrics-instrumentation-jvm</artifactId>
<version>${prometheus.version}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -94,7 +95,8 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version> </dependency>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-streams-avro-serde</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package no.nav.soknad.arkivering.soknadsarkiverer.service

import kotlinx.coroutines.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import no.nav.soknad.arkivering.avroschemas.EventTypes
import no.nav.soknad.arkivering.avroschemas.ProcessingEvent
import no.nav.soknad.arkivering.avroschemas.Soknadarkivschema
Expand Down Expand Up @@ -32,14 +34,19 @@ open class TaskListService(
private val loggedTaskStates = hashMapOf<String, EventTypes>()
private val currentTaskStates = hashMapOf<String, EventTypes>()

private val processRun: Boolean = true // Hvis true så vil all behandling av ulike states på søknader initieres fra topology. Pt vil noen tester feile hvis = false
private val processRun: Boolean =
true // Hvis true så vil all behandling av ulike states på søknader initieres fra topology. Pt vil noen tester feile hvis = false

private val startUpEndTime = Instant.now().plusSeconds(startUpSeconds)

init {
logger.info("startUpEndTime=$startUpEndTime")
}

fun clearLoggedTaskStates() {
loggedTaskStates.clear()
}

@Synchronized
open fun addOrUpdateTask(
key: String,
Expand Down Expand Up @@ -145,9 +152,9 @@ open class TaskListService(

when (currentTaskStates[key]) {
EventTypes.RECEIVED -> receivedState(key, soknadarkivschema, attempt)
EventTypes.STARTED -> archiveState(key, soknadarkivschema, attempt)
EventTypes.STARTED -> archiveState(key, soknadarkivschema, attempt)
EventTypes.ARCHIVED -> deleteFilesState(key, soknadarkivschema, attempt)
EventTypes.FAILURE -> failTask(key)
EventTypes.FAILURE -> failTask(key)
EventTypes.FINISHED -> finishTask(key)
else -> {
logger.error("$key: - Unexpected state ${currentTaskStates[key]} - Will assume it was ${EventTypes.RECEIVED}")
Expand All @@ -157,7 +164,7 @@ open class TaskListService(
}

fun receivedState(key: String, soknadarkivschema: Soknadarkivschema, attempt: Int = 0) {
if (tasks[key] != null && startUpEndTime.isAfter(Instant.now()) ) {
if (tasks[key] != null && startUpEndTime.isAfter(Instant.now())) {
// When recreating state, there could be more state updates in the processLoggTopic.
// Wait a little while to make sure we don't start before all queued states are read inorder to process the most recent state.
val task = { receivedState(key, soknadarkivschema, attempt) }
Expand All @@ -182,7 +189,7 @@ open class TaskListService(

private fun deleteFilesState(key: String, soknadarkivschema: Soknadarkivschema, attempt: Int = 0) {
logger.info("$key: state = ARCHIVED. About to delete files in attempt $attempt")
val task = {tryToDeleteFiles(key, soknadarkivschema)}
val task = { tryToDeleteFiles(key, soknadarkivschema) }
val scheduledTime = Instant.now().plusSeconds(0)
if (tasks[key]?.isBootstrappingTask == true)
scheduler.scheduleSingleTask(task, scheduledTime)
Expand Down Expand Up @@ -323,13 +330,14 @@ open class TaskListService(

private fun checkIfAlreadyArchived(key: String) {
val journalpost = try {
safService.hentJournalpostGittInnsendingId(key)
safService.hentJournalpostGittInnsendingId(key)
} catch (ex: Exception) {
logger.warn("$key: Call to SAF service failed", ex)
return
}
if (journalpost != null) {
val archivingdetails = "Already archived journalpostId=${journalpost.journalpostId}, opprettet=${journalpost.datoOpprettet}"
val archivingdetails =
"Already archived journalpostId=${journalpost.journalpostId}, opprettet=${journalpost.datoOpprettet}"
logger.info("$key: $archivingdetails")
throw ApplicationAlreadyArchivedException("$key: $archivingdetails")
}
Expand Down
Loading

0 comments on commit 1e16f2f

Please sign in to comment.