URL for submodule incorrect
I am trying to use the following job to create an image that uses a repo, which references multiple submodules (hosted in same GitLab instance and even namespace):
build-image-kaniko:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_DEPTH: 1
GIT_STRATEGY: clone
script:
- echo Running Kaniko executor and building image
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_JOB_TOKEN}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context .
--dockerfile Dockerfile
--insecure
--skip-tls-verify
--skip-tls-verify-pull
--insecure-pull
--destination "${CI_REGISTRY_IMAGE}:latest-test"
#--verbosity debug
only:
- setup-cicd
Based on which runner I am using (my own group runner that I know is using Ubuntu Server and a shared one provided by the administrators of the GitLab instance at my institute) I am getting two different URLs both of which are incorrect.
Note: NAMESPACE
in my case is something like /institute/department/group/project-group
and REPO
is the repository the submodule is referencing.
-
Shared runner - unknown underlying system
Cloning into '/builds/NAMESPACE/REPO'... remote: The project you were looking for could not be found or you don't have permission to view it. fatal: repository 'https://gitlab.example.com/NAMESPACE/REPO.git/' not found fatal: clone of 'https://gitlab.example.com/NAMESPACE/REPO.git/' into submodule path '/builds/NAMESPACE/REPO' failed Failed to clone 'REPO'. Retry scheduled
Here there are two issues:
- the URL string between the
'
contains a trailing backslash/
- the actual hyperlink in the Web UI yon can click on points at an URL that contains
/'
(backslash AND a single quotation mark)
- the URL string between the
-
Group runner - Ubuntu Server with microk8s for Kubernetes
Cloning into '/builds/NAMESPACE/REPO'... fatal: could not read Username for 'https://gitlab.example.com': No such device or address fatal: clone of 'https://gitlab.example.com/NAMESPACE/REPO.git' into submodule path '/builds/NAMESPACE/REPO' failed Failed to clone 'REPO'. Retry scheduled
Here the issue is only an incorrect actual hyperlink in the Web UI that points contains
'
(single quotation mark)
The first issue is a mystery to me. The runner may as well be even running on Windows or on Linux but not in Kubernetes, which doesn't really fit a setup required by Kaniko.
The second one is only Web UI-related (at least I hope so) since the authentification issue is what I am actually struggling with as part of my journey on discovering how to incorporate repos with submodules in a CI job that require credentials (using both Kaniko and Docker dind
).
We are talking at least a Web UI bug. Worse scenario is things are going much deeper.
UPDATE 1:
I tried adjusting the URL of each submodule:
- removed
.git
suffix - removed
.git
suffix and added/
No difference. I am also overwriting my .gitmodules
in the CI to include the credentials (e.g. url = https://${CI_REGISTRY_USER}:${CI_JOB_TOKEN}@gitlab.example.com/NAMESPACE/REPO.git"
) and installing git
Docker dind
(currently dumped Kaniko and switched back to Docker for building my image) to manually clone my submodules.
Funny enough it doesn't matter whether I manually clone the submodules (git submodule update --init --recursive
) or use the GIT_*
CI job variables that are predefined by GitLab. The problem remains. So it appears to be an issue with how GitLab CICD handles such a task.
UPDATE 2:
Using relative URLs (with and without adjustments from first UPDATE 1) yield the same result.