Skip to content

Commit

Permalink
ci: Fix Docker setup for Travis CI (ibmdb#492)
Browse files Browse the repository at this point in the history
Switch from ibmcom/db2express-c to ibmcom/db2 docker images and adjust
the setup commands according to the Quick Start guide at
https://hub.docker.com/r/ibmcom/db2.

Because we now need to wait for Db2 to be initialized, the setup
commands were moved from .travis.yml to scripts/setup-docker.sh.

Fixes: ibmdb#449
Fixes: ibmdb#485
Co-Authored-By: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
  • Loading branch information
kadler and cclauss authored Mar 27, 2020
1 parent 2eb86da commit e8ff13e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
os: linux
dist: bionic
language: python
python:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
services:
- docker

before_install:
- pip install --upgrade pip
- pip install flake8 # find Python syntax errors and undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
install:
- docker pull ibmcom/db2express-c
- docker run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=password -e LICENSE=accept -d ibmcom/db2express-c db2start
- docker ps -as
- docker exec -it db2 useradd -ms /bin/bash auth_user -p auth_pass
- docker exec -it db2 su - db2inst1 -c "db2 create db sample"
- scripts/setup-docker.sh

script:
- cd IBM_DB/ibm_db
Expand Down
19 changes: 19 additions & 0 deletions scripts/setup-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -x -e -u -o pipefail

docker pull ibmcom/db2
docker run --name db2 -itd --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=password -e DBNAME=sample -v $HOME/database:/database ibmcom/db2
docker ps -as
docker exec -it db2 useradd -ms /bin/bash auth_user -p auth_pass

while true
do
if (docker logs db2 | grep 'Setup has completed')
then
break
fi

sleep 20
done

0 comments on commit e8ff13e

Please sign in to comment.