I would like to just use GitLab CI to run test only not to deploy my app. I manage to assembly this .yml file:
image: java:8
stages:
- build
- test
build:
stage: build
script: ./gradlew build
artifacts:
paths:
- build/libs/myApp-4.0.0-SNAPSHOT.jar
unitTests:
stage: test
script:
- ./gradlew test
And in the GitLab Pipeline I get the following error:
ar.com.sebasira.myApp.myAppApplicationTests > contextLoads FAILED java.lang.IllegalStateException Caused by: org.springframework.beans.factory.BeanCreationException Caused by: org.springframework.beans.BeanInstantiationException Caused by: org.springframework.beans.factory.BeanCreationException Caused by: org.springframework.beans.BeanInstantiationException Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException
I'm guessing this could be related to database, right? I need to provide that database with credentials in my Server where the runner is?
If so, how should I do it? I'currently using application.properties file to define the connection to the DB.
And one more question... in the .gitlab-ci.yml file I need to put the path to the .jar but that filename will change everytime I update the version of my app. Do I need to manually change it?