Building the `'image:docs-latest` Docker image fails
After the investigation that stared in #1035 (comment 602553244), building image:docs-latest
fails with https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/1348929181.
=> Setting up dummy user/email in Git
fatal: not a git repository (or any of the parent directories): .git
=> Cloning https://gitlab.com/gitlab-org/gitlab.git into ../gitlab
Cloning into '../gitlab'...
warning: Could not find remote branch --single-branch to clone.
fatal: Remote branch --single-branch not found in upstream origin
fatal: cannot change to '../gitlab': No such file or directory
Latest commit:
fatal: not a git repository (or any of the parent directories): .git
=> Cloning https://gitlab.com/gitlab-org/omnibus-gitlab.git into ../omnibus-gitlab
Cloning into '../omnibus-gitlab'...
warning: Could not find remote branch --single-branch to clone.
fatal: Remote branch --single-branch not found in upstream origin
fatal: cannot change to '../omnibus-gitlab': No such file or directory
Latest commit:
fatal: not a git repository (or any of the parent directories): .git
=> Cloning https://gitlab.com/gitlab-org/gitlab-runner.git into ../gitlab-runner
Cloning into '../gitlab-runner'...
warning: Could not find remote branch --single-branch to clone.
fatal: Remote branch --single-branch not found in upstream origin
fatal: cannot change to '../gitlab-runner': No such file or directory
Latest commit:
fatal: not a git repository (or any of the parent directories): .git
=> Cloning https://gitlab.com/gitlab-org/charts/gitlab.git into ../charts-gitlab
Cloning into '../charts-gitlab'...
warning: Could not find remote branch --single-branch to clone.
fatal: Remote branch --single-branch not found in upstream origin
fatal: cannot change to '../charts-gitlab': No such file or directory
The feature flags directory /gitlab/config/feature_flags does not exist.
Latest commit:
The command '/bin/sh -c bundle exec rake setup_git default' returned a non-zero code: 1
Problem
TL;DR: when the command to find the remote branch is run (git remote show <url>
), we're not inside a Git directory and thus it fails.
Follow the rabbit hole:
- The
image:docs-latest
job runs. - The
RUN bundle exec rake setup_git default
step runs. - The
clone_repositories
task is called. - The
retrieve_branch(slug)
method is used to retrieve the branch. - The
default_branch
method is invoked. -
git remote show <url>
fails because we're not inside a Git repository.
Fix
A simple MVC is to just run git init
before the raketasks are run !1885 (closed).
A more solid solution is tracked in !1884 (merged).
Edited by Achilleas Pipinellis