From cc92d0d19b4083f946ca6bcd9c00c5ca568955d4 Mon Sep 17 00:00:00 2001 From: Edouard Benauw Date: Tue, 9 Aug 2022 10:37:23 +0200 Subject: [PATCH] Add support for Azure Blob Storage (#149) --- charts/sorry-cypress/Chart.yaml | 2 +- charts/sorry-cypress/README.md | 21 +++++++++++++++---- charts/sorry-cypress/changelog.md | 3 +++ charts/sorry-cypress/templates/_helpers.tpl | 8 +++++++ .../templates/deployment-director.yml | 11 ++++++++++ charts/sorry-cypress/values.yaml | 6 ++++++ 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/charts/sorry-cypress/Chart.yaml b/charts/sorry-cypress/Chart.yaml index 031d086..a70a978 100644 --- a/charts/sorry-cypress/Chart.yaml +++ b/charts/sorry-cypress/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sorry-cypress description: A Helm chart for Sorry Cypress type: application -version: 1.6.5 +version: 1.7.0 appVersion: 2.2.1 home: https://sorry-cypress.dev/ sources: diff --git a/charts/sorry-cypress/README.md b/charts/sorry-cypress/README.md index 17a0012..853d395 100644 --- a/charts/sorry-cypress/README.md +++ b/charts/sorry-cypress/README.md @@ -135,7 +135,7 @@ https://sorry-cypress.dev/director/configuration | `director.environmentVariables.allowedKeys` | Define the list of comma delimited record keys (provided to the Cypress Runner using `--key` option). Empty or not provided variable means that all record keys are allowed. | `""` | | `director.environmentVariables.dashboardUrl` | The "Run URL" in the Cypress client | `""` | | `director.environmentVariables.executionDriver` | Set the execution driver. Valid options are `"../execution/in-memory"` and `"../execution/mongo/driver"` | `"../execution/in-memory"` | -| `director.environmentVariables.screenshotsDriver` | Set the screenshots driver. Valid options are `"../screenshots/dummy.driver"` and `"../screenshots/s3.driver"` | `"../screenshots/dummy.driver"` | +| `director.environmentVariables.screenshotsDriver` | Set the screenshots driver. Valid options are `"../screenshots/dummy.driver"`, `"../screenshots/s3.driver"`, `"../screenshots/minio.driver"` or `"../screenshots/azure-blob-storage.driver"` | `"../screenshots/dummy.driver"` | | `director.environmentVariables.inactivityTimeoutSeconds` | Set the timeout of all test runs under your projects. | `180s` | | `director.podAnnotations` | Set annotations for pods | `{}` | | `director.podLabels` | Set additional labels for pods | `{}` | @@ -177,10 +177,12 @@ All other mongodb options are defined in [the Bitnami mongo db helm chart](https ### Screenshots And Videos For saving screenshot you need to configure screenshots driver. -Currently only S3 and MinIO supported and for s3 you should use `"../screenshots/s3.driver"`. +Currently, only S3, MinIO and Azure Blob Storage are supported (See `director.environmentVariables.screenshotsDriver`) https://sorry-cypress.dev/director/storage ## S3 +To use S3 you should use `"../screenshots/minio.driver"` as your screenshot driver. +https://docs.sorry-cypress.dev/configuration/director-configuration/aws-s3-configuration | Parameter | Description | Default | | ----------------------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------- | @@ -218,8 +220,8 @@ See https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accou ### MinIO We use MinIO As subchart, so you can also add other variables from [minio chart](https://github.com/minio/charts/tree/master/minio). -Currently only S3 and MinIO supported and for MinIO you should use `"../screenshots/minio.driver"`. -https://sorry-cypress.dev/director/storage +To use MinIO you should use `"../screenshots/minio.driver"` as your screenshot driver. +https://docs.sorry-cypress.dev/configuration/director-configuration/minio-configuration | Parameter | Description | Default | | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | | `minio.enabled` | If enabled, it will deploy the internal MinIO service. | `false` | @@ -228,6 +230,17 @@ https://sorry-cypress.dev/director/storage | `minio.defaultBucket.enabled` | Creates bucket when MinIO installed | `true` | | `minio.defaultBucket.name` | The name of the bucket in MinIO that Sorry Cypress should use | `sorry-cypress` | | `minio.persistence.size` | Size of persistent volume claim of MinIO | `10Gi` | +| `minio.readUrlPrefix` | Override the URL whih will be used to read files from MinIO | `""` | + +### Azure Blob Storage +To use Azure Blob Storage you should use `"../screenshots/azure-blob-storage.driver"` as your screenshot driver. + +| Parameter | Description | Default | +| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | +| `azureBlobStorage.containerName` | The name of the container in Azure Blob Storage that Sorry Cypress should use | `sorry-cypress` | +| `azureBlobStorage.uploadUrlExpiryInHours` | How long the signed url used for upload will stay valid | `24` | +| `azureBlobStorage.existingSecret` | Override the name of the secret which contain the azure connexion string | `""` | +| `azureBlobStorage.fullNameOverride` | Allows you to override the full name | `""` | ### Sorry Cypress Run Cleaner diff --git a/charts/sorry-cypress/changelog.md b/charts/sorry-cypress/changelog.md index 58267c1..54831e7 100644 --- a/charts/sorry-cypress/changelog.md +++ b/charts/sorry-cypress/changelog.md @@ -1,3 +1,6 @@ +# 1.7.0 +Add Azure Blob Storage support + # 1.6.5 Add `minio.readUrlPrefix` value to be able to override the whole read URL to MinIO. diff --git a/charts/sorry-cypress/templates/_helpers.tpl b/charts/sorry-cypress/templates/_helpers.tpl index 0bb7411..3f268ca 100644 --- a/charts/sorry-cypress/templates/_helpers.tpl +++ b/charts/sorry-cypress/templates/_helpers.tpl @@ -114,3 +114,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- printf "%s-%s" .Release.Name "minio" | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} + +{{- define "sorry-cypress.azureBlobStorage.fullname" -}} +{{- if .Values.azureBlobStorage.fullnameOverride -}} +{{- .Values.azureBlobStorage.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name "azure-blob-storage" | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} diff --git a/charts/sorry-cypress/templates/deployment-director.yml b/charts/sorry-cypress/templates/deployment-director.yml index a22165f..6610f07 100644 --- a/charts/sorry-cypress/templates/deployment-director.yml +++ b/charts/sorry-cypress/templates/deployment-director.yml @@ -92,6 +92,17 @@ spec: key: AWS_SECRET_ACCESS_KEY {{- end }} {{- end }} + {{- if and (not .Values.minio.enabled) (eq .Values.director.environmentVariables.screenshotsDriver "../screenshots/azure-blob-storage.driver") }} + - name: AZURE_CONTAINER_NAME + value: {{ .Values.azureBlobStorage.containerName }} + - name: AZURE_UPLOAD_URL_EXPIRY_IN_HOURS + value: {{ .Values.azureBlobStorage.uploadUrlExpiryInHours }} + - name: AZURE_CONNEXION_STRING + valueFrom: + secretKeyRef: + name: {{ default (include "sorry-cypress.azureBlobStorage.fullname" .) .Values.azureBlobStorage.existingSecret }} + key: "connexionstring" + {{- end }} {{- if and (.Values.minio.enabled) (eq .Values.director.environmentVariables.screenshotsDriver "../screenshots/minio.driver") }} - name: MINIO_BUCKET value: {{ .Values.minio.defaultBucket.name }} diff --git a/charts/sorry-cypress/values.yaml b/charts/sorry-cypress/values.yaml index dbc5958..3752ef1 100644 --- a/charts/sorry-cypress/values.yaml +++ b/charts/sorry-cypress/values.yaml @@ -381,6 +381,12 @@ minio: persistence: size: 10Gi +azureBlobStorage: + containerName: sorry-cypress + uploadUrlExpiryInHours: 24 + existingSecret: '' + fullnameOverride: '' + runCleaner: # Optionally integrate the Sorry Cypress Run Cleaner to remove old runs from the database. # You will need to set up your S3/Minio lifecycle management to delete objects from your bucket.