This is my first time using GitLab CI/CD pipelines. I have submodules in my repository and I want to use those in my jobs. My project structure looks like this:
my-project
.gitmodules
.gitlab-ci.yml
backend/
Dockerfile
backend-project (submodule)
The gitlab instance is hosted by my school, the runner is hosted by myself. This is the content of the .gitlab-ci.yml file:
image: docker:20.10.16
variables:
DOCKER_TLS_CERTDIR: "/certs"
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
build-backend:
tags:
- docker
stage: build
services:
- docker:dind
before_script:
- docker version
- "docker info"
- "docker login -u $DIGITAL_OCEAN_USERNAME -p $DIGITAL_OCEAN_PASSWORD $DIGITAL_OCEAN_REGISTRY"
script:
- "cd backend/"
- "docker build -t $DIGITAL_OCEAN_REGISTRY/$BACK_END_IMAGE_NAME:latest ."
- "docker push $DIGITAL_OCEAN_REGISTRY/$BACK_END_IMAGE_NAME:latest"
after_script:
- "docker logout $DIGITAL_OCEAN_REGISTRY"
This is the error I get back from my job logging:
Submodule 'backend/backend-project' (https://git.school.nl/backend-project.git) registered for path 'backend/backend-project'
Synchronizing submodule url for 'backend/backend-project'
Cloning into '/builds/project/backend/backend-project'...
fatal: could not read Username for 'https://git.school.nl': No such device or address
fatal: clone of 'https://git.school.nl/backend-project.git' into submodule path '/builds/project/backend/backend-project' failed
Failed to clone 'backend/backend-project'. Retry scheduled
Cloning into '/builds/project/backend/backend-project'...
fatal: could not read Username for 'https://git.school.nl': No such device or address
fatal: clone of 'https://git.school.nl/backend-project.git' into submodule path '/builds/project/backend/backend-project' failed
Failed to clone 'backend/backend-project' a second time, aborting
This is the same error as in this article: Submodule won't clone, but the solution there was setting the GIT_SUBMODULE_STRATEGY
. That won’t work for me. The variable does not affect the error.
Thanks in advance for helping out!