Skip to content

Commit

Permalink
Merge branch 'master' into auto-update/renku-notebooks-1.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olevski authored Sep 25, 2023
2 parents 9fe6e94 + 21cbfb5 commit 028d3a5
Show file tree
Hide file tree
Showing 38 changed files with 113 additions and 999 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/cron-jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Cron jobs

on:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
workflow_dispatch:

jobs:
remove-CI-deployments:
runs-on: ubuntu-22.04
steps:
- name: renku teardown
uses: SwissDataScienceCenter/renku-actions/[email protected]
env:
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
MAX_AGE_SECONDS: 604800
DELETE_NAMESPACE: "false"
4 changes: 2 additions & 2 deletions .github/workflows/publish-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set version
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- uses: SwissDataScienceCenter/renku-actions/publish-chart@v1.5.2
- uses: SwissDataScienceCenter/renku-actions/publish-chart@v1.6.0
env:
CHART_DIR: helm-chart/
CHART_NAME: renku
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
with:
fetch-depth: 0
- name: Rollout renku version
uses: SwissDataScienceCenter/renku-actions/rollout-renku-version@v1.5.2
uses: SwissDataScienceCenter/renku-actions/rollout-renku-version@v1.6.0
env:
CHART_VERSION: ${{ needs.publish-chart.outputs.chart-version }}
GITHUB_TOKEN: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-master-merges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- id: set-version
run: |
echo "publish_version=${{ steps.bump-semver.outputs.new_version }}.$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV
- uses: SwissDataScienceCenter/renku-actions/publish-chart@v1.5.2
- uses: SwissDataScienceCenter/renku-actions/publish-chart@v1.6.0
env:
CHART_DIR: helm-chart/
CHART_TAG: "--tag ${{env.publish_version}}"
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/pull-request-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ jobs:
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks}}
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui}}
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled}}
test-cypress-enabled: ${{ steps.deploy-comment.outputs.test-cypress-enabled}}
extra-values: ${{ steps.deploy-comment.outputs.extra-values}}
persist: ${{ steps.deploy-comment.outputs.persist }}
steps:
- uses: actions/checkout@v4
- id: deploy-comment
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.5.2
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.6.0
with:
string: /deploy
pr_ref: ${{ github.event.number }}
Expand All @@ -74,7 +72,7 @@ jobs:
- uses: actions/checkout@v4
- name: renku build and deploy
if: needs.check-deploy.outputs.pr-contains-string == 'true'
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.5.2
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.6.0
env:
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
Expand Down Expand Up @@ -111,27 +109,21 @@ jobs:
You can access the deployment of this PR at https://ci-renku-${{ github.event.number }}.dev.renku.ch
test-pr:
if: ${{ github.event.action != 'closed' &&
needs.check-deploy.outputs.pr-contains-string == 'true' &&
needs.check-deploy.outputs.test-enabled == 'true' }}
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]
runs-on: ubuntu-22.04
steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.5.2
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.6.0
with:
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
renku-release: ci-renku-${{ github.event.number }}
gitlab-token: ${{ secrets.DEV_GITLAB_TOKEN }}
persist: "${{ needs.check-deploy.outputs.persist }}"
s3-results-access-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_ACCESS_KEY }}
s3-results-secret-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_SECRET_KEY }}
test-timeout-mins: "120"

test-pr-cypress:
if: ${{ github.event.action != 'closed' &&
needs.check-deploy.outputs.pr-contains-string == 'true' &&
(needs.check-deploy.outputs.test-enabled == 'true' ||
needs.check-deploy.outputs.test-cypress-enabled == 'true') }}
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]
runs-on: ubuntu-22.04

Expand All @@ -150,7 +142,7 @@ jobs:
]

steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.5.2
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.6.0
with:
e2e-target: ${{ matrix.tests }}
renku-reference: ${{ github.ref }}
Expand All @@ -162,7 +154,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: renku teardown
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.5.2
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.6.0
env:
HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$"
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/remove-old-artifacts.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/renku-dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ jobs:
github.event.client_payload.message == 'Helm test succeeded' }}
runs-on: ubuntu-20.04
steps:
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.5.2
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.6.0
with:
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
renku-release: renku
gitlab-token: ${{ secrets.DEV_GITLAB_TOKEN }}
persist: true
s3-results-access-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_ACCESS_KEY }}
s3-results-secret-key: ${{ secrets.ACCEPTANCE_TESTS_BUCKET_SECRET_KEY }}
test-timeout-mins: "80"
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ libraryDependencies += "eu.timepit" %% "refined" %
libraryDependencies += "io.circe" %% "circe-core" % circeVersion % Test
libraryDependencies += "io.circe" %% "circe-literal" % circeVersion % Test
libraryDependencies += "io.circe" %% "circe-parser" % circeVersion % Test
libraryDependencies += "io.circe" %% "circe-optics" % "0.14.1" % Test
libraryDependencies += "io.circe" %% "circe-optics" % "0.15.0" % Test
libraryDependencies += "org.http4s" %% "http4s-blaze-client" % "0.23.15" % Test
libraryDependencies += "org.http4s" %% "http4s-circe" % "0.23.23" % Test
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.17.0" % Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package ch.renku.acceptancetests

import ch.renku.acceptancetests.tooling.TestLogger.logger
import ch.renku.acceptancetests.tooling.{AcceptanceSpec, KnowledgeGraphApi}
import ch.renku.acceptancetests.workflows._

Expand All @@ -36,6 +37,8 @@ import scala.util.matching.Regex
*/
class BatchProjectRemovalSpec extends AcceptanceSpec with Login with RemoveProject with KnowledgeGraphApi {

private val gracePeriod = JDuration.ofDays(7)

scenario("User can delete many projects project") {

if (batchRemoveConfig.batchRemove) `login and remove projects`
Expand All @@ -46,26 +49,34 @@ class BatchProjectRemovalSpec extends AcceptanceSpec with Login with RemoveProje

`log in to Renku`

`find and remove projects`
val summary = `find and remove projects`

logger.info(s"Removing summary: $summary")

`log out of Renku`
}

private def `find and remove projects`: Unit =
`get user's projects from GitLab` foreach { case ProjectInfo(_, path, fullPath, created) =>
Given(s"project $path found")

val days = JDuration.ofDays(7)
if (batchRemoveConfig.patterns.exists(_ matches path) && (created < Instant.now().minus(days))) {
And(s"the project matches the removal pattern and it's older than ${days.toDays} days")
Then("the project is removed")
`DELETE /knowledge-graph/projects/:slug`(fullPath)
} else {
And(s"the project doesn't match the removal pattern or it's not older than ${days.toDays} days")
Then("project is left untouched")
}
private def `find and remove projects` =
`get user's projects from GitLab`.foldLeft(Summary.empty) {
case (summary, ProjectInfo(_, path, fullPath, created)) =>
if (batchRemoveConfig.patterns.exists(_ matches path) && (created < Instant.now().minus(gracePeriod))) {
logger.info(s"Removing '$path' - the removal pattern matched and it's older than ${gracePeriod.toDays} days")
`DELETE /knowledge-graph/projects/:slug`(fullPath)
summary.incrementRemoved()
} else
summary.incrementFound()
}

private case class Summary(found: Int, removed: Int) {
def incrementFound(): Summary = copy(found = found + 1)
def incrementRemoved(): Summary = incrementFound().copy(removed = removed + 1)

override lazy val toString = s"found: $found, removed: $removed"
}
private object Summary {
val empty: Summary = Summary(0, 0)
}

private case class BatchRemoveConfig(batchRemove: Boolean, patterns: List[Regex])

private lazy val batchRemoveConfig: BatchRemoveConfig = {
Expand All @@ -78,7 +89,8 @@ class BatchProjectRemovalSpec extends AcceptanceSpec with Login with RemoveProje

val defaultPatterns = List(
"test-(\\d{4})-(\\d+)-(\\d+)-(\\d+)-(\\d+)-(\\d+).*",
"test-session-.*"
"test-session-.*",
"cypress-.*"
)

val projectNamePatterns = Option(getProperty("remPattern"))
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 028d3a5

Please sign in to comment.