Skip to content

Commit 1c05f66

Browse files
[build] fix CI warnings issued by "git describe" (sonic-net#13098)
./functions.sh script contains twice the command "git describe --tags". Azure pipelines currently retrieves the repository content by using a "git clone" or "git fetch" command with the option "--depth". When the depth is not enough sized to reach a tag in the "git log" history, "git describe --tags" generates on stderr the warning: "fatal: No names found, cannot describe anything." https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything During the build process, the functions.sh script is a lot consumed and this pointless warning appears in CI thousand lines w/o any added value. This situation can be easily avoided by redirecting related commands stderr output to /dev/null. Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
1 parent f1e84f9 commit 1c05f66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ docker_try_rmi() {
5151
}
5252

5353
sonic_get_version() {
54-
local describe=$(git describe --tags)
55-
local latest_tag=$(git describe --tags --abbrev=0)
54+
local describe=$(git describe --tags 2>/dev/null)
55+
local latest_tag=$(git describe --tags --abbrev=0 2>/dev/null)
5656
local branch_name=$(git rev-parse --abbrev-ref HEAD)
5757
if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then
5858
local dirty="-dirty-$BUILD_TIMESTAMP"

0 commit comments

Comments
 (0)