-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GIT not being recognised inside docker build inside gitlab #38
Comments
This is (as I now realize) undocumented, but expected behavior: Lines 421 to 429 in c7b082b
|
Okay... I understand why it doesn't work... But now I ask why it works in my another project that runs in very similar conditions (same gitlab ci and almost identical stage config)? And why when I call |
Probably because the other repo has a shorter commit history and its root is within the commit-depth that GitLab's CI will check out. You may be able to tell GitLab's CI to do a full (non-shallow) checkout. |
Gitlab set the depth to 50 by default and what you said is not the case. The other project is older and contains a lot more commits. This project is new and probably doesn't even have the 50 commits to limit the depth |
Then I don't know. |
+1 on the "cannot get git features to work inside docker", although I understand why. I think it would be nice if there was a way to provide the git variables manually - e.g. for CI and docker builds. These variables are often available but not in the "traditional" Perhaps this could be expanded into an even more generic feature - it would be nice to be able to provide other constants to the |
@FelixZY, are you referring to "inside docker" in general or gitlab specifically? I'm not aware of a docker-related problem in general. |
I might be hijacking the issue a bit here but I'm referring to the fact that you cannot retrieve git information if, for some reason, you are stuck with a non-regular clone. In my case, I have access to the full repository but since I want to build a subdirectory (monorepo) in docker, I lose my git context (which is completely reasonable). In this case, I want to be able to provide the "lost" information manually, e.g. via an environment variable or by calling the I'm therefore suggesting two distinct features:
If 2. is implemented, 1. probably isn't necessary as developers could easily implement the functionality themselves. |
Hi,
I couldn't find the reason but I have a project that the GIT consts are all set to none when built inside gitlab ci.
I run the build in a
rust:alpine
based image.I've tried to print out all the info I could and couldn't find any reason for it to fail:
.git
directory was in the root folderbuilt
and it is indeed setting the git consts toNone
git2
dependency as a build dependency and calledRepository::discover(&Path::new(env!("CARGO_MANIFEST_DIR")))
to see if it was failing but it was returning Ok(repo).I have another project that has a simpler structure that everything works as expected. So I imagined it could be something related to my project structure, but I have no idea what could it be.
The text was updated successfully, but these errors were encountered: