Skip to content

Commit

Permalink
[db-test] Take DB init scripts from installer
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed May 9, 2022
1 parent fed5a66 commit a3044a9
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/gitpod-db/BUILD.yaml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ packages:
- package.json
deps:
- :migrations
- chart/config/db/init:init-scripts
- install/installer/pkg/components/database/incluster/init:init-scripts
env:
- DB_HOST=127.0.0.1
- DB_PORT=23306
@@ -62,7 +62,7 @@ packages:
# Re-use of the instance because of the init scripts (cmp. next step).
- ["sh", "-c", "mysqladmin ping -h \"$DB_HOST\" \"$DB_PORT\" -p$DB_PASSWORD -u $DB_USER --silent || (docker run -d -e MYSQL_ROOT_PASSWORD=$DB_PASSWORD -e MYSQL_TCP_PORT=$DB_PORT -p $DB_PORT:$DB_PORT mysql:5.7; while ! mysqladmin ping -h \"$DB_HOST\" -P \"$DB_PORT\" -p$DB_PASSWORD -u $DB_USER --silent; do echo \"waiting for DB...\"; sleep 2; done)"]
# Apply the DB initialization scripts (re-creates the "gitpod" DB if already there)
- ["sh", "-c", "find chart-config-db-init--init-scripts -name \"*.sql\" | sort | xargs cat | mysql -h \"$DB_HOST\" -P \"$DB_PORT\" -p$DB_PASSWORD -u $DB_USER"]
- ["sh", "-c", "find install-installer-pkg-components-database-incluster-init--init-scripts -name \"*.sql\" | sort | xargs cat | mysql -h \"$DB_HOST\" -P \"$DB_PORT\" -p$DB_PASSWORD -u $DB_USER"]
# Run DB migrations
- ["sh", "-c", "mkdir -p mig; cd mig; ../components-gitpod-db--migrations/install.sh"]
# migrate 'migrations'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
- name: init-scripts
type: generic
srcs:
- "*.sql"
config:
comamnds:
- ["echo"]

0 comments on commit a3044a9

Please sign in to comment.