Skip to content

Commit

Permalink
devops: have generate random minio credentials (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Oct 18, 2024
1 parent 6584311 commit e104371
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- name: Generate K8 files
run: |
version="$(bash .github/workflows/determine_docker_image_tag.sh)"
export MINIO_ROOT_USER="minioadmin"
export MINIO_ROOT_PASSWORD=$(openssl rand -base64 32)
bash k8/generate.sh $version
env:
WORKER_COUNT: 1
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ git clone https://github.com/mxschmitt/try-playwright.git
openssl req -x509 -nodes -days 730 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=try.playwright.tech/O=try.playwright.tech"
kubectl create secret tls try-playwright-cf-tls-cert --key=tls.key --cert=tls.crt
cd try-playwright
export MINIO_ROOT_USER="admin"
export MINIO_ROOT_PASSWORD=$(openssl rand -base64 32)
bash k8/generate.sh
kubectl apply -f k8/
```
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config = defineConfig({
testDir: path.join(__dirname, 'tests'),
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : undefined,
reporter: 'html',
reporter: [['list'], ['html']],
workers: 1,
use: {
trace: process.env.CI ? 'on-all-retries' : undefined,
Expand Down
4 changes: 2 additions & 2 deletions k8/file-deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ spec:
- name: MINIO_ENDPOINT
value: minio:9000
- name: MINIO_ACCESS_KEY
value: "minio"
value: "${MINIO_ROOT_USER}"
- name: MINIO_SECRET_KEY
value: "R9gGSFb4QkZH8LzzS8SECsG66JNX"
value: "${MINIO_ROOT_PASSWORD}"
- name: FILE_SERVICE_SENTRY_DSN
value: https://[email protected]/5479804
image: ghcr.io/mxschmitt/try-playwright/file-service:${DOCKER_TAG}
Expand Down
4 changes: 4 additions & 0 deletions k8/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
export DOCKER_TAG="${1:-latest}"
export WORKER_COUNT="${WORKER_COUNT:-2}"

# Validate required environment variables
: "${MINIO_ROOT_USER:?Need to set MINIO_ROOT_USER}"
: "${MINIO_ROOT_PASSWORD:?Need to set MINIO_ROOT_PASSWORD}"

for file_path in k8/*.yaml.tpl; do
filename="$(basename ${file_path})"
outname="k8/generated-${filename/%.yaml.tpl/.yaml}"
Expand Down
4 changes: 2 additions & 2 deletions k8/minio-deployment.yaml → k8/minio-deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
name: minio
env:
- name: MINIO_ROOT_USER
value: "minio"
value: "${MINIO_ROOT_USER}"
- name: MINIO_ROOT_PASSWORD
value: "R9gGSFb4QkZH8LzzS8SECsG66JNX"
value: "${MINIO_ROOT_PASSWORD}"
restartPolicy: Always

0 comments on commit e104371

Please sign in to comment.