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

Avatar photo

theCodeCampus
Developer at thecodecampus </>

Our knowledge is not simply gained through reading - it is trained, tested and constantly being expanded. Because first and foremost, we are all developers at W11K. The know-how that we acquire here as developers, consultants and information architects flows immediately into our training courses and articles for 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.