Skip to content

Commit

Permalink
Add support for Azure Blob Storage (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackatosh authored Aug 9, 2022
1 parent f71df1b commit cc92d0d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/sorry-cypress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 17 additions & 4 deletions charts/sorry-cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `{}` |
Expand Down Expand Up @@ -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 |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------- |
Expand Down Expand Up @@ -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` |
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions charts/sorry-cypress/changelog.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
8 changes: 8 additions & 0 deletions charts/sorry-cypress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
11 changes: 11 additions & 0 deletions charts/sorry-cypress/templates/deployment-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 6 additions & 0 deletions charts/sorry-cypress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cc92d0d

Please sign in to comment.