diff --git a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt index 3248e32bd..1b31da64a 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt @@ -774,7 +774,7 @@ class SubmissionDatabaseService( else -> stringParam(versionComment) }, SequenceEntriesTable.submissionIdColumn, - SequenceEntriesTable.submitterColumn, + stringParam(authenticatedUser.username), SequenceEntriesTable.groupIdColumn, dateTimeParam(dateProvider.getCurrentDateTime()), booleanParam(true), SequenceEntriesTable.organismColumn, diff --git a/backend/src/test/kotlin/org/loculus/backend/controller/TestHelpers.kt b/backend/src/test/kotlin/org/loculus/backend/controller/TestHelpers.kt index 0675387ae..6cf573c56 100644 --- a/backend/src/test/kotlin/org/loculus/backend/controller/TestHelpers.kt +++ b/backend/src/test/kotlin/org/loculus/backend/controller/TestHelpers.kt @@ -9,6 +9,9 @@ import kotlinx.datetime.plus import kotlinx.datetime.toLocalDateTime import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers +import org.hamcrest.Matchers.allOf +import org.hamcrest.Matchers.containsInAnyOrder +import org.hamcrest.Matchers.hasEntry import org.hamcrest.Matchers.`is` import org.hamcrest.Matchers.not import org.loculus.backend.api.AccessionVersion @@ -19,8 +22,10 @@ import org.loculus.backend.api.Status import org.loculus.backend.utils.DateProvider import org.springframework.test.web.servlet.MvcResult import org.springframework.test.web.servlet.ResultActions +import org.springframework.test.web.servlet.ResultMatcher import org.springframework.test.web.servlet.result.MockMvcResultMatchers import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content +import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status import org.testcontainers.shaded.org.awaitility.Awaitility.await @@ -35,6 +40,16 @@ fun AccessionVersionInterface.toAccessionVersion() = AccessionVersion(this.acces fun List.getAccessionVersions() = map { it.toAccessionVersion() } +fun List.toAccessionVersionMatcher() = map { entry -> + allOf( + hasEntry("accession", entry.accession), + hasEntry("version", entry.version.toInt()), + ) +} + +fun jsonContainsAccessionVersionsInAnyOrder(expectedVersions: List): ResultMatcher = + jsonPath("\$[*]", containsInAnyOrder(expectedVersions.toAccessionVersionMatcher())) + fun addOrganismToPath(path: String, organism: String = DEFAULT_ORGANISM) = "/$organism/${path.trimStart('/')}" val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper().findAndRegisterModules() @@ -77,6 +92,25 @@ fun SequenceEntryStatus.assertHasError(error: Boolean): SequenceEntryStatus { return this } +fun SequenceEntryStatus.assertSubmitterIs(submitter: String): SequenceEntryStatus { + assertThat(this.submitter, `is`(submitter)) + return this +} + +fun SequenceEntryStatus.assertGroupIdIs(groupId: Int): SequenceEntryStatus { + assertThat(this.groupId, `is`(groupId)) + return this +} + +fun SequenceEntryStatus.assertIsRevocationIs(revoked: Boolean): SequenceEntryStatus { + if (revoked) { + assertThat(this.isRevocation, `is`(true)) + } else { + assertThat(this.isRevocation, `is`(false)) + } + return this +} + fun expectUnauthorizedResponse(isModifyingRequest: Boolean = false, apiCall: (jwt: String?) -> ResultActions) { val response = apiCall(null) diff --git a/backend/src/test/kotlin/org/loculus/backend/controller/submission/ApproveProcessedDataEndpointTest.kt b/backend/src/test/kotlin/org/loculus/backend/controller/submission/ApproveProcessedDataEndpointTest.kt index bf7e291b6..922909656 100644 --- a/backend/src/test/kotlin/org/loculus/backend/controller/submission/ApproveProcessedDataEndpointTest.kt +++ b/backend/src/test/kotlin/org/loculus/backend/controller/submission/ApproveProcessedDataEndpointTest.kt @@ -2,7 +2,6 @@ package org.loculus.backend.controller.submission import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.containsString -import org.hamcrest.Matchers.hasItem import org.hamcrest.Matchers.hasSize import org.hamcrest.Matchers.`is` import org.junit.jupiter.api.Test @@ -22,6 +21,7 @@ import org.loculus.backend.controller.assertStatusIs import org.loculus.backend.controller.expectUnauthorizedResponse import org.loculus.backend.controller.generateJwtFor import org.loculus.backend.controller.getAccessionVersions +import org.loculus.backend.controller.jsonContainsAccessionVersionsInAnyOrder import org.loculus.backend.controller.jwtForSuperUser import org.loculus.backend.controller.submission.SubmitFiles.DefaultFiles.NUMBER_OF_SEQUENCES import org.springframework.beans.factory.annotation.Autowired @@ -54,7 +54,7 @@ class ApproveProcessedDataEndpointTest( client.approveProcessedSequenceEntries(scope = ALL, accessionVersions) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("\$[*].accession").value(accessionVersions.map { it.accession })) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) assertThat( convenienceClient.getSequenceEntries().statusCounts[APPROVED_FOR_RELEASE], @@ -69,7 +69,7 @@ class ApproveProcessedDataEndpointTest( client.approveProcessedSequenceEntries(scope = ALL, accessionVersions) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("\$[*].accession").value(accessionVersions.map { it.accession })) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) assertThat( convenienceClient.getSequenceEntries().statusCounts[APPROVED_FOR_RELEASE], @@ -79,12 +79,12 @@ class ApproveProcessedDataEndpointTest( @Test fun `WHEN I approve without accession filter or with full scope THEN all data is approved`() { - val approvableSequences = convenienceClient.prepareDataTo(PROCESSED).map { it.accession } + val accessionVersions = convenienceClient.prepareDataTo(PROCESSED) client.approveProcessedSequenceEntries(scope = ALL) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("\$[*].accession").value(approvableSequences)) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) assertThat( convenienceClient.getSequenceEntriesOfUserInState(status = APPROVED_FOR_RELEASE), @@ -117,31 +117,32 @@ class ApproveProcessedDataEndpointTest( fun `WHEN I approve a sequence entry that does not exist THEN no accession should be approved`() { val nonExistentAccession = "999" - val accessionVersions = convenienceClient.prepareDataTo(PROCESSED).getAccessionVersions() + val processedAccessionVersion = convenienceClient.prepareDataTo(PROCESSED).getAccessionVersions().first() client.approveProcessedSequenceEntries( scope = ALL, listOf( - accessionVersions.first(), + processedAccessionVersion, AccessionVersion(nonExistentAccession, 1), ), ) .andExpect(status().isUnprocessableEntity) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.detail", containsString("Accession versions 999.1 do not exist"))) + .andExpect(jsonPath("$.detail", containsString("Accession versions $nonExistentAccession.1 do not exist"))) - convenienceClient.getSequenceEntry(accessionVersions.first()).assertStatusIs(PROCESSED) + convenienceClient.getSequenceEntry(processedAccessionVersion).assertStatusIs(PROCESSED) } @Test fun `WHEN I approve a sequence entry that does not exist THEN no sequence should be approved`() { val accessionVersions = convenienceClient.prepareDataTo(PROCESSED).getAccessionVersions() val nonExistingVersion = accessionVersions[1].copy(version = 999L) + val processedAccessionVersion = accessionVersions.first() client.approveProcessedSequenceEntries( scope = ALL, listOf( - accessionVersions.first(), + processedAccessionVersion, nonExistingVersion, ), ) @@ -157,7 +158,7 @@ class ApproveProcessedDataEndpointTest( ), ) - convenienceClient.getSequenceEntry(accessionVersions.first()).assertStatusIs(PROCESSED).assertHasError(false) + convenienceClient.getSequenceEntry(processedAccessionVersion).assertStatusIs(PROCESSED).assertHasError(false) } @Test @@ -240,8 +241,7 @@ class ApproveProcessedDataEndpointTest( ) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.[*]", hasSize>(otherOrganismData.size))) - .andExpect(jsonPath("$.[*].accession", hasItem(otherOrganismData.first().accession))) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(otherOrganismData)) convenienceClient.getSequenceEntry( accession = defaultOrganismData.first().accession, @@ -357,8 +357,7 @@ class ApproveProcessedDataEndpointTest( client.approveProcessedSequenceEntries(scope = ALL, jwt = jwtForSuperUser) .andExpect(status().isOk) - .andExpect(jsonPath("\$.length()").value(accessionVersions.size)) - .andExpect(jsonPath("\$[*].accession").value(accessionVersions.map { it.accession })) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) convenienceClient.getSequenceEntry(accessionVersions.first()).assertStatusIs(APPROVED_FOR_RELEASE) } @@ -379,8 +378,7 @@ class ApproveProcessedDataEndpointTest( submitterNamesFilter = listOf(DEFAULT_USER_NAME), ) .andExpect(status().isOk) - .andExpect(jsonPath("\$.length()").value(accessionVersions.size)) - .andExpect(jsonPath("\$[*].accession").value(accessionVersions.map { it.accession })) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) convenienceClient.getSequenceEntry(accessionVersions.first()).assertStatusIs(APPROVED_FOR_RELEASE) convenienceClient.getSequenceEntry( @@ -402,8 +400,7 @@ class ApproveProcessedDataEndpointTest( jwt = jwtForSuperUser, ) .andExpect(status().isOk) - .andExpect(jsonPath("\$.length()").value(accessionVersions.size)) - .andExpect(jsonPath("\$[*].accession").value(accessionVersions.map { it.accession })) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) convenienceClient.getSequenceEntry(accessionVersions.first()).assertStatusIs(APPROVED_FOR_RELEASE) } diff --git a/backend/src/test/kotlin/org/loculus/backend/controller/submission/DeleteSequencesEndpointTest.kt b/backend/src/test/kotlin/org/loculus/backend/controller/submission/DeleteSequencesEndpointTest.kt index 58556acb6..ed4a45ac2 100644 --- a/backend/src/test/kotlin/org/loculus/backend/controller/submission/DeleteSequencesEndpointTest.kt +++ b/backend/src/test/kotlin/org/loculus/backend/controller/submission/DeleteSequencesEndpointTest.kt @@ -1,11 +1,8 @@ package org.loculus.backend.controller.submission import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.allOf -import org.hamcrest.Matchers.containsInAnyOrder import org.hamcrest.Matchers.containsString import org.hamcrest.Matchers.equalTo -import org.hamcrest.Matchers.hasEntry import org.hamcrest.Matchers.hasItem import org.hamcrest.Matchers.hasProperty import org.hamcrest.Matchers.hasSize @@ -28,6 +25,7 @@ import org.loculus.backend.controller.OTHER_ORGANISM import org.loculus.backend.controller.assertStatusIs import org.loculus.backend.controller.expectUnauthorizedResponse import org.loculus.backend.controller.generateJwtFor +import org.loculus.backend.controller.jsonContainsAccessionVersionsInAnyOrder import org.loculus.backend.controller.jwtForSuperUser import org.loculus.backend.controller.submission.SubmitFiles.DefaultFiles.NUMBER_OF_SEQUENCES import org.loculus.backend.controller.toAccessionVersion @@ -79,11 +77,7 @@ class DeleteSequencesEndpointTest( deletionResult .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("\$.length()").value(accessionVersionsToDelete.size)) - - accessionVersionsToDelete.forEach { - deletionResult.andExpect(jsonPath("\$[*].accession", hasItem(it.accession))) - } + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersionsToDelete)) assertThat( convenienceClient.getSequenceEntriesOfUserInState( @@ -157,14 +151,16 @@ class DeleteSequencesEndpointTest( val erroneousSequences = convenienceClient.prepareDataTo(Status.PROCESSED, errors = true) val approvableSequences = convenienceClient.prepareDataTo(Status.PROCESSED) + val allSequences = erroneousSequences + approvableSequences + assertThat( convenienceClient.getSequenceEntries().sequenceEntries, - hasSize(erroneousSequences.size + approvableSequences.size), + hasSize(allSequences.size), ) client.deleteSequenceEntries(scope = ALL) .andExpect(status().isOk) - .andExpect(jsonPath("\$.length()").value(2 * NUMBER_OF_SEQUENCES)) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(allSequences)) assertThat( convenienceClient.getSequenceEntries().sequenceEntries, @@ -193,7 +189,7 @@ class DeleteSequencesEndpointTest( client.deleteSequenceEntries(scope = DeleteSequenceScope.PROCESSED_WITH_ERRORS) .andExpect(status().isOk) - .andExpect(jsonPath("\$.length()").value(NUMBER_OF_SEQUENCES)) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(erroneousSequences)) assertThat( convenienceClient.getProcessingResultCount(ProcessingResult.HAS_ERRORS), @@ -242,8 +238,7 @@ class DeleteSequencesEndpointTest( ) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.[*]", hasSize>(otherOrganismData.size))) - .andExpect(jsonPath("$.[*].accession", hasItem(otherOrganismData.first().accession))) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(otherOrganismData)) convenienceClient.getSequenceEntry( accession = defaultOrganismData.first().accession, @@ -299,9 +294,7 @@ class DeleteSequencesEndpointTest( client.deleteSequenceEntries(scope = ALL, jwt = jwtForSuperUser) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("\$.length()").value(accessionVersions.size)) - .andExpect(jsonPath("\$[0].accession").value(accessionVersions.first().accession)) - .andExpect(jsonPath("\$[0].version").value(accessionVersions.first().version)) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) } @Test @@ -312,13 +305,6 @@ class DeleteSequencesEndpointTest( ) .submissionIdMappings - val expectedPairs = accessionVersions.map { entry -> - allOf( - hasEntry("accession", entry.accession), - hasEntry("version", entry.version.toInt()), - ) - } - client.deleteSequenceEntries( scope = ALL, accessionVersionsFilter = accessionVersions, @@ -326,8 +312,7 @@ class DeleteSequencesEndpointTest( ) .andExpect(status().isOk) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("\$.length()").value(accessionVersions.size)) - .andExpect(jsonPath("\$[*]", containsInAnyOrder(expectedPairs))) + .andExpect(jsonContainsAccessionVersionsInAnyOrder(accessionVersions)) } @Test diff --git a/backend/src/test/kotlin/org/loculus/backend/controller/submission/RevokeEndpointTest.kt b/backend/src/test/kotlin/org/loculus/backend/controller/submission/RevokeEndpointTest.kt index f30209c17..06de30137 100644 --- a/backend/src/test/kotlin/org/loculus/backend/controller/submission/RevokeEndpointTest.kt +++ b/backend/src/test/kotlin/org/loculus/backend/controller/submission/RevokeEndpointTest.kt @@ -8,7 +8,12 @@ import org.loculus.backend.controller.DEFAULT_ORGANISM import org.loculus.backend.controller.DEFAULT_USER_NAME import org.loculus.backend.controller.EndpointTest import org.loculus.backend.controller.OTHER_ORGANISM +import org.loculus.backend.controller.SUPER_USER_NAME +import org.loculus.backend.controller.assertGroupIdIs +import org.loculus.backend.controller.assertHasError +import org.loculus.backend.controller.assertIsRevocationIs import org.loculus.backend.controller.assertStatusIs +import org.loculus.backend.controller.assertSubmitterIs import org.loculus.backend.controller.expectUnauthorizedResponse import org.loculus.backend.controller.generateJwtFor import org.loculus.backend.controller.jwtForSuperUser @@ -36,7 +41,7 @@ class RevokeEndpointTest( } @Test - fun `GIVEN entries with 'APPROVED_FOR_RELEASE' THEN returns revocation version in status AWAITING_APPROVAL`() { + fun `GIVEN entries with 'APPROVED_FOR_RELEASE' THEN returns revocation version in status PROCESSED`() { val accessions = convenienceClient.prepareDefaultSequenceEntriesToApprovedForRelease().map { it.accession } client.revokeSequenceEntries(accessions) @@ -46,8 +51,14 @@ class RevokeEndpointTest( .andExpect(jsonPath("\$[0].accession").value(accessions.first())) .andExpect(jsonPath("\$[0].version").value(2)) + val originalEntry = convenienceClient.getSequenceEntry(accession = accessions.first(), version = 1) + convenienceClient.getSequenceEntry(accession = accessions.first(), version = 2) .assertStatusIs(PROCESSED) + .assertHasError(false) + .assertGroupIdIs(originalEntry.groupId) + .assertIsRevocationIs(true) + .assertSubmitterIs(DEFAULT_USER_NAME) } @Test @@ -94,7 +105,7 @@ class RevokeEndpointTest( } @Test - fun `WHEN superuser revokes entries of other group THEN revocation version is created`() { + fun `WHEN superuser revokes entries of other group THEN superuser is submitter of revocation entry`() { val accessions = convenienceClient .prepareDefaultSequenceEntriesToApprovedForRelease(username = DEFAULT_USER_NAME) .map { it.accession } @@ -106,8 +117,14 @@ class RevokeEndpointTest( .andExpect(jsonPath("\$[0].accession").value(accessions.first())) .andExpect(jsonPath("\$[0].version").value(2)) + val originalEntry = convenienceClient.getSequenceEntry(accession = accessions.first(), version = 1) + convenienceClient.getSequenceEntry(accession = accessions.first(), version = 2) .assertStatusIs(PROCESSED) + .assertHasError(false) + .assertGroupIdIs(originalEntry.groupId) + .assertIsRevocationIs(true) + .assertSubmitterIs(SUPER_USER_NAME) } @Test diff --git a/docs/src/content/docs/reference/helm-chart-config.mdx b/docs/src/content/docs/reference/helm-chart-config.mdx index 03713a2c4..4b1f0d0c9 100644 --- a/docs/src/content/docs/reference/helm-chart-config.mdx +++ b/docs/src/content/docs/reference/helm-chart-config.mdx @@ -354,6 +354,12 @@ The configuration for the Helm chart is provided as a YAML file. It has the foll true If true, runs a development Keycloak database within the cluster. + + `developmentDatabasePersistence` + Boolean + true + If true, makes the database on the argocd preview persistent. + diff --git a/kubernetes/README.md b/kubernetes/README.md index d8f1eec73..273e1affe 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -35,7 +35,7 @@ We also recommend installing [k9s](https://k9scli.io/) to inspect cluster resour We deploy to kubernetes via the `../deploy.py` script. It requires you to have `pyyaml` and `requests` installed. -NOTE: On MacOS, make sure that you have configured enough RAM in Docker, we recommend 8GB. +NOTE: On MacOS, make sure that you have configured enough RAM in Docker, we recommend 8GB. ### Setup for local development @@ -124,11 +124,11 @@ Install the chart to deploy the services: ## Argo CD -ArgoCD will aim to build preview instances for any open PR with the `preview` label. It may take 5 minutes for an instance to appear. The preview will appear at `[branch_name].loculus.org`. Long branch names are shortened, and some special characters are not supported. You can find the exact URL in the ArgoCD UI: https://argocd.k3s.pathoplexus.org/ (login details are on [Slack](https://loculus.slack.com/archives/C05G172HL6L/p1698940904615039). +ArgoCD will aim to build preview instances for any open PR with the `preview` label. It may take 5 minutes for an instance to appear. The preview will appear at `[branch_name].loculus.org`. Long branch names are shortened, and some special characters are not supported. You can find the exact URL in the ArgoCD UI: https://argocd.k3s.pathoplexus.org/ (login details are on [Slack](https://loculus.slack.com/archives/C05G172HL6L/p1698940904615039)). -The preview is intended to simulate the full backend and associated containers. It may be necessary to update this directory when changes are made to how containers need to be deployed. +The preview is intended to simulate the full backend and associated containers. It may be necessary to update this directory when changes are made to how containers need to be deployed. It you would like to test your changes on a persistent DB add `developmentDatabasePersistence: true` to your `values.yaml`. -We do not currently support branch names containing underscores and other characters that can't go in domain names. +We do not currently support branch names containing characters that can't go in domain names with the exception of '/' and '\_' (see [kubernetes/appset.yaml](https://github.com/loculus-project/loculus/blob/main/kubernetes/appset.yaml) for details). ## Secrets diff --git a/kubernetes/appset.yaml b/kubernetes/appset.yaml index 4db23cae1..481f5c41b 100644 --- a/kubernetes/appset.yaml +++ b/kubernetes/appset.yaml @@ -6,46 +6,44 @@ metadata: namespace: argocd spec: generators: - - pullRequest: - github: - labels: - - preview - owner: loculus-project - repo: loculus - tokenRef: - key: token - secretName: github-access-token - requeueAfterSeconds: 60 - - git: - files: - - path: config.json - repoURL: https://github.com/loculus-project/argocd_metadata.git - revision: HEAD + - pullRequest: + github: + labels: + - preview + owner: loculus-project + repo: loculus + tokenRef: + key: token + secretName: github-access-token + requeueAfterSeconds: 60 + - git: + files: + - path: config.json + repoURL: https://github.com/loculus-project/argocd_metadata.git + revision: HEAD goTemplate: true template: metadata: - name: pp-{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }}-{{.number}} + name: pp-{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }}-{{.number}} spec: destination: - namespace: prev-{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }} + namespace: prev-{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }} server: https://kubernetes.default.svc project: default source: helm: parameters: - - name: shortbranch - value: '{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" - | trimSuffix "-" | lower }}' - - name: sha - value: '{{.head_short_sha_7}}' - - name: branch - value: '{{.branch}}' - - name: host - value: '{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" - | trimSuffix "-" | lower }}.loculus.org' + - name: shortbranch + value: '{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }}' + - name: sha + value: '{{.head_short_sha_7}}' + - name: branch + value: '{{.branch}}' + - name: host + value: '{{ (printf "%.25s" .branch) | replace "_" "-" | replace "/" "-" | trimSuffix "-" | lower }}.loculus.org' valueFiles: - - values.yaml - - values_preview_server.yaml + - values.yaml + - values_preview_server.yaml path: kubernetes/loculus/ repoURL: https://github.com/loculus-project/loculus.git targetRevision: '{{.branch}}' @@ -54,5 +52,5 @@ spec: prune: true selfHeal: true syncOptions: - - CreateNamespace=true - - ServerSideApply=true + - CreateNamespace=true + - ServerSideApply=true diff --git a/kubernetes/loculus/templates/keycloak-database-deployment.yaml b/kubernetes/loculus/templates/keycloak-database-standin.yaml similarity index 93% rename from kubernetes/loculus/templates/keycloak-database-deployment.yaml rename to kubernetes/loculus/templates/keycloak-database-standin.yaml index 309b2a92c..12b20f6b7 100644 --- a/kubernetes/loculus/templates/keycloak-database-deployment.yaml +++ b/kubernetes/loculus/templates/keycloak-database-standin.yaml @@ -41,6 +41,8 @@ spec: value: "keycloak" - name: POSTGRES_HOST_AUTH_METHOD value: "trust" + {{ if not .Values.developmentDatabasePersistence }} - name: LOCULUS_VERSION value: {{ $dockerTag }} + {{- end }} {{- end }} diff --git a/kubernetes/loculus/templates/loculus-database-standin.yaml b/kubernetes/loculus/templates/loculus-database-standin.yaml index 452930d62..bc3ffdc8f 100644 --- a/kubernetes/loculus/templates/loculus-database-standin.yaml +++ b/kubernetes/loculus/templates/loculus-database-standin.yaml @@ -40,6 +40,8 @@ spec: value: "loculus" - name: POSTGRES_HOST_AUTH_METHOD value: "trust" + {{ if not .Values.developmentDatabasePersistence }} - name: LOCULUS_VERSION value: {{ $dockerTag }} + {{- end }} {{- end }} diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index a3bd6905d..e0bba1cc1 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1530,6 +1530,7 @@ secrets: password: "dummy" runDevelopmentKeycloakDatabase: true runDevelopmentMainDatabase: true +developmentDatabasePersistence: false enforceHTTPS: true registrationTermsMessage: > You must agree to the terms of use.