Skip to contentSkip to conversation

gitlab: Escape git-describe match pattern on Windows hosts

PATCH In review Philippe Mathieu-Daudé 4 participants 13 messages Sep 1, 2021 – Oct 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab: Escape git-describe match pattern on Windows hosts

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/crossbuild-template.yml +1 -1
index 10d22dcf6c1..62d33e6661d 100644
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";
       mv -v qemu-setup*.exe qemu-setup-${version}.exe;
       fi
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 21 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 5 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

It is a bit strange to me. AFAICT, the only difference would be if the unquoted v[0-9]* matched a filename in the current directory, but that doesn't seem like it is the case here.

Are you sure this isn't just caused by the setting

container-cross.yml: GIT_DEPTH: 1

ie we don't have the history depth needed to find any of the historic git tags.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 31 lines · Daniel P. Berrangé
Quoted 21 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 5 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 4 lines

It is a bit strange to me. AFAICT, the only difference would be if the unquoted v[0-9]* matched a filename in the current directory, but that doesn't seem like it is the case here.

We should quote the glob pattern anyway, to avoid possible really confusing behaviour in the future if such a file ever does turn up...

-- PMM

#3 lore raw
Quoted 32 lines · Peter Maydell
Quoted 31 lines · Daniel P. Berrangé
Quoted 21 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 5 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 8 lines
Quoted 4 lines

It is a bit strange to me. AFAICT, the only difference would be if the unquoted v[0-9]* matched a filename in the current directory, but that doesn't seem like it is the case here.

We should quote the glob pattern anyway, to avoid possible really confusing behaviour in the future if such a file ever does turn up...

Sure, I'm happy to see the thing quoted regardless, just want to make sure the commit behaviour matches the commit message.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

Cédric, do you mind testing on your fork?

Quoted 17 lines
Quoted 9 lines
Quoted 5 lines

It is a bit strange to me. AFAICT, the only difference would be if the unquoted v[0-9]* matched a filename in the current directory, but that doesn't seem like it is the case here.

We should quote the glob pattern anyway, to avoid possible really confusing behaviour in the future if such a file ever does turn up...

Sure, I'm happy to see the thing quoted regardless, just want to make sure the commit behaviour matches the commit message.

Regards,
Daniel

#5 lore raw
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw
Quoted 50 lines · Daniel P. Berrangé
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.
Quoted 3 lines

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

FYI it didn't work out on Cédric fork:
https://gitlab.com/legoater/qemu/-/jobs/1553492082

#7 lore raw
Quoted 51 lines · Philippe Mathieu-Daudé
Quoted 50 lines · Daniel P. Berrangé
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.
Quoted 7 lines
Quoted 3 lines

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

FYI it didn't work out on Cédric fork:
https://gitlab.com/legoater/qemu/-/jobs/1553492082

Indeed.

Thanks Phil,

C.

#8 lore raw
Quoted 52 lines · Cédric Le Goater
Quoted 51 lines · Philippe Mathieu-Daudé
Quoted 50 lines · Daniel P. Berrangé
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

What about not using the best tag if no versioned tag available? (no default string in case user wants to download and archive artifacts)

-- >8 --
@@ -14,7 +14,7 @@
- make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
- if grep -q "EXESUF=.exe" config-host.mak;
then make installer;
- version="$(git describe --match v[0-9]*)";
+ version="$(git describe --tags --match 'v[0-9]*' 2>/dev/null ||

git describe --abbrev)";
       mv -v qemu-setup*.exe qemu-setup-${version}.exe;
       fi

---

Quoted 10 lines
Quoted 3 lines

FYI it didn't work out on Cédric fork:
https://gitlab.com/legoater/qemu/-/jobs/1553492082

Indeed.

Thanks Phil,

C.

#9 lore raw
In reply to Cédric Le Goater
Quoted 56 lines · Cédric Le Goater
Quoted 55 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Daniel P. Berrangé
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

Quoted 5 lines
Quoted 3 lines

FYI it didn't work out on Cédric fork:
https://gitlab.com/legoater/qemu/-/jobs/1553492082

Indeed.

I'm curious if you go to

https://gitlab.com/legoater/qemu/-/settings/ci_cd

and expand "General pipelines", what value is set for the

"Git shallow clone"

setting. In my fork it is 0 which means unlimited depth, but in gitlab docs I see reference to repos getting this set to 50 since a particular gitlab release.

Likewise same question for Phil in ?

https://gitlab.com/philmd_rh/qemu/-/settings/ci_cd

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#10 lore raw
Quoted 71 lines · Daniel P. Berrangé
Quoted 56 lines · Cédric Le Goater
Quoted 55 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Daniel P. Berrangé
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé
Quoted 16 lines · Philippe Mathieu-Daudé

Properly escape git-describe 'match' pattern to avoid (MinGW):

  $ if grep -q "EXESUF=.exe" config-host.mak; then make installer;
    version="$(git describe --match v[0-9]*)";
    mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi
  fatal: No names found, cannot describe anything.
  ERROR: Job failed: exit code 1
Fixes 8619b5ddb56 ("ci: build & store windows installer")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/591

---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
.gitlab-ci.d/crossbuild-template.yml +0 -0
index 10d22dcf6c1..62d33e6661d 100644
Quoted 8 lines
Quoted 8 lines

.gitlab-ci.d/crossbuild-template.yml line 17

Quoted 6 lines
.gitlab-ci.d/crossbuild-template.yml +1 -1
@@ -14,7 +14,7 @@
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
-      version="$(git describe --match v[0-9]*)";
+      version="$(git describe --match 'v[0-9]*')";

Do you have a pointer to a pipeline showing this fix works ?

Quoted 2 lines

It worked on my fork but I have some versioned tag:
https://gitlab.com/philmd_rh/qemu/-/jobs/1553450025

I can reproduce the error msg if I do a shallow clone with no history

$ cd qemu
$ git describe --match v[0-9]*
v6.1.0-171-g5e8c1a0c90
$ cd ..
$ git clone --depth 1 https://gitlab.com/qemu-project/qemu/ qemu.new
$ cd qemu.new/
$ git describe --match v[0-9]*
fatal: No names found, cannot describe anything.

but the odd thing is that I think we should have been hitting the problem frequently if it was related to git depth. This job passes fine in current CI pipelines and my own fork.

Quoted 5 lines
Quoted 3 lines

FYI it didn't work out on Cédric fork:
https://gitlab.com/legoater/qemu/-/jobs/1553492082

Indeed.

I'm curious if you go to

https://gitlab.com/legoater/qemu/-/settings/ci_cd

and expand "General pipelines", what value is set for the

"Git shallow clone"

Quoted 7 lines

setting. In my fork it is 0 which means unlimited depth, but in gitlab docs I see reference to repos getting this set to 50 since a particular gitlab release.

Likewise same question for Phil in ?

https://gitlab.com/philmd_rh/qemu/-/settings/ci_cd

0 too.

#11 lore raw
In reply to Daniel P. Berrangé
Quoted 11 lines

I'm curious if you go to

https://gitlab.com/legoater/qemu/-/settings/ci_cd

and expand "General pipelines", what value is set for the

"Git shallow clone"

setting. In my fork it is 0 which means unlimited depth, but in gitlab docs I see reference to repos getting this set to 50 since a particular gitlab release.

Sorry for the late reply.

Setting the value to 0 fixed the windows build on gitlab.

Thanks,

C.

#12 lore raw
Quoted 8 lines · Cédric Le Goater
Quoted 8 lines

I'm curious if you go to

https://gitlab.com/legoater/qemu/-/settings/ci_cd

and expand "General pipelines", what value is set for the

"Git shallow clone"

Quoted 7 lines
Quoted 3 lines

setting. In my fork it is 0 which means unlimited depth, but in gitlab docs I see reference to repos getting this set to 50 since a particular gitlab release.

Sorry for the late reply.

Setting the value to 0 fixed the windows build on gitlab.

Ok, so we've got two options

- Change the code so it has sane fallback if the tags are all missing

- Set GIT_DEPTH in the affected jobs to a value that is larger than the maximum number of commits we expect in the course of a single dev cycle, plus 20% grace on top, so that we're guaranteed enough history to describe one tag.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|