ci4rail / yocto-images

Repo to build Ci4Rails Linux Images
MIT License
0 stars 0 forks source link

Git Version not working with Tags only #104

Open FranziskaKnoedtel opened 5 months ago

FranziskaKnoedtel commented 5 months ago

Problem Description: The makefile does acquire the image version by using a git version container. This fails on old merged states if the commit you are using is only tagged and do not belong to a branch anymore.

How to Reproduce: Checkout for example the tag v1.3.1. Try to build any of the images:

franzi@devserver2:~/yocto-images$ ./yocto.sh 
+Target: image
Image: cpu01-devtools-image
make IMAGE_DIR=cpu01-devtools-image image
Generate image version
parse error: Invalid numeric literal at line 1, column 5
parse error: Invalid numeric literal at line 1, column 5
make: *** [Makefile:38: image] Error 4

This happens because the json generated by git version contains:

INFO [06/06/24 9:47:50:06] Working directory: /gitINFO [06/06/24 9:47:50:06] IsDynamicGitRepository: FalseINFO [06/06/24 9:47:50:07] Returning Project Root from DotGitDirectory: /git/.git/ - /git/INFO [06/06/24 9:47:50:07] Running on Unix.INFO [06/06/24 9:47:50:07] Project root is: /git/INFO [06/06/24 9:47:50:07] DotGit directory is: /git/.gitINFO [06/06/24 9:47:50:09] Begin: Loading version variables from disk cache INFO [06/06/24 9:47:50:09] Cache file /git/.git/gitversion_cache/AB1E9EBF3D4A048565D74968977E59C100D52DD4.yml not found. INFO [06/06/24 9:47:50:10] End: Loading version variables from disk cache (Took: 0.54ms) INFO [06/06/24 9:47:50:17] Using latest commit on specified branch INFO [06/06/24 9:47:50:18] Begin: Getting branches containing the commit '9182eb76548c2d3c864516e5fe369973f1f26e15'. INFO [06/06/24 9:47:50:18] Trying to find direct branches. INFO [06/06/24 9:47:50:18] No direct branches found, searching through tracked branches. INFO [06/06/24 9:47:50:18] Searching for commits reachable from 'origin/HEAD'. INFO [06/06/24 9:47:50:18] The branch 'origin/HEAD' has a matching commit. INFO [06/06/24 9:47:50:18] Searching for commits reachable from 'origin/beta'. INFO [06/06/24 9:47:50:18] The branch 'origin/beta' has no matching commits. INFO [06/06/24 9:47:50:18] Searching for commits reachable from 'origin/bsp_5_7_2'. INFO [06/06/24 9:47:50:18] The branch 'origin/bsp_5_7_2' has a matching commit. INFO [06/06/24 9:47:50:18] End: Getting branches containing the commit '9182eb76548c2d3c864516e5fe369973f1f26e15'. (Took: 9.30ms) INFO [06/06/24 9:47:50:21] Running against branch: (no branch) (9182eb76548c2d3c864516e5fe369973f1f26e15) INFO [06/06/24 9:47:50:21] Current commit is tagged with version 1.3.1, version calculation is for metadata only. WARN [06/06/24 9:47:50:21] An error occurred: It looks like the branch being examined is a detached Head pointing to commit '9182eb7'. Without a proper branch name GitVersion cannot determine the build version.

The tag used is lightweight and not annotated. Maybe this could be a problem, because the git documentation says (https://git-scm.com/docs/git-tag):

Annotated tags are meant for release while lightweight tags are meant for private or temporary object labels. For this reason, some git commands for naming objects (like git describe) will ignore lightweight tags by default.

FranziskaKnoedtel commented 3 months ago

Update: The docker container for generating the git version seems to be deleted.

franzi@devserver2:~/yocto-images$ docker pull elbb/bb-gitversion:0.7.0
Error response from daemon: pull access denied for elbb/bb-gitversion, repository does not exist or may require 'docker login': denied: requested access to the resource is denied