diff mbox series

gitlab: fall back to commit hash in qemu-setup filename

Message ID 20220125173454.10381-1-stefanha@redhat.com
State New
Headers show
Series gitlab: fall back to commit hash in qemu-setup filename | expand

Commit Message

Stefan Hajnoczi Jan. 25, 2022, 5:34 p.m. UTC
Personal repos may not have release tags (v6.0.0, v6.1.0, etc) and this
causes cross_system_build_job to fail when pretty-printing a unique
qemu-setup-*.exe name:

  version="$(git describe --match v[0-9]*)";
             ^^^^^^^^^^ fails ^^^^^^^^^^^
  mv -v qemu-setup*.exe qemu-setup-${version}.exe;

Fall back to the short commit hash if necessary. This fixes CI failures
that Greg Kurz and I experienced in our personal repos.

Cc: Greg Kurz <groug@kaod.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 .gitlab-ci.d/crossbuild-template.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg Kurz Jan. 25, 2022, 5:47 p.m. UTC | #1
On Tue, 25 Jan 2022 17:34:54 +0000
Stefan Hajnoczi <stefanha@redhat.com> wrote:

> Personal repos may not have release tags (v6.0.0, v6.1.0, etc) and this
> causes cross_system_build_job to fail when pretty-printing a unique
> qemu-setup-*.exe name:
> 
>   version="$(git describe --match v[0-9]*)";
>              ^^^^^^^^^^ fails ^^^^^^^^^^^
>   mv -v qemu-setup*.exe qemu-setup-${version}.exe;
> 
> Fall back to the short commit hash if necessary. This fixes CI failures
> that Greg Kurz and I experienced in our personal repos.
> 
> Cc: Greg Kurz <groug@kaod.org>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---

Thanks for the green CI !

Reviewed-by: Greg Kurz <groug@kaod.org>

>  .gitlab-ci.d/crossbuild-template.yml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
> index 10d22dcf6c..29c3c2b826 100644
> --- a/.gitlab-ci.d/crossbuild-template.yml
> +++ b/.gitlab-ci.d/crossbuild-template.yml
> @@ -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]* 2>/dev/null || git rev-parse --short HEAD)";
>        mv -v qemu-setup*.exe qemu-setup-${version}.exe;
>        fi
>
Thomas Huth Jan. 26, 2022, 8:53 a.m. UTC | #2
On 25/01/2022 18.34, Stefan Hajnoczi wrote:
> Personal repos may not have release tags (v6.0.0, v6.1.0, etc) and this
> causes cross_system_build_job to fail when pretty-printing a unique
> qemu-setup-*.exe name:
> 
>    version="$(git describe --match v[0-9]*)";
>               ^^^^^^^^^^ fails ^^^^^^^^^^^
>    mv -v qemu-setup*.exe qemu-setup-${version}.exe;
> 
> Fall back to the short commit hash if necessary. This fixes CI failures
> that Greg Kurz and I experienced in our personal repos.
> 
> Cc: Greg Kurz <groug@kaod.org>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   .gitlab-ci.d/crossbuild-template.yml | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
> index 10d22dcf6c..29c3c2b826 100644
> --- a/.gitlab-ci.d/crossbuild-template.yml
> +++ b/.gitlab-ci.d/crossbuild-template.yml
> @@ -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]* 2>/dev/null || git rev-parse --short HEAD)";
>         mv -v qemu-setup*.exe qemu-setup-${version}.exe;
>         fi

Reviewed-by: Thomas Huth <thuth@redhat.com>
Alex Bennée Jan. 28, 2022, 4:47 p.m. UTC | #3
Stefan Hajnoczi <stefanha@redhat.com> writes:

> Personal repos may not have release tags (v6.0.0, v6.1.0, etc) and this
> causes cross_system_build_job to fail when pretty-printing a unique
> qemu-setup-*.exe name:
>
>   version="$(git describe --match v[0-9]*)";
>              ^^^^^^^^^^ fails ^^^^^^^^^^^
>   mv -v qemu-setup*.exe qemu-setup-${version}.exe;
>
> Fall back to the short commit hash if necessary. This fixes CI failures
> that Greg Kurz and I experienced in our personal repos.
>
> Cc: Greg Kurz <groug@kaod.org>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Queued to update-plugins-next-280122, thanks.
diff mbox series

Patch

diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
index 10d22dcf6c..29c3c2b826 100644
--- a/.gitlab-ci.d/crossbuild-template.yml
+++ b/.gitlab-ci.d/crossbuild-template.yml
@@ -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]* 2>/dev/null || git rev-parse --short HEAD)";
       mv -v qemu-setup*.exe qemu-setup-${version}.exe;
       fi