-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
87 lines (81 loc) · 2.45 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
variables:
POSTGRES_DB: nice_marmot
POSTGRES_USER: runner
POSTGRES_PASSWORD: runner
POSTGRES_HOST_AUTH_METHOD: trust
ARTIFACT_TARGET: /tmp/artifacts
REGUSER: runner
SUPERUSER: runner
PGPORT: 5432
MAHOUTHOME: /builds/cbbrowne/mahout
PGCMPHOME: /builds/cbbrowne/mahout/pgcmp
PGBINDIR: /usr/bin
PG_CONTAINER: $CI_REGISTRY_IMAGE/my-custom-postgres:latest
PG_HOST: registry.gitlab.com-cbbrowne-pgcmp-my-custom-postgres
services:
- name: $PG_CONTAINER
alias: $PG_HOST
- name: docker:19.03.1-dind
stages:
- builddocker
- build
- test
- release
- deploy
builddocker:
image: docker:19.03.1
stage: builddocker
services:
- docker:19.03.1-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $PG_CONTAINER docker
- docker push $PG_CONTAINER
build-pgcmp:
stage: build
script:
- gem install org-ruby
- make all
connect-test:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $PG_CONTAINER
stage: test
image: docker:19.03.1
services:
- docker:19.03.1-dind
- $PG_CONTAINER
- $PG_HOST
script:
- apk add postgresql-client
- export PGPASSWORD=$POSTGRES_PASSWORD
- which psql
- psql -h $PG_HOST -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
- psql -h $PG_HOST -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "show port;"
- psql -h $PG_HOST -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "show config_file;"
- psql -h $PG_HOST -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "show unix_socket_directories;"
- psql -d "host=${PG_HOST} user=runner port=5432 dbname=${POSTGRES_DB}" -c "select 'OK' as query_from_connstring;"
- echo "what is in /etc/hosts"
- cat /etc/hosts
functional-test:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $PG_CONTAINER
stage: test
image: docker:19.03.1
services:
- docker:19.03.1-dind
- $PG_CONTAINER
- $PG_HOST
script:
- apk add postgresql-client bash
- export PGPASSWORD=$POSTGRES_PASSWORD
- export PGUSER=$POSTGRES_USER
- export PGPORT=5432
- export PGHOST=$PG_HOST
- echo "running tests"
- echo "Where? CI_BUILDS_DIR = $CI_BUILDS_DIR"
- ls $CI_BUILDS_DIR
- echo "Where? CI_PROJECT_DIR = $CI_PROJECT_DIR"
- ls $CI_PROJECT_DIR
- (cd /builds/cbbrowne/pgcmp/test; PGUSER=$POSTGRES_USER ./run-tests.sh)