April 3, 2019

Fill Gitlab-CI Postgres Database Service with SQL

We all love the Gitlab-CI and it’s docker support, also the services are a nice feature to get a database into your pipeline task.

But recently we had the issue that we need to prefill the given postgres:latest  service with some sql data for testing.

For ubuntu based docker images, there is a easy solution:

For other base images based on debian or alpine, you mabye need apk add as an apt install equivalent to get the correct postgres-client.

Beware the variables for the postgres db service and the values in the psql call need to match.

For the psql  reference see: https://www.postgresql.org/docs/current/app-psql.html

 

 

Related Posts

Admin Admin
Developer at thecodecampus </>


Leave a Reply

Add code to your comment in Markdown syntax.
Like this:
`inline example`

```
code block
example
```

Your email address will not be published.