Skip to content

Commit

Permalink
chore: prepare 2.49.0 (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
jachro authored Jan 16, 2024
2 parents 63ee55f + ff13c78 commit 1e5b5b5
Show file tree
Hide file tree
Showing 2,089 changed files with 20,692 additions and 23,481 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/acceptance-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
extra-values: ${{ steps.deploy-comment.outputs.extra-values}}
steps:
- id: deploy-comment
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.8.5
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.9.0
with:
string: /deploy
pr_ref: ${{ github.event.number }}
Expand All @@ -42,7 +42,7 @@ jobs:
name: renku-ci-gr-${{ github.event.number }}
steps:
- name: deploy-pr
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.8.5
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.9.0
env:
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
needs: [check-deploy, deploy-pr]
steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.8.5
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.9.0
with:
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
renku-release: renku-ci-gr-${{ github.event.number }}
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
steps:
- name: Extract Renku repository reference
run: echo "RENKU_REFERENCE=`echo '${{ needs.check-deploy.outputs.renku }}' | cut -d'@' -f2`" >> $GITHUB_ENV
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.8.5
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.9.0
with:
e2e-target: ${{ matrix.tests }}
renku-reference: ${{ env.RENKU_REFERENCE }}
Expand All @@ -128,7 +128,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: renku teardown
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.8.5
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.9.0
env:
HELM_RELEASE_REGEX: "^renku-ci-gr-${{ github.event.number }}$"
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ jobs:
environment:
name: renku-kg-dev
steps:
- name: deploy-development
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.8.5
- name: Deploy to renku-kg-dev
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.9.0
env:
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
Expand All @@ -125,7 +125,7 @@ jobs:
runs-on: ubuntu-20.04
needs: deploy-to-graph
steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.8.5
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.9.0
with:
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
renku-release: renku-kg-dev
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ jobs:
echo "GIT_USER=Renku Bot" >> $GITHUB_ENV
echo "[email protected]" >> $GITHUB_ENV
- name: Build and push images and chart
uses: SwissDataScienceCenter/renku-actions/publish-chartpress-images@v1.8.5
uses: SwissDataScienceCenter/renku-actions/publish-chartpress-images@v1.9.0
env:
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
- name: Update component version
uses: SwissDataScienceCenter/renku-actions/update-component-version@v1.8.5
uses: SwissDataScienceCenter/renku-actions/update-component-version@v1.9.0
env:
COMPONENT_NAME: renku-graph
GITHUB_TOKEN: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "3.7.17"

runner.dialect = "scala213"
runner.dialect = scala213

maxColumn = 120
assumeStandardLibraryStripMargin = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down Expand Up @@ -30,9 +30,10 @@ import io.renku.graph.acceptancetests.tooling.{AcceptanceSpec, ApplicationServic
import io.renku.graph.model.EventsGenerators.commitIds
import io.renku.graph.model.projects.Role
import io.renku.graph.model.testentities._
import io.renku.http.RenkuEntityCodec
import io.renku.http.client.AccessToken
import io.renku.http.rest.Links
import io.renku.http.server.EndpointTester.{JsonOps, jsonEntityDecoder}
import io.renku.http.server.EndpointTester.JsonOps
import org.http4s.Status._
import org.scalatest.EitherValues

Expand All @@ -44,6 +45,7 @@ class CommitHistoryChangesSpec
with ApplicationServices
with TSProvisioning
with DatasetsApiEncoders
with RenkuEntityCodec
with EitherValues {

private val user = authUsers.generateOne
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down Expand Up @@ -49,14 +49,14 @@ class ProjectStatusResourceSpec

Feature("Project Status API for a given project") {

val memberUser = authUsers.generateOne
val project =
dataProjects(renkuProjectEntities(visibilityPublic, creatorGen = cliShapedPersons).modify(removeMembers()),
CommitsCount(numberOfEvents.value)
).map(addMemberWithId(memberUser.id, Role.Owner)).generateOne

Scenario("Call by a user who is not a member of the project") {

val memberUser = authUsers.generateOne
val project =
dataProjects(renkuProjectEntities(visibilityPublic, creatorGen = cliShapedPersons).modify(removeMembers()),
CommitsCount(numberOfEvents.value)
).map(addMemberWithId(memberUser.id, Role.Owner)).generateOne

Given("there's no webhook for a given project in GitLab")
gitLabStub.addProject(project)

Expand Down Expand Up @@ -90,6 +90,12 @@ class ProjectStatusResourceSpec

Scenario("Call by a user who is a member of the project") {

val memberUser = authUsers.generateOne
val project =
dataProjects(renkuProjectEntities(visibilityPublic, creatorGen = cliShapedPersons).modify(removeMembers()),
CommitsCount(numberOfEvents.value)
).map(addMemberWithId(memberUser.id, Role.Owner)).generateOne

When("there's no webhook for a given project in GitLab")
gitLabStub.addProject(project)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand Down Expand Up @@ -118,10 +118,9 @@ object EventLog extends TypeSerializers {
session.prepare(command).flatMap(_.execute(projectId)).void
}

def startDB()(implicit logger: Logger[IO]): IO[Unit] = for {
_ <- PostgresDB.startPostgres
def initDB()(implicit logger: Logger[IO]): IO[Unit] = for {
_ <- PostgresDB.initializeDatabase(dbConfig)
_ <- logger.info("event_log DB started")
_ <- logger.info("event_log DB initialised")
} yield ()

private lazy val sessionResource: Resource[IO, SessionResource[IO, EventLogDB]] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Swiss Data Science Center (SDSC)
* Copyright 2024 Swiss Data Science Center (SDSC)
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
* Eidgenössische Technische Hochschule Zürich (ETHZ).
*
Expand All @@ -19,82 +19,27 @@
package io.renku.graph.acceptancetests.db

import cats.effect._
import com.dimafeng.testcontainers.FixedHostPortGenericContainer
import cats.syntax.all._
import eu.timepit.refined.auto._
import io.renku.db.DBConfigProvider.DBConfig
import io.renku.db.{PostgresContainer, SessionResource}
import skunk.codec.all._
import skunk.implicits._
import skunk._
import io.renku.db.{PostgresServer, SessionResource}
import natchez.Trace.Implicits.noop
import org.typelevel.log4cats.Logger
import scala.concurrent.duration._
import skunk._
import skunk.codec.all.bool
import skunk.implicits._

object PostgresDB {
private[this] val starting: Ref[IO, Boolean] = Ref.unsafe[IO, Boolean](false)

private val dbConfig = DBConfig[Any](
host = "localhost",
port = 5432,
name = "postgres",
user = "at",
pass = "at",
connectionPool = 8
)
private lazy val server = PostgresServer
private lazy val dbConfig = server.dbConfig

private val postgresContainer = {
val cfg = dbConfig
FixedHostPortGenericContainer(
imageName = PostgresContainer.image,
env = Map(
"POSTGRES_USER" -> cfg.user.value,
"POSTGRES_PASSWORD" -> cfg.pass.value
),
exposedPorts = Seq(cfg.port.value),
exposedHostPort = cfg.port.value,
exposedContainerPort = cfg.port.value,
command = Seq(s"-p ${cfg.port.value}")
)
}

def startPostgres(implicit L: Logger[IO]) =
starting.getAndUpdate(_ => true).flatMap {
case false =>
IO.unlessA(postgresContainer.container.isRunning)(
IO(postgresContainer.start()) *> waitForPostgres *> L.info(
"PostgreSQL database started"
)
)

case true =>
waitForPostgres
}

private def waitForPostgres =
fs2.Stream
.awakeDelay[IO](0.5.seconds)
.evalMap { _ =>
Session
.single[IO](
host = dbConfig.host,
port = dbConfig.port,
user = dbConfig.user.value,
password = Some(dbConfig.pass.value),
database = dbConfig.name.value
)
.use(_.unique(sql"SELECT 1".query(int4)))
.attempt
}
.map(_.fold(_ => 1, _ => 0))
.take(100)
.find(_ == 0)
.compile
.drain
def start(): IO[Unit] =
IO(server.start())

def sessionPool(dbCfg: DBConfig[_]): Resource[IO, Resource[IO, Session[IO]]] =
Session
.pooled[IO](
host = postgresContainer.host,
host = dbCfg.host.value,
port = dbConfig.port.value,
database = dbCfg.name.value,
user = dbCfg.user.value,
Expand All @@ -117,15 +62,21 @@ object PostgresDB {
// note: it would be simpler to use the default user that is created with the container, but that requires
// to first refactor how the configuration is loaded. Currently services load it from the file every time and so
// this creates the users as expected from the given config
val roleExists: Query[Void, Boolean] =
sql"SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname = '#${cfg.user.value}')".query(bool)
val createRole: Command[Void] =
sql"create role #${cfg.user.value} with password '#${cfg.pass.value}' superuser login".command
val createDatabase: Command[Void] = sql"create database #${cfg.name.value}".command
val grants: Command[Void] = sql"grant all on database #${cfg.name.value} to #${cfg.user.value}".command

session.use { s =>
s.execute(createRole) *>
s.execute(createDatabase) *>
s.execute(grants)
s.unique(roleExists) >>= {
case true => ().pure[IO]
case false =>
s.execute(createRole) *>
s.execute(createDatabase) *>
s.execute(grants)
}
}.void
}
}
Loading

0 comments on commit 1e5b5b5

Please sign in to comment.