Skip to content

Commit

Permalink
hardcode db password in CI to allow tests from third parties (#1729)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Sep 1, 2022
1 parent ea40ffd commit c4652d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/bats-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
database_image:
required: true
type: string
secrets:
DATABASE_PASSWORD:
required: true

env:
PREFIX_TEST_NAMES_WITH_FILE: true
Expand All @@ -23,7 +20,7 @@ jobs:
database:
image: ${{ inputs.database_image }}
env:
MYSQL_ROOT_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
MYSQL_ROOT_PASSWORD: "secret"
ports:
- 3306:3306

Expand Down Expand Up @@ -61,7 +58,7 @@ jobs:
DB_BACKEND: mysql
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
MYSQL_PASSWORD: "secret"
MYSQL_USER: root

- name: "Run tests"
Expand All @@ -70,7 +67,7 @@ jobs:
DB_BACKEND: mysql
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
MYSQL_PASSWORD: "secret"
MYSQL_USER: root

#
Expand All @@ -85,7 +82,7 @@ jobs:
DB_BACKEND: mysql
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
MYSQL_PASSWORD: "secret"
MYSQL_USER: root
if: ${{ always() }}

Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/bats-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Functional tests (Postgres)

on:
workflow_call:
secrets:
DATABASE_PASSWORD:
required: true

env:
PREFIX_TEST_NAMES_WITH_FILE: true
Expand All @@ -19,7 +16,7 @@ jobs:
database:
image: postgres:latest
env:
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
POSTGRES_PASSWORD: "secret"
ports:
- 5432:5432
options: >-
Expand Down Expand Up @@ -62,7 +59,7 @@ jobs:
DB_BACKEND: pgx
PGHOST: 127.0.0.1
PGPORT: 5432
PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PGPASSWORD: "secret"
PGUSER: postgres

- name: "Run tests (DB_BACKEND: pgx)"
Expand All @@ -71,7 +68,7 @@ jobs:
DB_BACKEND: pgx
PGHOST: 127.0.0.1
PGPORT: 5432
PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PGPASSWORD: "secret"
PGUSER: postgres

- name: "Build crowdsec and fixture (DB_BACKEND: postgres)"
Expand All @@ -80,7 +77,7 @@ jobs:
DB_BACKEND: postgres
PGHOST: 127.0.0.1
PGPORT: 5432
PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PGPASSWORD: "secret"
PGUSER: postgres

- name: "Run tests (DB_BACKEND: postgres)"
Expand All @@ -89,7 +86,7 @@ jobs:
DB_BACKEND: postgres
PGHOST: 127.0.0.1
PGPORT: 5432
PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }}
PGPASSWORD: "secret"
PGUSER: postgres

- name: "Show crowdsec logs"
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/bats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,14 @@ jobs:
uses: ./.github/workflows/bats-mysql.yml
with:
database_image: mariadb:latest
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}

mysql:
uses: ./.github/workflows/bats-mysql.yml
with:
database_image: mysql:latest
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}

postgres:
uses: ./.github/workflows/bats-postgres.yml
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}

hub:
uses: ./.github/workflows/bats-hub.yml
Expand Down

0 comments on commit c4652d6

Please sign in to comment.