I have a GitLab project looking like this:
During the build of both first-api and second-api I will need to execute the database-migration to be able to run integration tests with a database started as a service.
Since the repository is public I tried to clone database-migration, build and then execute. Unfortionatly it fails on the clone step. This is from my .gitlab-ci.yml:
init_db:
stage: build
script:
- git clone https://gitlab.com/groupname/database-migration.git
- cd database-migration
- mvn exec:java
I get this error:
$ git clone https://gitlab.com/groupname/database-migration.git
Cloning into 'database-migration'...
fatal: could not read Username for 'https://gitlab.com': No such device or address
ERROR: Job failed: exit code 1
Is this the correct approach or is there a better solution? If this is the correct approach; how do I make it work?
Edit, trying submodules
After input that I should use submodules I changed my approach.
I have added a file .gitmodules
to first-api looking like this:
[submodule "database-migration"]
path = database-migration
url = ../database-migration.git
In .gitlab-ci.yml
I have the following:
image: maven:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
init_db:
stage: build
script:
- ls
- cd database-migration
- mvn exec:java
The job fails because the folder "database-migration" does not exist.
If you want to look at the repository it can be found here. I am trying to use submodules in "game-rest-api".
What am I doing wrong?